Skip to content

Commit d1480ab

Browse files
committed
It fixes a bug where AAD token obtained by kubectl is incompatible with on-behalf-of flow and oidc.
1 parent 8cd8784 commit d1480ab

File tree

2 files changed

+3
-3
lines changed
  • staging/src/k8s.io

2 files changed

+3
-3
lines changed

staging/src/k8s.io/client-go/plugin/pkg/client/auth/azure/azure.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ func (ts *azureTokenSource) refreshToken(token *azureToken) (*azureToken, error)
287287
return nil, err
288288
}
289289

290-
oauthConfig, err := adal.NewOAuthConfig(env.ActiveDirectoryEndpoint, token.tenantID)
290+
oauthConfig, err := adal.NewOAuthConfigWithAPIVersion(env.ActiveDirectoryEndpoint, token.tenantID, nil)
291291
if err != nil {
292292
return nil, fmt.Errorf("building the OAuth configuration for token refresh: %v", err)
293293
}
@@ -344,7 +344,7 @@ func newAzureTokenSourceDeviceCode(environment azure.Environment, clientID strin
344344
}
345345

346346
func (ts *azureTokenSourceDeviceCode) Token() (*azureToken, error) {
347-
oauthConfig, err := adal.NewOAuthConfig(ts.environment.ActiveDirectoryEndpoint, ts.tenantID)
347+
oauthConfig, err := adal.NewOAuthConfigWithAPIVersion(ts.environment.ActiveDirectoryEndpoint, ts.tenantID, nil)
348348
if err != nil {
349349
return nil, fmt.Errorf("building the OAuth configuration for device code authentication: %v", err)
350350
}

staging/src/k8s.io/legacy-cloud-providers/azure/auth/azure_auth.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ func GetServicePrincipalToken(config *AzureAuthConfig, env *azure.Environment) (
9797
env.ServiceManagementEndpoint)
9898
}
9999

100-
oauthConfig, err := adal.NewOAuthConfig(env.ActiveDirectoryEndpoint, tenantID)
100+
oauthConfig, err := adal.NewOAuthConfigWithAPIVersion(env.ActiveDirectoryEndpoint, tenantID, nil)
101101
if err != nil {
102102
return nil, fmt.Errorf("creating the OAuth config: %v", err)
103103
}

0 commit comments

Comments
 (0)