Skip to content

Commit ef083f3

Browse files
authored
Merge azidentity 1.3 beta branch to main (Azure#20449)
1 parent 2895ec9 commit ef083f3

32 files changed

+1472
-307
lines changed

sdk/azidentity/CHANGELOG.md

Lines changed: 36 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
# Release History
22

3-
## 1.3.0-beta.3 (Unreleased)
3+
## 1.3.0-beta.5 (Unreleased)
44

55
### Features Added
6-
* `InteractiveBrowserCredentialOptions.LoginHint` enables pre-populating the login
7-
prompt with a username ([#15599](https://github.com/Azure/azure-sdk-for-go/pull/15599))
86

97
### Breaking Changes
108

@@ -13,6 +11,41 @@
1311

1412
### Other Changes
1513

14+
## 1.3.0-beta.4 (2023-03-08)
15+
16+
### Features Added
17+
* Added `WorkloadIdentityCredentialOptions.AdditionallyAllowedTenants` and `.DisableInstanceDiscovery`
18+
19+
### Bugs Fixed
20+
* Credentials now synchronize within `GetToken()` so a single instance can be shared among goroutines
21+
([#20044](https://github.com/Azure/azure-sdk-for-go/issues/20044))
22+
23+
### Other Changes
24+
* Upgraded dependencies
25+
26+
## 1.2.2 (2023-03-07)
27+
28+
### Other Changes
29+
* Upgraded dependencies
30+
31+
## 1.3.0-beta.3 (2023-02-07)
32+
33+
### Features Added
34+
* By default, credentials set client capability "CP1" to enable support for
35+
[Continuous Access Evaluation (CAE)](https://docs.microsoft.com/azure/active-directory/develop/app-resilience-continuous-access-evaluation).
36+
This indicates to Azure Active Directory that your application can handle CAE claims challenges.
37+
You can disable this behavior by setting the environment variable "AZURE_IDENTITY_DISABLE_CP1" to "true".
38+
* `InteractiveBrowserCredentialOptions.LoginHint` enables pre-populating the login
39+
prompt with a username ([#15599](https://github.com/Azure/azure-sdk-for-go/pull/15599))
40+
* Service principal and user credentials support ADFS authentication on Azure Stack.
41+
Specify "adfs" as the credential's tenant.
42+
* Applications running in private or disconnected clouds can prevent credentials from
43+
requesting Azure AD instance metadata by setting the `DisableInstanceDiscovery`
44+
field on credential options.
45+
* Many credentials can now be configured to authenticate in multiple tenants. The
46+
options types for these credentials have an `AdditionallyAllowedTenants` field
47+
that specifies additional tenants in which the credential may authenticate.
48+
1649
## 1.3.0-beta.2 (2023-01-10)
1750

1851
### Features Added

sdk/azidentity/azidentity.go

Lines changed: 26 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -26,23 +26,30 @@ import (
2626
)
2727

2828
const (
29-
azureAuthorityHost = "AZURE_AUTHORITY_HOST"
30-
azureClientCertificatePassword = "AZURE_CLIENT_CERTIFICATE_PASSWORD"
31-
azureClientCertificatePath = "AZURE_CLIENT_CERTIFICATE_PATH"
32-
azureClientID = "AZURE_CLIENT_ID"
33-
azureClientSecret = "AZURE_CLIENT_SECRET"
34-
azureFederatedTokenFile = "AZURE_FEDERATED_TOKEN_FILE"
35-
azurePassword = "AZURE_PASSWORD"
36-
azureRegionalAuthorityName = "AZURE_REGIONAL_AUTHORITY_NAME"
37-
azureTenantID = "AZURE_TENANT_ID"
38-
azureUsername = "AZURE_USERNAME"
29+
azureAdditionallyAllowedTenants = "AZURE_ADDITIONALLY_ALLOWED_TENANTS"
30+
azureAuthorityHost = "AZURE_AUTHORITY_HOST"
31+
azureClientCertificatePassword = "AZURE_CLIENT_CERTIFICATE_PASSWORD"
32+
azureClientCertificatePath = "AZURE_CLIENT_CERTIFICATE_PATH"
33+
azureClientID = "AZURE_CLIENT_ID"
34+
azureClientSecret = "AZURE_CLIENT_SECRET"
35+
azureFederatedTokenFile = "AZURE_FEDERATED_TOKEN_FILE"
36+
azurePassword = "AZURE_PASSWORD"
37+
azureRegionalAuthorityName = "AZURE_REGIONAL_AUTHORITY_NAME"
38+
azureTenantID = "AZURE_TENANT_ID"
39+
azureUsername = "AZURE_USERNAME"
3940

4041
organizationsTenantID = "organizations"
4142
developerSignOnClientID = "04b07795-8ddb-461a-bbee-02f9e1bf7b46"
4243
defaultSuffix = "/.default"
4344
tenantIDValidationErr = "invalid tenantID. You can locate your tenantID by following the instructions listed here: https://docs.microsoft.com/partner-center/find-ids-and-domain-names"
4445
)
4546

47+
var (
48+
// capability CP1 indicates the client application is capable of handling CAE claims challenges
49+
cp1 = []string{"CP1"}
50+
disableCP1 = strings.ToLower(os.Getenv("AZURE_IDENTITY_DISABLE_CP1")) == "true"
51+
)
52+
4653
var getConfidentialClient = func(clientID, tenantID string, cred confidential.Credential, co *azcore.ClientOptions, additionalOpts ...confidential.Option) (confidentialClient, error) {
4754
if !validTenantID(tenantID) {
4855
return confidential.Client{}, errors.New(tenantIDValidationErr)
@@ -51,16 +58,19 @@ var getConfidentialClient = func(clientID, tenantID string, cred confidential.Cr
5158
if err != nil {
5259
return confidential.Client{}, err
5360
}
61+
authority := runtime.JoinPaths(authorityHost, tenantID)
5462
o := []confidential.Option{
55-
confidential.WithAuthority(runtime.JoinPaths(authorityHost, tenantID)),
5663
confidential.WithAzureRegion(os.Getenv(azureRegionalAuthorityName)),
5764
confidential.WithHTTPClient(newPipelineAdapter(co)),
5865
}
66+
if !disableCP1 {
67+
o = append(o, confidential.WithClientCapabilities(cp1))
68+
}
5969
o = append(o, additionalOpts...)
6070
if strings.ToLower(tenantID) == "adfs" {
6171
o = append(o, confidential.WithInstanceDiscovery(false))
6272
}
63-
return confidential.New(clientID, cred, o...)
73+
return confidential.New(authority, clientID, cred, o...)
6474
}
6575

6676
var getPublicClient = func(clientID, tenantID string, co *azcore.ClientOptions, additionalOpts ...public.Option) (public.Client, error) {
@@ -71,18 +81,18 @@ var getPublicClient = func(clientID, tenantID string, co *azcore.ClientOptions,
7181
if err != nil {
7282
return public.Client{}, err
7383
}
74-
7584
o := []public.Option{
7685
public.WithAuthority(runtime.JoinPaths(authorityHost, tenantID)),
7786
public.WithHTTPClient(newPipelineAdapter(co)),
7887
}
88+
if !disableCP1 {
89+
o = append(o, public.WithClientCapabilities(cp1))
90+
}
7991
o = append(o, additionalOpts...)
8092
if strings.ToLower(tenantID) == "adfs" {
8193
o = append(o, public.WithInstanceDiscovery(false))
8294
}
83-
return public.New(clientID,
84-
o...,
85-
)
95+
return public.New(clientID, o...)
8696
}
8797

8898
// setAuthorityHost initializes the authority host for credentials. Precedence is:

0 commit comments

Comments
 (0)