Skip to content

Commit

Permalink
rename Options to OAuthOptions (#415)
Browse files Browse the repository at this point in the history
  • Loading branch information
jhendrixMSFT authored Jul 1, 2019
1 parent ef48668 commit 31ab60d
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
8 changes: 4 additions & 4 deletions autorest/adal/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +100,12 @@ type MultiTenantOAuthConfig interface {
AuxiliaryTenants() []*OAuthConfig
}

// Options contains optional OAuthConfig creation arguments.
type Options struct {
// OAuthOptions contains optional OAuthConfig creation arguments.
type OAuthOptions struct {
APIVersion string
}

func (c Options) apiVersion() string {
func (c OAuthOptions) apiVersion() string {
if c.APIVersion != "" {
return fmt.Sprintf("?api-version=%s", c.APIVersion)
}
Expand All @@ -114,7 +114,7 @@ func (c Options) apiVersion() string {

// NewMultiTenantOAuthConfig creates an object that support multitenant OAuth configuration.
// See https://docs.microsoft.com/en-us/azure/azure-resource-manager/authenticate-multi-tenant for more information.
func NewMultiTenantOAuthConfig(activeDirectoryEndpoint, primaryTenantID string, auxiliaryTenantIDs []string, options Options) (MultiTenantOAuthConfig, error) {
func NewMultiTenantOAuthConfig(activeDirectoryEndpoint, primaryTenantID string, auxiliaryTenantIDs []string, options OAuthOptions) (MultiTenantOAuthConfig, error) {
if len(auxiliaryTenantIDs) == 0 || len(auxiliaryTenantIDs) > 3 {
return nil, errors.New("must specify one to three auxiliary tenants")
}
Expand Down
6 changes: 3 additions & 3 deletions autorest/adal/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ func TestNewOAuthConfigWithAPIVersionNotNil(t *testing.T) {
}

func TestNewMultiTenantOAuthConfig(t *testing.T) {
cfg, err := NewMultiTenantOAuthConfig(TestActiveDirectoryEndpoint, TestTenantID, TestAuxTenantIDs, Options{})
cfg, err := NewMultiTenantOAuthConfig(TestActiveDirectoryEndpoint, TestTenantID, TestAuxTenantIDs, OAuthOptions{})
if err != nil {
t.Fatalf("autorest/adal: unexpected error while creating multitenant config: %v", err)
}
Expand All @@ -115,11 +115,11 @@ func TestNewMultiTenantOAuthConfig(t *testing.T) {
}

func TestNewMultiTenantOAuthConfigFail(t *testing.T) {
_, err := NewMultiTenantOAuthConfig(TestActiveDirectoryEndpoint, TestTenantID, nil, Options{})
_, err := NewMultiTenantOAuthConfig(TestActiveDirectoryEndpoint, TestTenantID, nil, OAuthOptions{})
if err == nil {
t.Fatal("autorest/adal: expected non-nil error")
}
_, err = NewMultiTenantOAuthConfig(TestActiveDirectoryEndpoint, TestTenantID, []string{"one", "two", "three", "four"}, Options{})
_, err = NewMultiTenantOAuthConfig(TestActiveDirectoryEndpoint, TestTenantID, []string{"one", "two", "three", "four"}, OAuthOptions{})
if err == nil {
t.Fatal("autorest/adal: expected non-nil error")
}
Expand Down
2 changes: 1 addition & 1 deletion autorest/adal/token_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -846,7 +846,7 @@ func TestMarshalInnerToken(t *testing.T) {
}

func TestNewMultiTenantServicePrincipalToken(t *testing.T) {
cfg, err := NewMultiTenantOAuthConfig(TestActiveDirectoryEndpoint, TestTenantID, TestAuxTenantIDs, Options{})
cfg, err := NewMultiTenantOAuthConfig(TestActiveDirectoryEndpoint, TestTenantID, TestAuxTenantIDs, OAuthOptions{})
if err != nil {
t.Fatalf("autorest/adal: unexpected error while creating multitenant config: %v", err)
}
Expand Down
2 changes: 1 addition & 1 deletion autorest/azure/auth/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,7 @@ func (ccc ClientCredentialsConfig) ServicePrincipalToken() (*adal.ServicePrincip

// MultiTenantServicePrincipalToken creates a MultiTenantServicePrincipalToken from client credentials.
func (ccc ClientCredentialsConfig) MultiTenantServicePrincipalToken() (*adal.MultiTenantServicePrincipalToken, error) {
oauthConfig, err := adal.NewMultiTenantOAuthConfig(ccc.AADEndpoint, ccc.TenantID, ccc.AuxTenants, adal.Options{})
oauthConfig, err := adal.NewMultiTenantOAuthConfig(ccc.AADEndpoint, ccc.TenantID, ccc.AuxTenants, adal.OAuthOptions{})
if err != nil {
return nil, err
}
Expand Down

0 comments on commit 31ab60d

Please sign in to comment.