Skip to content

Commit

Permalink
Rename expiry delta to tokenExpiryDelta
Browse files Browse the repository at this point in the history
Signed-off-by: Sai Sankar Gochhayat <saisankargochhayat@gmail.com>
  • Loading branch information
saisankargochhayat committed Dec 2, 2024
1 parent 9888d0e commit 01e7808
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions auth/providers/azure/graph/graph.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ var (
)

const (
expiryDelta = 300 * time.Second
tokenExpiryDelta = 300 * time.Second
getMemberGroupsTimeout = 23 * time.Second
getterName = "ms-graph"
arcAuthMode = "arc"
Expand Down Expand Up @@ -332,7 +332,7 @@ func (u *UserInfo) RefreshToken(ctx context.Context, token string) error {
u.headers.Set("Authorization", fmt.Sprintf("Bearer %s", resp.Token))
// Use ExpiresOn to set the expiration time
expOn := time.Unix(int64(resp.ExpiresOn), 0)
u.expires = expOn.Add(-expiryDelta)
u.expires = expOn.Add(-tokenExpiryDelta)
klog.Infof("Token refreshed successfully at %s. Expire at set to: %s", time.Now(), u.expires)
}

Expand Down
4 changes: 2 additions & 2 deletions authz/providers/azure/rbac/rbac.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ const (
checkAccessPath = "/providers/Microsoft.Authorization/checkaccess"
checkAccessAPIVersion = "2018-09-01-preview"
remainingSubReadARMHeader = "x-ms-ratelimit-remaining-subscription-reads"
expiryDelta = 60 * time.Second
tokenExpiryDelta = 300 * time.Second
checkaccessContextTimeout = 23 * time.Second
correlationRequestIDHeader = "x-ms-correlation-request-id"
)
Expand Down Expand Up @@ -227,7 +227,7 @@ func (a *AccessInfo) RefreshToken(ctx context.Context) error {

// Use ExpiresOn to set the expiration time
expOn := time.Unix(int64(resp.ExpiresOn), 0)
a.expiresAt = expOn.Add(-expiryDelta)
a.expiresAt = expOn.Add(-tokenExpiryDelta)
klog.Infof("Token refreshed successfully at %s. Expire at set to: %s", time.Now(), a.expiresAt)
}

Expand Down

0 comments on commit 01e7808

Please sign in to comment.