Skip to content

Commit

Permalink
Rename LoginEndpoint to ActiveDirectoryAuthorityHost (Azure#17576)
Browse files Browse the repository at this point in the history
  • Loading branch information
chlowell committed Apr 18, 2022
1 parent a20667c commit 31b8c27
Show file tree
Hide file tree
Showing 10 changed files with 21 additions and 20 deletions.
3 changes: 2 additions & 1 deletion sdk/azcore/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
# Release History

## 0.23.2 (Unreleased)
## 0.24.0 (Unreleased)

### Features Added

### Breaking Changes
* Renamed `cloud.Configuration.LoginEndpoint` to `.ActiveDirectoryAuthorityHost`

### Bugs Fixed

Expand Down
2 changes: 1 addition & 1 deletion sdk/azcore/arm/runtime/policy_register_rp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ func TestRPRegistrationPolicyAudience(t *testing.T) {

audience := "audience"
conf := cloud.Configuration{
LoginEndpoint: srv.URL(),
ActiveDirectoryAuthorityHost: srv.URL(),
Services: map[cloud.ServiceName]cloud.ServiceConfiguration{
cloud.ResourceManager: {Audience: audience, Endpoint: srv.URL()},
},
Expand Down
10 changes: 5 additions & 5 deletions sdk/azcore/cloud/cloud.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ package cloud
var (
// AzureChina contains configuration for Azure China.
AzureChina = Configuration{
LoginEndpoint: "https://login.chinacloudapi.cn/", Services: map[ServiceName]ServiceConfiguration{},
ActiveDirectoryAuthorityHost: "https://login.chinacloudapi.cn/", Services: map[ServiceName]ServiceConfiguration{},
}
// AzureGovernment contains configuration for Azure Government.
AzureGovernment = Configuration{
LoginEndpoint: "https://login.microsoftonline.us/", Services: map[ServiceName]ServiceConfiguration{},
ActiveDirectoryAuthorityHost: "https://login.microsoftonline.us/", Services: map[ServiceName]ServiceConfiguration{},
}
// AzurePublicCloud contains configuration for Azure Public Cloud.
AzurePublicCloud = Configuration{
LoginEndpoint: "https://login.microsoftonline.com/", Services: map[ServiceName]ServiceConfiguration{},
ActiveDirectoryAuthorityHost: "https://login.microsoftonline.com/", Services: map[ServiceName]ServiceConfiguration{},
}
)

Expand All @@ -37,8 +37,8 @@ type ServiceConfiguration struct {

// Configuration configures a cloud.
type Configuration struct {
// LoginEndpoint is the base URL of the cloud's Azure Active Directory.
LoginEndpoint string
// ActiveDirectoryAuthorityHost is the base URL of the cloud's Azure Active Directory.
ActiveDirectoryAuthorityHost string
// Services contains configuration for the cloud's services.
Services map[ServiceName]ServiceConfiguration
}
2 changes: 1 addition & 1 deletion sdk/azcore/cloud/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Applications deployed to a private cloud such as Azure Stack create a Configurat
appropriate values:
c = cloud.Configuration{
LoginEndpoint: "https://...",
ActiveDirectoryAuthorityHost: "https://...",
Services: map[cloud.ServiceName]cloud.ServiceConfiguration{
cloud.ResourceManager: {
Audience: "...",
Expand Down
2 changes: 1 addition & 1 deletion sdk/azcore/internal/shared/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,5 @@ const (
Module = "azcore"

// Version is the semantic version (see http://semver.org) of this module.
Version = "v0.23.2"
Version = "v0.24.0"
)
8 changes: 4 additions & 4 deletions sdk/azidentity/azidentity.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,16 @@ const (
)

// setAuthorityHost initializes the authority host for credentials. Precedence is:
// 1. cloud.Configuration.LoginEndpoint value set by user
// 1. cloud.Configuration.ActiveDirectoryAuthorityHost value set by user
// 2. value of AZURE_AUTHORITY_HOST
// 3. default: Azure Public Cloud
func setAuthorityHost(cc cloud.Configuration) (string, error) {
host := cc.LoginEndpoint
host := cc.ActiveDirectoryAuthorityHost
if host == "" {
if len(cc.Services) > 0 {
return "", errors.New("missing LoginEndpoint for specified cloud")
return "", errors.New("missing ActiveDirectoryAuthorityHost for specified cloud")
}
host = cloud.AzurePublicCloud.LoginEndpoint
host = cloud.AzurePublicCloud.ActiveDirectoryAuthorityHost
if envAuthorityHost := os.Getenv(azureAuthorityHost); envAuthorityHost != "" {
host = envAuthorityHost
}
Expand Down
8 changes: 4 additions & 4 deletions sdk/azidentity/azidentity_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ func Test_WellKnownHosts(t *testing.T) {
t.Fatal(err)
}
if !strings.HasPrefix(host, "https://login.") {
t.Fatal("unexpected LoginEndpoint: " + host)
t.Fatal("unexpected ActiveDirectoryAuthorityHost: " + host)
}
}
}
Expand All @@ -180,7 +180,7 @@ func Test_SetEnvAuthorityHost(t *testing.T) {

func Test_CustomAuthorityHost(t *testing.T) {
setEnvironmentVariables(t, map[string]string{azureAuthorityHost: testHost + "/not"})
authorityHost, err := setAuthorityHost(cloud.Configuration{LoginEndpoint: testHost})
authorityHost, err := setAuthorityHost(cloud.Configuration{ActiveDirectoryAuthorityHost: testHost})
if err != nil {
t.Fatal(err)
}
Expand All @@ -196,7 +196,7 @@ func Test_DefaultAuthorityHost(t *testing.T) {
if err != nil {
t.Fatal(err)
}
if authorityHost != cloud.AzurePublicCloud.LoginEndpoint {
if authorityHost != cloud.AzurePublicCloud.ActiveDirectoryAuthorityHost {
t.Fatal("unexpected default host: " + authorityHost)
}
}
Expand Down Expand Up @@ -231,7 +231,7 @@ func Test_GetTokenRequiresScopes(t *testing.T) {

func Test_NonHTTPSAuthorityHost(t *testing.T) {
setEnvironmentVariables(t, map[string]string{azureAuthorityHost: ""})
authorityHost, err := setAuthorityHost(cloud.Configuration{LoginEndpoint: "http://localhost"})
authorityHost, err := setAuthorityHost(cloud.Configuration{ActiveDirectoryAuthorityHost: "http://localhost"})
if err == nil {
t.Fatal("Expected an error but did not receive one.")
}
Expand Down
2 changes: 1 addition & 1 deletion sdk/azidentity/client_certificate_credential_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ func TestClientCertificateCredential_NoPrivateKey(t *testing.T) {
defer close()
srv.AppendResponse(mock.WithBody([]byte(accessTokenRespSuccess)))
options := ClientCertificateCredentialOptions{}
options.Cloud.LoginEndpoint = srv.URL()
options.Cloud.ActiveDirectoryAuthorityHost = srv.URL()
options.Transport = srv
var key crypto.PrivateKey
_, err := NewClientCertificateCredential(fakeTenantID, fakeClientID, test.certs, key, &options)
Expand Down
2 changes: 2 additions & 0 deletions sdk/azidentity/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ module github.com/Azure/azure-sdk-for-go/sdk/azidentity

go 1.18

replace github.com/Azure/azure-sdk-for-go/sdk/azcore => ../azcore

require (
github.com/Azure/azure-sdk-for-go/sdk/azcore v0.23.0
github.com/Azure/azure-sdk-for-go/sdk/internal v0.9.1
Expand Down
2 changes: 0 additions & 2 deletions sdk/azidentity/go.sum
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
github.com/Azure/azure-sdk-for-go/sdk/azcore v0.23.0 h1:D7l5jspkc4kwBYRWoZE4DQnu6LVpLwDsMZjBKS4wZLQ=
github.com/Azure/azure-sdk-for-go/sdk/azcore v0.23.0/go.mod h1:w5pDIZuawUmY3Bj4tVx3Xb8KS96ToB0j315w9rqpAg0=
github.com/Azure/azure-sdk-for-go/sdk/internal v0.9.1 h1:sLZ/Y+P/5RRtsXWylBjB5lkgixYfm0MQPiwrSX//JSo=
github.com/Azure/azure-sdk-for-go/sdk/internal v0.9.1/go.mod h1:KLF4gFr6DcKFZwSuH8w8yEK6DpFl3LP5rhdvAb7Yz5I=
github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0 h1:WVsrXCnHlDDX8ls+tootqRE87/hL9S/g4ewig9RsD/c=
Expand Down

0 comments on commit 31b8c27

Please sign in to comment.