Skip to content

Commit

Permalink
[azidentity] bump azcore and internal dependencies (#15348)
Browse files Browse the repository at this point in the history
  • Loading branch information
seankane-msft authored Aug 20, 2021
1 parent efdd837 commit ea571ad
Show file tree
Hide file tree
Showing 20 changed files with 97 additions and 72 deletions.
7 changes: 2 additions & 5 deletions sdk/azidentity/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
# Release History

## v0.10.0-beta.1 (Unreleased)

### Features Added

### Breaking Changes
## v0.9.3 (Unreleased)

### Bugs Fixed
* `ManagedIdentityCredential.GetToken` no longer mutates its `opts.Scopes`

### Other Changes
* Bumps version of `azcore` to `v0.18.1`


## v0.9.2 (2021-07-23)
Expand Down
5 changes: 3 additions & 2 deletions sdk/azidentity/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -238,13 +238,14 @@ Credentials log basic information only, including `GetToken` success or failure
To obtain more detailed logging, including request/response bodies and header values, make sure to leave the logger as default or enable the `LogRequest` and/or `LogResponse` classificatons. A logger that only includes credential logs can be like the following:

```go
import azlog "github.com/Azure/azure-sdk-for-go/sdk/azcore/log"
// Set log to output to the console
azcore.Log().SetListener(func(cls LogClassification, s string) {
azlog.SetListener(func(cls LogClassification, s string) {
fmt.Println(s) // printing log out to the console
})

// Include only azidentity credential logs
azcore.Log().SetClassifications(azidentity.LogCredential)
azlog.SetClassifications(azidentity.LogCredential)
```

> CAUTION: logs from credentials contain sensitive information.
Expand Down
26 changes: 13 additions & 13 deletions sdk/azidentity/aad_identity_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ func (c *aadIdentityClient) refreshAccessToken(ctx context.Context, tenantID str
return nil, err
}

if resp.HasStatusCode(successStatusCodes[:]...) {
if azcore.HasStatusCode(resp, successStatusCodes[:]...) {
return c.createRefreshAccessToken(resp)
}

Expand All @@ -108,7 +108,7 @@ func (c *aadIdentityClient) authenticate(ctx context.Context, tenantID string, c
return nil, err
}

if resp.HasStatusCode(successStatusCodes[:]...) {
if azcore.HasStatusCode(resp, successStatusCodes[:]...) {
return c.createAccessToken(resp)
}

Expand All @@ -133,20 +133,20 @@ func (c *aadIdentityClient) authenticateCertificate(ctx context.Context, tenantI
return nil, err
}

if resp.HasStatusCode(successStatusCodes[:]...) {
if azcore.HasStatusCode(resp, successStatusCodes[:]...) {
return c.createAccessToken(resp)
}

return nil, &AuthenticationFailedError{inner: newAADAuthenticationFailedError(resp)}
}

func (c *aadIdentityClient) createAccessToken(res *azcore.Response) (*azcore.AccessToken, error) {
func (c *aadIdentityClient) createAccessToken(res *http.Response) (*azcore.AccessToken, error) {
value := struct {
Token string `json:"access_token"`
ExpiresIn json.Number `json:"expires_in"`
ExpiresOn string `json:"expires_on"`
}{}
if err := res.UnmarshalAsJSON(&value); err != nil {
if err := azcore.UnmarshalAsJSON(res, &value); err != nil {
return nil, fmt.Errorf("internal AccessToken: %w", err)
}
t, err := value.ExpiresIn.Int64()
Expand All @@ -159,7 +159,7 @@ func (c *aadIdentityClient) createAccessToken(res *azcore.Response) (*azcore.Acc
}, nil
}

func (c *aadIdentityClient) createRefreshAccessToken(res *azcore.Response) (*tokenResponse, error) {
func (c *aadIdentityClient) createRefreshAccessToken(res *http.Response) (*tokenResponse, error) {
// To know more about refreshing access tokens please see: https://docs.microsoft.com/en-us/azure/active-directory/develop/v1-protocols-oauth-code#refreshing-the-access-tokens
// DeviceCodeCredential uses refresh token, please see the authentication flow here: https://docs.microsoft.com/en-us/azure/active-directory/develop/v2-oauth2-device-code
value := struct {
Expand All @@ -168,7 +168,7 @@ func (c *aadIdentityClient) createRefreshAccessToken(res *azcore.Response) (*tok
ExpiresIn json.Number `json:"expires_in"`
ExpiresOn string `json:"expires_on"`
}{}
if err := res.UnmarshalAsJSON(&value); err != nil {
if err := azcore.UnmarshalAsJSON(res, &value); err != nil {
return nil, fmt.Errorf("internal AccessToken: %w", err)
}
t, err := value.ExpiresIn.Int64()
Expand Down Expand Up @@ -267,7 +267,7 @@ func (c *aadIdentityClient) authenticateUsernamePassword(ctx context.Context, te
return nil, err
}

if resp.HasStatusCode(successStatusCodes[:]...) {
if azcore.HasStatusCode(resp, successStatusCodes[:]...) {
return c.createAccessToken(resp)
}

Expand All @@ -294,9 +294,9 @@ func (c *aadIdentityClient) createUsernamePasswordAuthRequest(ctx context.Contex
return req, nil
}

func createDeviceCodeResult(res *azcore.Response) (*deviceCodeResult, error) {
func createDeviceCodeResult(res *http.Response) (*deviceCodeResult, error) {
value := &deviceCodeResult{}
if err := res.UnmarshalAsJSON(&value); err != nil {
if err := azcore.UnmarshalAsJSON(res, &value); err != nil {
return nil, fmt.Errorf("DeviceCodeResult: %w", err)
}
return value, nil
Expand All @@ -320,7 +320,7 @@ func (c *aadIdentityClient) authenticateDeviceCode(ctx context.Context, tenantID
return nil, err
}

if resp.HasStatusCode(successStatusCodes[:]...) {
if azcore.HasStatusCode(resp, successStatusCodes[:]...) {
return c.createRefreshAccessToken(resp)
}

Expand Down Expand Up @@ -356,7 +356,7 @@ func (c *aadIdentityClient) requestNewDeviceCode(ctx context.Context, tenantID,
return nil, err
}

if resp.HasStatusCode(successStatusCodes[:]...) {
if azcore.HasStatusCode(resp, successStatusCodes[:]...) {
return createDeviceCodeResult(resp)
}
return nil, &AuthenticationFailedError{inner: newAADAuthenticationFailedError(resp)}
Expand Down Expand Up @@ -408,7 +408,7 @@ func (c *aadIdentityClient) authenticateAuthCode(ctx context.Context, tenantID,
return nil, err
}

if resp.HasStatusCode(successStatusCodes[:]...) {
if azcore.HasStatusCode(resp, successStatusCodes[:]...) {
return c.createAccessToken(resp)
}

Expand Down
2 changes: 1 addition & 1 deletion sdk/azidentity/authorization_code_credential.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ type AuthorizationCodeCredentialOptions struct {
AuthorityHost string
// HTTPClient sets the transport for making HTTP requests
// Leave this as nil to use the default HTTP transport
HTTPClient azcore.Transport
HTTPClient azcore.Transporter
// Retry configures the built-in retry policy behavior
Retry azcore.RetryOptions
// Telemetry configures the built-in telemetry policy behavior
Expand Down
8 changes: 4 additions & 4 deletions sdk/azidentity/azidentity.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ type AADAuthenticationFailedError struct {
TraceID string `json:"trace_id"`
CorrelationID string `json:"correlation_id"`
URL string `json:"error_uri"`
Response *azcore.Response
Response *http.Response
}

func (e *AADAuthenticationFailedError) Error() string {
Expand Down Expand Up @@ -98,9 +98,9 @@ func (e *AuthenticationFailedError) Error() string {

var _ azcore.NonRetriableError = (*AuthenticationFailedError)(nil)

func newAADAuthenticationFailedError(resp *azcore.Response) error {
func newAADAuthenticationFailedError(resp *http.Response) error {
authFailed := &AADAuthenticationFailedError{Response: resp}
err := resp.UnmarshalAsJSON(authFailed)
err := azcore.UnmarshalAsJSON(resp, authFailed)
if err != nil {
authFailed.Message = resp.Status
authFailed.Description = "Failed to unmarshal response: " + err.Error()
Expand Down Expand Up @@ -132,7 +132,7 @@ var _ azcore.NonRetriableError = (*CredentialUnavailableError)(nil)
type pipelineOptions struct {
// HTTPClient sets the transport for making HTTP requests
// Leave this as nil to use the default HTTP transport
HTTPClient azcore.Transport
HTTPClient azcore.Transporter

// Retry configures the built-in retry policy behavior
Retry azcore.RetryOptions
Expand Down
2 changes: 1 addition & 1 deletion sdk/azidentity/bearer_token_policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ func newBearerTokenPolicy(creds azcore.TokenCredential, opts azcore.Authenticati
return p
}

func (b *bearerTokenPolicy) Do(req *azcore.Request) (*azcore.Response, error) {
func (b *bearerTokenPolicy) Do(req *azcore.Request) (*http.Response, error) {
as := acquiringResourceState{
p: *b,
req: req,
Expand Down
2 changes: 1 addition & 1 deletion sdk/azidentity/bearer_token_policy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const (
accessTokenRespShortLived = `{"access_token": "` + tokenValue + `", "expires_in": 0}`
)

func defaultTestPipeline(srv azcore.Transport, cred azcore.Credential, scope string) azcore.Pipeline {
func defaultTestPipeline(srv azcore.Transporter, cred azcore.Credential, scope string) azcore.Pipeline {
retryOpts := azcore.RetryOptions{
MaxRetryDelay: 500 * time.Millisecond,
RetryDelay: 50 * time.Millisecond,
Expand Down
2 changes: 1 addition & 1 deletion sdk/azidentity/client_certificate_credential.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ type ClientCertificateCredentialOptions struct {
AuthorityHost string
// HTTPClient sets the transport for making HTTP requests
// Leave this as nil to use the default HTTP transport
HTTPClient azcore.Transport
HTTPClient azcore.Transporter
// Retry configures the built-in retry policy behavior
Retry azcore.RetryOptions
// Telemetry configures the built-in telemetry policy behavior
Expand Down
2 changes: 1 addition & 1 deletion sdk/azidentity/client_secret_credential.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ type ClientSecretCredentialOptions struct {
AuthorityHost string
// HTTPClient sets the transport for making HTTP requests
// Leave this as nil to use the default HTTP transport
HTTPClient azcore.Transport
HTTPClient azcore.Transporter
// Retry configures the built-in retry policy behavior
Retry azcore.RetryOptions
// Telemetry configures the built-in telemetry policy behavior
Expand Down
3 changes: 2 additions & 1 deletion sdk/azidentity/default_azure_credential.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ package azidentity

import (
"github.com/Azure/azure-sdk-for-go/sdk/azcore"
"github.com/Azure/azure-sdk-for-go/sdk/internal/log"
)

const (
Expand Down Expand Up @@ -72,6 +73,6 @@ func NewDefaultAzureCredential(options *DefaultAzureCredentialOptions) (*Chained
logCredentialError(err.credentialType, err)
return nil, err
}
azcore.Log().Write(LogCredential, "Azure Identity => NewDefaultAzureCredential() invoking NewChainedTokenCredential()")
log.Write(LogCredential, "Azure Identity => NewDefaultAzureCredential() invoking NewChainedTokenCredential()")
return NewChainedTokenCredential(creds...)
}
2 changes: 1 addition & 1 deletion sdk/azidentity/device_code_credential.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ type DeviceCodeCredentialOptions struct {
AuthorityHost string
// HTTPClient sets the transport for making HTTP requests
// Leave this as nil to use the default HTTP transport
HTTPClient azcore.Transport
HTTPClient azcore.Transporter
// Retry configures the built-in retry policy behavior
Retry azcore.RetryOptions
// Telemetry configures the built-in telemetry policy behavior
Expand Down
9 changes: 5 additions & 4 deletions sdk/azidentity/environment_credential.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"os"

"github.com/Azure/azure-sdk-for-go/sdk/azcore"
"github.com/Azure/azure-sdk-for-go/sdk/internal/log"
)

// EnvironmentCredentialOptions configures the EnvironmentCredential with optional parameters.
Expand All @@ -18,7 +19,7 @@ type EnvironmentCredentialOptions struct {
AuthorityHost string
// HTTPClient sets the transport for making HTTP requests
// Leave this as nil to use the default HTTP transport
HTTPClient azcore.Transport
HTTPClient azcore.Transporter
// Retry configures the built-in retry policy behavior
Retry azcore.RetryOptions
// Telemetry configures the built-in telemetry policy behavior
Expand Down Expand Up @@ -61,15 +62,15 @@ func NewEnvironmentCredential(options *EnvironmentCredentialOptions) (*Environme
return nil, err
}
if clientSecret := os.Getenv("AZURE_CLIENT_SECRET"); clientSecret != "" {
azcore.Log().Write(LogCredential, "Azure Identity => NewEnvironmentCredential() invoking ClientSecretCredential")
log.Write(LogCredential, "Azure Identity => NewEnvironmentCredential() invoking ClientSecretCredential")
cred, err := NewClientSecretCredential(tenantID, clientID, clientSecret, &ClientSecretCredentialOptions{AuthorityHost: options.AuthorityHost, HTTPClient: options.HTTPClient, Retry: options.Retry, Telemetry: options.Telemetry, Logging: options.Logging})
if err != nil {
return nil, err
}
return &EnvironmentCredential{cred: cred}, nil
}
if clientCertificate := os.Getenv("AZURE_CLIENT_CERTIFICATE_PATH"); clientCertificate != "" {
azcore.Log().Write(LogCredential, "Azure Identity => NewEnvironmentCredential() invoking ClientCertificateCredential")
log.Write(LogCredential, "Azure Identity => NewEnvironmentCredential() invoking ClientCertificateCredential")
cred, err := NewClientCertificateCredential(tenantID, clientID, clientCertificate, &ClientCertificateCredentialOptions{AuthorityHost: options.AuthorityHost, HTTPClient: options.HTTPClient, Retry: options.Retry, Telemetry: options.Telemetry, Logging: options.Logging})
if err != nil {
return nil, err
Expand All @@ -78,7 +79,7 @@ func NewEnvironmentCredential(options *EnvironmentCredentialOptions) (*Environme
}
if username := os.Getenv("AZURE_USERNAME"); username != "" {
if password := os.Getenv("AZURE_PASSWORD"); password != "" {
azcore.Log().Write(LogCredential, "Azure Identity => NewEnvironmentCredential() invoking UsernamePasswordCredential")
log.Write(LogCredential, "Azure Identity => NewEnvironmentCredential() invoking UsernamePasswordCredential")
cred, err := NewUsernamePasswordCredential(tenantID, clientID, username, password, &UsernamePasswordCredentialOptions{AuthorityHost: options.AuthorityHost, HTTPClient: options.HTTPClient, Retry: options.Retry, Telemetry: options.Telemetry, Logging: options.Logging})
if err != nil {
return nil, err
Expand Down
6 changes: 3 additions & 3 deletions sdk/azidentity/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ module github.com/Azure/azure-sdk-for-go/sdk/azidentity
go 1.14

require (
github.com/Azure/azure-sdk-for-go/sdk/azcore v0.17.0
github.com/Azure/azure-sdk-for-go/sdk/internal v0.5.1
github.com/Azure/azure-sdk-for-go/sdk/azcore v0.18.1
github.com/Azure/azure-sdk-for-go/sdk/internal v0.7.0
github.com/pkg/browser v0.0.0-20180916011732-0a3d74bf9ce4
golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897
golang.org/x/net v0.0.0-20201110031124-69a78807bb2b
golang.org/x/net v0.0.0-20210610132358-84b48f89b13b
)
41 changes: 28 additions & 13 deletions sdk/azidentity/go.sum
Original file line number Diff line number Diff line change
@@ -1,23 +1,38 @@
github.com/Azure/azure-sdk-for-go/sdk/azcore v0.17.0 h1:j9ra6YGWu3TqNmCprpWYFCqQ3aizqujxrqhI7KLu6qg=
github.com/Azure/azure-sdk-for-go/sdk/azcore v0.17.0/go.mod h1:MVdrcUC4Hup35qHym3VdzoW+NBgBxrta9Vei97jRtM8=
github.com/Azure/azure-sdk-for-go/sdk/internal v0.5.1 h1:vx8McI56N5oLSQu8xa+xdiE0fjQq8W8Zt49vHP8Rygw=
github.com/Azure/azure-sdk-for-go/sdk/internal v0.5.1/go.mod h1:k4KbFSunV/+0hOHL1vyFaPsiYQ1Vmvy1TBpmtvCDLZM=
github.com/Azure/azure-sdk-for-go/sdk/azcore v0.18.1 h1:BxW0zeNz9VbxtaeyuwAsgZ2WgCG7wwjb17H3f5czlp4=
github.com/Azure/azure-sdk-for-go/sdk/azcore v0.18.1/go.mod h1:h6H6c8enJmmocHUbLiiGY6sx7f9i+X3m1CHdd5c6Rdw=
github.com/Azure/azure-sdk-for-go/sdk/internal v0.7.0 h1:v9p9TfTbf7AwNb5NYQt7hI41IfPoLFiFkLtb+bmGjT0=
github.com/Azure/azure-sdk-for-go/sdk/internal v0.7.0/go.mod h1:yqy467j36fJxcRV2TzfVZ1pCb5vxm4BtZPUdYWe/Xo8=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/dnaeon/go-vcr v1.2.0/go.mod h1:R4UdLID7HZT3taECzJs4YgbbH6PIGXB6W/sc5OLb6RQ=
github.com/modocache/gover v0.0.0-20171022184752-b58185e213c5/go.mod h1:caMODM3PzxT8aQXRPkAt8xlV/e7d7w8GM5g0fa5F0D8=
github.com/pkg/browser v0.0.0-20180916011732-0a3d74bf9ce4 h1:49lOXmGaUpV9Fz3gd7TFZY106KVlPVa5jcYD1gaQf98=
github.com/pkg/browser v0.0.0-20180916011732-0a3d74bf9ce4/go.mod h1:4OwLy04Bl9Ef3GJJCoec+30X3LQs/0/m4HFRt/2LUSA=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897 h1:pLI5jrR7OSLijeIDcmRxNmw2api+jEfxLoykJVice/E=
golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20201010224723-4f7140c49acb h1:mUVeFHoDKis5nxCAzoAi7E8Ghb86EXh/RK6wtvJIqRY=
golang.org/x/net v0.0.0-20201010224723-4f7140c49acb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/net v0.0.0-20201110031124-69a78807bb2b h1:uwuIcX0g4Yl1NC5XAz37xsr2lTtcqevgzYNVt49waME=
golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/net v0.0.0-20210610132358-84b48f89b13b h1:k+E048sYJHyVnsr1GDrRZWQ32D2C7lWs9JRc0bel53A=
golang.org/x/net v0.0.0-20210610132358-84b48f89b13b/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo=
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
8 changes: 6 additions & 2 deletions sdk/azidentity/interactive_browser_credential.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ type InteractiveBrowserCredentialOptions struct {
AuthorityHost string
// HTTPClient sets the transport for making HTTP requests
// Leave this as nil to use the default HTTP transport
HTTPClient azcore.Transport
HTTPClient azcore.Transporter
// Retry configures the built-in retry policy behavior
Retry azcore.RetryOptions
// Telemetry configures the built-in telemetry policy behavior
Expand Down Expand Up @@ -119,7 +119,11 @@ var authCodeReceiver = func(ctx context.Context, authorityHost string, opts *Int
func interactiveBrowserLogin(ctx context.Context, authorityHost string, opts *InteractiveBrowserCredentialOptions, scopes []string) (*interactiveConfig, error) {
// start local redirect server so login can call us back
rs := newServer()
state := uuid.New().String()
uuidRaw, err := uuid.New()
if err != nil {
return nil, err
}
state := uuidRaw.String()
redirectURL := opts.RedirectURL
if redirectURL == "" {
redirectURL = rs.Start(state, opts.Port)
Expand Down
7 changes: 6 additions & 1 deletion sdk/azidentity/jwt.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,13 @@ func createClientAssertionJWT(clientID string, audience string, cert *certConten
}
header := base64.RawURLEncoding.EncodeToString(headerJSON)

rawUuid, err := uuid.New()
if err != nil {
return "", err
}

payloadData := payloadJWT{
JTI: uuid.New().String(),
JTI: rawUuid.String(),
AUD: audience,
ISS: clientID,
SUB: clientID,
Expand Down
Loading

0 comments on commit ea571ad

Please sign in to comment.