mirror of
https://github.com/kubernetes/client-go.git
synced 2025-06-24 14:12:18 +00:00
Merge pull request #72143 from karataliu/kubectl.aad
Fix aad support in kubectl for sovereign cloud Kubernetes-commit: c3e60b6e1c7bc147740800b7ac52712d55579844
This commit is contained in:
commit
dbd11fce0f
102
Godeps/Godeps.json
generated
102
Godeps/Godeps.json
generated
@ -404,207 +404,207 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "k8s.io/apimachinery/pkg/api/apitesting",
|
"ImportPath": "k8s.io/apimachinery/pkg/api/apitesting",
|
||||||
"Rev": "4d029f0333996cf231080e108e0bd1ece2a94d9f"
|
"Rev": "98853ca904e81a25e2000cae7f077dc30f81b85f"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "k8s.io/apimachinery/pkg/api/apitesting/fuzzer",
|
"ImportPath": "k8s.io/apimachinery/pkg/api/apitesting/fuzzer",
|
||||||
"Rev": "4d029f0333996cf231080e108e0bd1ece2a94d9f"
|
"Rev": "98853ca904e81a25e2000cae7f077dc30f81b85f"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "k8s.io/apimachinery/pkg/api/apitesting/roundtrip",
|
"ImportPath": "k8s.io/apimachinery/pkg/api/apitesting/roundtrip",
|
||||||
"Rev": "4d029f0333996cf231080e108e0bd1ece2a94d9f"
|
"Rev": "98853ca904e81a25e2000cae7f077dc30f81b85f"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "k8s.io/apimachinery/pkg/api/equality",
|
"ImportPath": "k8s.io/apimachinery/pkg/api/equality",
|
||||||
"Rev": "4d029f0333996cf231080e108e0bd1ece2a94d9f"
|
"Rev": "98853ca904e81a25e2000cae7f077dc30f81b85f"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "k8s.io/apimachinery/pkg/api/errors",
|
"ImportPath": "k8s.io/apimachinery/pkg/api/errors",
|
||||||
"Rev": "4d029f0333996cf231080e108e0bd1ece2a94d9f"
|
"Rev": "98853ca904e81a25e2000cae7f077dc30f81b85f"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "k8s.io/apimachinery/pkg/api/meta",
|
"ImportPath": "k8s.io/apimachinery/pkg/api/meta",
|
||||||
"Rev": "4d029f0333996cf231080e108e0bd1ece2a94d9f"
|
"Rev": "98853ca904e81a25e2000cae7f077dc30f81b85f"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "k8s.io/apimachinery/pkg/api/resource",
|
"ImportPath": "k8s.io/apimachinery/pkg/api/resource",
|
||||||
"Rev": "4d029f0333996cf231080e108e0bd1ece2a94d9f"
|
"Rev": "98853ca904e81a25e2000cae7f077dc30f81b85f"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "k8s.io/apimachinery/pkg/apis/meta/fuzzer",
|
"ImportPath": "k8s.io/apimachinery/pkg/apis/meta/fuzzer",
|
||||||
"Rev": "4d029f0333996cf231080e108e0bd1ece2a94d9f"
|
"Rev": "98853ca904e81a25e2000cae7f077dc30f81b85f"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "k8s.io/apimachinery/pkg/apis/meta/internalversion",
|
"ImportPath": "k8s.io/apimachinery/pkg/apis/meta/internalversion",
|
||||||
"Rev": "4d029f0333996cf231080e108e0bd1ece2a94d9f"
|
"Rev": "98853ca904e81a25e2000cae7f077dc30f81b85f"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "k8s.io/apimachinery/pkg/apis/meta/v1",
|
"ImportPath": "k8s.io/apimachinery/pkg/apis/meta/v1",
|
||||||
"Rev": "4d029f0333996cf231080e108e0bd1ece2a94d9f"
|
"Rev": "98853ca904e81a25e2000cae7f077dc30f81b85f"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured",
|
"ImportPath": "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured",
|
||||||
"Rev": "4d029f0333996cf231080e108e0bd1ece2a94d9f"
|
"Rev": "98853ca904e81a25e2000cae7f077dc30f81b85f"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "k8s.io/apimachinery/pkg/apis/meta/v1beta1",
|
"ImportPath": "k8s.io/apimachinery/pkg/apis/meta/v1beta1",
|
||||||
"Rev": "4d029f0333996cf231080e108e0bd1ece2a94d9f"
|
"Rev": "98853ca904e81a25e2000cae7f077dc30f81b85f"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "k8s.io/apimachinery/pkg/conversion",
|
"ImportPath": "k8s.io/apimachinery/pkg/conversion",
|
||||||
"Rev": "4d029f0333996cf231080e108e0bd1ece2a94d9f"
|
"Rev": "98853ca904e81a25e2000cae7f077dc30f81b85f"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "k8s.io/apimachinery/pkg/conversion/queryparams",
|
"ImportPath": "k8s.io/apimachinery/pkg/conversion/queryparams",
|
||||||
"Rev": "4d029f0333996cf231080e108e0bd1ece2a94d9f"
|
"Rev": "98853ca904e81a25e2000cae7f077dc30f81b85f"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "k8s.io/apimachinery/pkg/fields",
|
"ImportPath": "k8s.io/apimachinery/pkg/fields",
|
||||||
"Rev": "4d029f0333996cf231080e108e0bd1ece2a94d9f"
|
"Rev": "98853ca904e81a25e2000cae7f077dc30f81b85f"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "k8s.io/apimachinery/pkg/labels",
|
"ImportPath": "k8s.io/apimachinery/pkg/labels",
|
||||||
"Rev": "4d029f0333996cf231080e108e0bd1ece2a94d9f"
|
"Rev": "98853ca904e81a25e2000cae7f077dc30f81b85f"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "k8s.io/apimachinery/pkg/runtime",
|
"ImportPath": "k8s.io/apimachinery/pkg/runtime",
|
||||||
"Rev": "4d029f0333996cf231080e108e0bd1ece2a94d9f"
|
"Rev": "98853ca904e81a25e2000cae7f077dc30f81b85f"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "k8s.io/apimachinery/pkg/runtime/schema",
|
"ImportPath": "k8s.io/apimachinery/pkg/runtime/schema",
|
||||||
"Rev": "4d029f0333996cf231080e108e0bd1ece2a94d9f"
|
"Rev": "98853ca904e81a25e2000cae7f077dc30f81b85f"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer",
|
"ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer",
|
||||||
"Rev": "4d029f0333996cf231080e108e0bd1ece2a94d9f"
|
"Rev": "98853ca904e81a25e2000cae7f077dc30f81b85f"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/json",
|
"ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/json",
|
||||||
"Rev": "4d029f0333996cf231080e108e0bd1ece2a94d9f"
|
"Rev": "98853ca904e81a25e2000cae7f077dc30f81b85f"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/protobuf",
|
"ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/protobuf",
|
||||||
"Rev": "4d029f0333996cf231080e108e0bd1ece2a94d9f"
|
"Rev": "98853ca904e81a25e2000cae7f077dc30f81b85f"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/recognizer",
|
"ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/recognizer",
|
||||||
"Rev": "4d029f0333996cf231080e108e0bd1ece2a94d9f"
|
"Rev": "98853ca904e81a25e2000cae7f077dc30f81b85f"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/streaming",
|
"ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/streaming",
|
||||||
"Rev": "4d029f0333996cf231080e108e0bd1ece2a94d9f"
|
"Rev": "98853ca904e81a25e2000cae7f077dc30f81b85f"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/versioning",
|
"ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/versioning",
|
||||||
"Rev": "4d029f0333996cf231080e108e0bd1ece2a94d9f"
|
"Rev": "98853ca904e81a25e2000cae7f077dc30f81b85f"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "k8s.io/apimachinery/pkg/selection",
|
"ImportPath": "k8s.io/apimachinery/pkg/selection",
|
||||||
"Rev": "4d029f0333996cf231080e108e0bd1ece2a94d9f"
|
"Rev": "98853ca904e81a25e2000cae7f077dc30f81b85f"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "k8s.io/apimachinery/pkg/types",
|
"ImportPath": "k8s.io/apimachinery/pkg/types",
|
||||||
"Rev": "4d029f0333996cf231080e108e0bd1ece2a94d9f"
|
"Rev": "98853ca904e81a25e2000cae7f077dc30f81b85f"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "k8s.io/apimachinery/pkg/util/cache",
|
"ImportPath": "k8s.io/apimachinery/pkg/util/cache",
|
||||||
"Rev": "4d029f0333996cf231080e108e0bd1ece2a94d9f"
|
"Rev": "98853ca904e81a25e2000cae7f077dc30f81b85f"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "k8s.io/apimachinery/pkg/util/clock",
|
"ImportPath": "k8s.io/apimachinery/pkg/util/clock",
|
||||||
"Rev": "4d029f0333996cf231080e108e0bd1ece2a94d9f"
|
"Rev": "98853ca904e81a25e2000cae7f077dc30f81b85f"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "k8s.io/apimachinery/pkg/util/diff",
|
"ImportPath": "k8s.io/apimachinery/pkg/util/diff",
|
||||||
"Rev": "4d029f0333996cf231080e108e0bd1ece2a94d9f"
|
"Rev": "98853ca904e81a25e2000cae7f077dc30f81b85f"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "k8s.io/apimachinery/pkg/util/errors",
|
"ImportPath": "k8s.io/apimachinery/pkg/util/errors",
|
||||||
"Rev": "4d029f0333996cf231080e108e0bd1ece2a94d9f"
|
"Rev": "98853ca904e81a25e2000cae7f077dc30f81b85f"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "k8s.io/apimachinery/pkg/util/framer",
|
"ImportPath": "k8s.io/apimachinery/pkg/util/framer",
|
||||||
"Rev": "4d029f0333996cf231080e108e0bd1ece2a94d9f"
|
"Rev": "98853ca904e81a25e2000cae7f077dc30f81b85f"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "k8s.io/apimachinery/pkg/util/httpstream",
|
"ImportPath": "k8s.io/apimachinery/pkg/util/httpstream",
|
||||||
"Rev": "4d029f0333996cf231080e108e0bd1ece2a94d9f"
|
"Rev": "98853ca904e81a25e2000cae7f077dc30f81b85f"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "k8s.io/apimachinery/pkg/util/httpstream/spdy",
|
"ImportPath": "k8s.io/apimachinery/pkg/util/httpstream/spdy",
|
||||||
"Rev": "4d029f0333996cf231080e108e0bd1ece2a94d9f"
|
"Rev": "98853ca904e81a25e2000cae7f077dc30f81b85f"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "k8s.io/apimachinery/pkg/util/intstr",
|
"ImportPath": "k8s.io/apimachinery/pkg/util/intstr",
|
||||||
"Rev": "4d029f0333996cf231080e108e0bd1ece2a94d9f"
|
"Rev": "98853ca904e81a25e2000cae7f077dc30f81b85f"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "k8s.io/apimachinery/pkg/util/json",
|
"ImportPath": "k8s.io/apimachinery/pkg/util/json",
|
||||||
"Rev": "4d029f0333996cf231080e108e0bd1ece2a94d9f"
|
"Rev": "98853ca904e81a25e2000cae7f077dc30f81b85f"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "k8s.io/apimachinery/pkg/util/mergepatch",
|
"ImportPath": "k8s.io/apimachinery/pkg/util/mergepatch",
|
||||||
"Rev": "4d029f0333996cf231080e108e0bd1ece2a94d9f"
|
"Rev": "98853ca904e81a25e2000cae7f077dc30f81b85f"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "k8s.io/apimachinery/pkg/util/naming",
|
"ImportPath": "k8s.io/apimachinery/pkg/util/naming",
|
||||||
"Rev": "4d029f0333996cf231080e108e0bd1ece2a94d9f"
|
"Rev": "98853ca904e81a25e2000cae7f077dc30f81b85f"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "k8s.io/apimachinery/pkg/util/net",
|
"ImportPath": "k8s.io/apimachinery/pkg/util/net",
|
||||||
"Rev": "4d029f0333996cf231080e108e0bd1ece2a94d9f"
|
"Rev": "98853ca904e81a25e2000cae7f077dc30f81b85f"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "k8s.io/apimachinery/pkg/util/remotecommand",
|
"ImportPath": "k8s.io/apimachinery/pkg/util/remotecommand",
|
||||||
"Rev": "4d029f0333996cf231080e108e0bd1ece2a94d9f"
|
"Rev": "98853ca904e81a25e2000cae7f077dc30f81b85f"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "k8s.io/apimachinery/pkg/util/runtime",
|
"ImportPath": "k8s.io/apimachinery/pkg/util/runtime",
|
||||||
"Rev": "4d029f0333996cf231080e108e0bd1ece2a94d9f"
|
"Rev": "98853ca904e81a25e2000cae7f077dc30f81b85f"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "k8s.io/apimachinery/pkg/util/sets",
|
"ImportPath": "k8s.io/apimachinery/pkg/util/sets",
|
||||||
"Rev": "4d029f0333996cf231080e108e0bd1ece2a94d9f"
|
"Rev": "98853ca904e81a25e2000cae7f077dc30f81b85f"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "k8s.io/apimachinery/pkg/util/strategicpatch",
|
"ImportPath": "k8s.io/apimachinery/pkg/util/strategicpatch",
|
||||||
"Rev": "4d029f0333996cf231080e108e0bd1ece2a94d9f"
|
"Rev": "98853ca904e81a25e2000cae7f077dc30f81b85f"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "k8s.io/apimachinery/pkg/util/validation",
|
"ImportPath": "k8s.io/apimachinery/pkg/util/validation",
|
||||||
"Rev": "4d029f0333996cf231080e108e0bd1ece2a94d9f"
|
"Rev": "98853ca904e81a25e2000cae7f077dc30f81b85f"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "k8s.io/apimachinery/pkg/util/validation/field",
|
"ImportPath": "k8s.io/apimachinery/pkg/util/validation/field",
|
||||||
"Rev": "4d029f0333996cf231080e108e0bd1ece2a94d9f"
|
"Rev": "98853ca904e81a25e2000cae7f077dc30f81b85f"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "k8s.io/apimachinery/pkg/util/wait",
|
"ImportPath": "k8s.io/apimachinery/pkg/util/wait",
|
||||||
"Rev": "4d029f0333996cf231080e108e0bd1ece2a94d9f"
|
"Rev": "98853ca904e81a25e2000cae7f077dc30f81b85f"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "k8s.io/apimachinery/pkg/util/yaml",
|
"ImportPath": "k8s.io/apimachinery/pkg/util/yaml",
|
||||||
"Rev": "4d029f0333996cf231080e108e0bd1ece2a94d9f"
|
"Rev": "98853ca904e81a25e2000cae7f077dc30f81b85f"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "k8s.io/apimachinery/pkg/version",
|
"ImportPath": "k8s.io/apimachinery/pkg/version",
|
||||||
"Rev": "4d029f0333996cf231080e108e0bd1ece2a94d9f"
|
"Rev": "98853ca904e81a25e2000cae7f077dc30f81b85f"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "k8s.io/apimachinery/pkg/watch",
|
"ImportPath": "k8s.io/apimachinery/pkg/watch",
|
||||||
"Rev": "4d029f0333996cf231080e108e0bd1ece2a94d9f"
|
"Rev": "98853ca904e81a25e2000cae7f077dc30f81b85f"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "k8s.io/apimachinery/third_party/forked/golang/json",
|
"ImportPath": "k8s.io/apimachinery/third_party/forked/golang/json",
|
||||||
"Rev": "4d029f0333996cf231080e108e0bd1ece2a94d9f"
|
"Rev": "98853ca904e81a25e2000cae7f077dc30f81b85f"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "k8s.io/apimachinery/third_party/forked/golang/netutil",
|
"ImportPath": "k8s.io/apimachinery/third_party/forked/golang/netutil",
|
||||||
"Rev": "4d029f0333996cf231080e108e0bd1ece2a94d9f"
|
"Rev": "98853ca904e81a25e2000cae7f077dc30f81b85f"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "k8s.io/apimachinery/third_party/forked/golang/reflect",
|
"ImportPath": "k8s.io/apimachinery/third_party/forked/golang/reflect",
|
||||||
"Rev": "4d029f0333996cf231080e108e0bd1ece2a94d9f"
|
"Rev": "98853ca904e81a25e2000cae7f077dc30f81b85f"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "k8s.io/klog",
|
"ImportPath": "k8s.io/klog",
|
||||||
|
@ -145,6 +145,7 @@ func (r *azureRoundTripper) WrappedRoundTripper() http.RoundTripper { return r.r
|
|||||||
|
|
||||||
type azureToken struct {
|
type azureToken struct {
|
||||||
token adal.Token
|
token adal.Token
|
||||||
|
environment string
|
||||||
clientID string
|
clientID string
|
||||||
tenantID string
|
tenantID string
|
||||||
apiserverID string
|
apiserverID string
|
||||||
@ -219,6 +220,10 @@ func (ts *azureTokenSource) retrieveTokenFromCfg() (*azureToken, error) {
|
|||||||
if refreshToken == "" {
|
if refreshToken == "" {
|
||||||
return nil, fmt.Errorf("no refresh token in cfg: %s", cfgRefreshToken)
|
return nil, fmt.Errorf("no refresh token in cfg: %s", cfgRefreshToken)
|
||||||
}
|
}
|
||||||
|
environment := ts.cfg[cfgEnvironment]
|
||||||
|
if environment == "" {
|
||||||
|
return nil, fmt.Errorf("no environment in cfg: %s", cfgEnvironment)
|
||||||
|
}
|
||||||
clientID := ts.cfg[cfgClientID]
|
clientID := ts.cfg[cfgClientID]
|
||||||
if clientID == "" {
|
if clientID == "" {
|
||||||
return nil, fmt.Errorf("no client ID in cfg: %s", cfgClientID)
|
return nil, fmt.Errorf("no client ID in cfg: %s", cfgClientID)
|
||||||
@ -250,6 +255,7 @@ func (ts *azureTokenSource) retrieveTokenFromCfg() (*azureToken, error) {
|
|||||||
Resource: fmt.Sprintf("spn:%s", apiserverID),
|
Resource: fmt.Sprintf("spn:%s", apiserverID),
|
||||||
Type: tokenType,
|
Type: tokenType,
|
||||||
},
|
},
|
||||||
|
environment: environment,
|
||||||
clientID: clientID,
|
clientID: clientID,
|
||||||
tenantID: tenantID,
|
tenantID: tenantID,
|
||||||
apiserverID: apiserverID,
|
apiserverID: apiserverID,
|
||||||
@ -260,6 +266,7 @@ func (ts *azureTokenSource) storeTokenInCfg(token *azureToken) error {
|
|||||||
newCfg := make(map[string]string)
|
newCfg := make(map[string]string)
|
||||||
newCfg[cfgAccessToken] = token.token.AccessToken
|
newCfg[cfgAccessToken] = token.token.AccessToken
|
||||||
newCfg[cfgRefreshToken] = token.token.RefreshToken
|
newCfg[cfgRefreshToken] = token.token.RefreshToken
|
||||||
|
newCfg[cfgEnvironment] = token.environment
|
||||||
newCfg[cfgClientID] = token.clientID
|
newCfg[cfgClientID] = token.clientID
|
||||||
newCfg[cfgTenantID] = token.tenantID
|
newCfg[cfgTenantID] = token.tenantID
|
||||||
newCfg[cfgApiserverID] = token.apiserverID
|
newCfg[cfgApiserverID] = token.apiserverID
|
||||||
@ -275,7 +282,12 @@ func (ts *azureTokenSource) storeTokenInCfg(token *azureToken) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (ts *azureTokenSource) refreshToken(token *azureToken) (*azureToken, error) {
|
func (ts *azureTokenSource) refreshToken(token *azureToken) (*azureToken, error) {
|
||||||
oauthConfig, err := adal.NewOAuthConfig(azure.PublicCloud.ActiveDirectoryEndpoint, token.tenantID)
|
env, err := azure.EnvironmentFromName(token.environment)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
oauthConfig, err := adal.NewOAuthConfig(env.ActiveDirectoryEndpoint, token.tenantID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("building the OAuth configuration for token refresh: %v", err)
|
return nil, fmt.Errorf("building the OAuth configuration for token refresh: %v", err)
|
||||||
}
|
}
|
||||||
@ -299,6 +311,7 @@ func (ts *azureTokenSource) refreshToken(token *azureToken) (*azureToken, error)
|
|||||||
|
|
||||||
return &azureToken{
|
return &azureToken{
|
||||||
token: spt.Token(),
|
token: spt.Token(),
|
||||||
|
environment: token.environment,
|
||||||
clientID: token.clientID,
|
clientID: token.clientID,
|
||||||
tenantID: token.tenantID,
|
tenantID: token.tenantID,
|
||||||
apiserverID: token.apiserverID,
|
apiserverID: token.apiserverID,
|
||||||
@ -353,6 +366,7 @@ func (ts *azureTokenSourceDeviceCode) Token() (*azureToken, error) {
|
|||||||
|
|
||||||
return &azureToken{
|
return &azureToken{
|
||||||
token: *token,
|
token: *token,
|
||||||
|
environment: ts.environment.Name,
|
||||||
clientID: ts.clientID,
|
clientID: ts.clientID,
|
||||||
tenantID: ts.tenantID,
|
tenantID: ts.tenantID,
|
||||||
apiserverID: ts.apiserverID,
|
apiserverID: ts.apiserverID,
|
||||||
|
@ -53,6 +53,13 @@ func TestAzureTokenSource(t *testing.T) {
|
|||||||
|
|
||||||
wantCfg := token2Cfg(token)
|
wantCfg := token2Cfg(token)
|
||||||
persistedCfg := persiter.Cache()
|
persistedCfg := persiter.Cache()
|
||||||
|
|
||||||
|
wantCfgLen := len(wantCfg)
|
||||||
|
persistedCfgLen := len(persistedCfg)
|
||||||
|
if wantCfgLen != persistedCfgLen {
|
||||||
|
t.Errorf("wantCfgLen and persistedCfgLen do not match, wantCfgLen=%v, persistedCfgLen=%v", wantCfgLen, persistedCfgLen)
|
||||||
|
}
|
||||||
|
|
||||||
for k, v := range persistedCfg {
|
for k, v := range persistedCfg {
|
||||||
if strings.Compare(v, wantCfg[k]) != 0 {
|
if strings.Compare(v, wantCfg[k]) != 0 {
|
||||||
t.Errorf("Token() persisted cfg %s: got %v, want %v", k, v, wantCfg[k])
|
t.Errorf("Token() persisted cfg %s: got %v, want %v", k, v, wantCfg[k])
|
||||||
@ -103,6 +110,7 @@ type fakeTokenSource struct {
|
|||||||
func (ts *fakeTokenSource) Token() (*azureToken, error) {
|
func (ts *fakeTokenSource) Token() (*azureToken, error) {
|
||||||
return &azureToken{
|
return &azureToken{
|
||||||
token: newFackeAzureToken(ts.accessToken, ts.expiresOn),
|
token: newFackeAzureToken(ts.accessToken, ts.expiresOn),
|
||||||
|
environment: "testenv",
|
||||||
clientID: "fake",
|
clientID: "fake",
|
||||||
tenantID: "fake",
|
tenantID: "fake",
|
||||||
apiserverID: "fake",
|
apiserverID: "fake",
|
||||||
@ -113,6 +121,7 @@ func token2Cfg(token *azureToken) map[string]string {
|
|||||||
cfg := make(map[string]string)
|
cfg := make(map[string]string)
|
||||||
cfg[cfgAccessToken] = token.token.AccessToken
|
cfg[cfgAccessToken] = token.token.AccessToken
|
||||||
cfg[cfgRefreshToken] = token.token.RefreshToken
|
cfg[cfgRefreshToken] = token.token.RefreshToken
|
||||||
|
cfg[cfgEnvironment] = token.environment
|
||||||
cfg[cfgClientID] = token.clientID
|
cfg[cfgClientID] = token.clientID
|
||||||
cfg[cfgTenantID] = token.tenantID
|
cfg[cfgTenantID] = token.tenantID
|
||||||
cfg[cfgApiserverID] = token.apiserverID
|
cfg[cfgApiserverID] = token.apiserverID
|
||||||
|
Loading…
Reference in New Issue
Block a user