forked from Azure/azure-sdk-for-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add configuration for refresh token before expiry (Azure#8715)
* Add configuration for refresh token before expiry * Fix test utils in identity * Address feedback * Builder style setter * Add tests and address feedback
- Loading branch information
1 parent
4c53746
commit d408073
Showing
8 changed files
with
219 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
...dentity/azure-identity/src/main/java/com/azure/identity/implementation/IdentityToken.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
package com.azure.identity.implementation; | ||
|
||
import com.azure.core.credential.AccessToken; | ||
|
||
import java.time.OffsetDateTime; | ||
|
||
/** | ||
* Type representing authentication result from the azure-identity client. | ||
*/ | ||
public class IdentityToken extends AccessToken { | ||
/** | ||
* Creates an identity token instance. | ||
* | ||
* @param token the token string. | ||
* @param expiresAt the expiration time. | ||
* @param options the identity client options. | ||
*/ | ||
public IdentityToken(String token, OffsetDateTime expiresAt, IdentityClientOptions options) { | ||
super(token, expiresAt.plusMinutes(2).minus(options.getTokenRefreshOffset())); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.