Class TokenCredential
java.lang.Object
io.helidon.security.providers.common.TokenCredential
A public credential representing an access token.
Example is a Google access token you get when authenticating against Google's Open ID Connect.
-
Nested Class Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic TokenCredential.Builder
builder()
Get a builder for this class.static TokenCredential
Creates a new token credential for the specified token.Expiration time of the token.Issuer of the token.Issue time of the token.<U> Optional
<U> getTokenInstance
(Class<U> tokenClass) Get a token of a specific class.token()
The full token string as it was received from token service.toString()
-
Method Details
-
create
public static TokenCredential create(String token, String issuer, Instant issueTime, Instant expTime) Creates a new token credential for the specified token.- Parameters:
token
- Token value (as received from external client)issuer
- Issuer of the token (such as accounts.google.com) - optionalissueTime
- Time instant the token was issued - optionalexpTime
- Time instant the token will expire - optional- Returns:
- new instance of credential
-
builder
Get a builder for this class.- Returns:
- a new builder to build an instance
-
token
The full token string as it was received from token service.- Returns:
- token data as a string
-
getIssueTime
Issue time of the token.- Returns:
- issue time or empty if not available
-
getExpTime
Expiration time of the token.- Returns:
- expiration time or empty if not available
-
getIssuer
Issuer of the token.- Returns:
- issuer or empty if not available
-
getTokenInstance
Get a token of a specific class. By default the String.class is supported - and returns the token content. Other instances may be available from authentication provider (e.g. Jwt).- Type Parameters:
U
- type of the class- Parameters:
tokenClass
- class we want to get- Returns:
- instance of the token if present
-
toString
-