Skip to content

Commit

Permalink
Adding parameter to disable instance discovery
Browse files Browse the repository at this point in the history
  • Loading branch information
bganapa committed Jan 16, 2025
1 parent 2cd42fb commit f06b959
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/internal/pop/msal_confidential.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
// AcquirePoPTokenConfidential acquires a PoP token using MSAL's confidential login flow.
// This flow does not require user interaction as the credentials for the request have
// already been provided
// instanceDisovery is to be false only in disconnected clouds to disable instance discovery and authoority validation
func AcquirePoPTokenConfidential(
context context.Context,
popClaims map[string]string,
Expand All @@ -20,6 +21,7 @@ func AcquirePoPTokenConfidential(
authority,
clientID,
tenantID string,
instanceDiscovery bool,
options *azcore.ClientOptions,
popKeyFunc func() (*SwKey, error),
) (string, int64, error) {
Expand All @@ -43,13 +45,15 @@ func AcquirePoPTokenConfidential(
cred,
confidential.WithHTTPClient(options.Transport.(*http.Client)),
confidential.WithX5C(),
confidential.WithInstanceDiscovery(instanceDiscovery),
)
} else {
client, err = confidential.New(
authority,
clientID,
cred,
confidential.WithX5C(),
confidential.WithInstanceDiscovery(instanceDiscovery),
)
}
if err != nil {
Expand Down
1 change: 1 addition & 0 deletions pkg/internal/pop/msal_confidential_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ func TestAcquirePoPTokenConfidential(t *testing.T) {
authority,
tc.p.clientID,
tc.p.tenantID,
true,
&clientOpts,
GetSwPoPKey,
)
Expand Down
1 change: 1 addition & 0 deletions pkg/internal/token/serviceprincipaltokencertificate.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ func (p *servicePrincipalToken) getPoPTokenWithClientCert(
p.cloud.ActiveDirectoryAuthorityHost,
p.clientID,
p.tenantID,
true,
options,
pop.GetSwPoPKey,
)
Expand Down
1 change: 1 addition & 0 deletions pkg/internal/token/serviceprincipaltokensecret.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ func (p *servicePrincipalToken) getPoPTokenWithClientSecret(
p.cloud.ActiveDirectoryAuthorityHost,
p.clientID,
p.tenantID,
true,
options,
pop.GetSwPoPKey,
)
Expand Down

0 comments on commit f06b959

Please # to comment.