Skip to content

Commit

Permalink
auth: documentation and cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
manicminer committed Sep 27, 2023
1 parent 60af3f3 commit 814e1ea
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions sdk/auth/token.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ import (
"github.com/hashicorp/go-azure-sdk/sdk/claims"
)

// SetAuthHeaders decorates a *http.Request with necessary authorization headers for Azure APIs. For more information about the vendor-specific
// `x-ms-authorization-auxiliary` header, see https://learn.microsoft.com/en-us/azure/azure-resource-manager/management/authenticate-multi-tenant
func SetAuthHeaders(ctx context.Context, req *http.Request, authorizer Authorizer) error {
if req == nil {
return fmt.Errorf("request was nil")
Expand Down Expand Up @@ -49,10 +51,6 @@ func SetAuthHeaders(ctx context.Context, req *http.Request, authorizer Authorize

const tokenExpiryDelta = 20 * time.Minute

func ForceExpiry(token *oauth2.Token) error {
return nil
}

// tokenExpiresSoon returns true if the token expires within 10 minutes, or if more than 50% of its validity period has elapsed (if this can be determined), whichever is later
func tokenDueForRenewal(token *oauth2.Token) bool {
if token == nil {
Expand Down

0 comments on commit 814e1ea

Please sign in to comment.