public class BasicOAuthBearerToken extends Object implements OAuthBearerToken
OAuthBearerToken that fairly straightforwardly stores the values given to its constructor (except the scope set which is copied to avoid modifications). Very little validation is applied here with respect to the validity of the given values. All validation is assumed to happen by users of this class.| Constructor and Description |
|---|
BasicOAuthBearerToken(String token, Set<String> scopes, long lifetimeMs, String principalName, Long startTimeMs)Creates a new OAuthBearerToken instance around the given values. |
| Modifier and Type | Method and Description |
|---|---|
long | lifetimeMs()The token's lifetime, expressed as the number of milliseconds since the epoch, as per RFC 6749 Section 1.4 |
String | principalName()The name of the principal to which this credential applies |
Set<String> | scope()The token's scope of access, as per RFC 6749 Section 1.4 |
Long | startTimeMs()When the credential became valid, in terms of the number of milliseconds since the epoch, if known, otherwise null. |
String | toString() |
String | value()The b64token value as defined in RFC 6750 Section 2.1 |
public BasicOAuthBearerToken(String token, Set<String> scopes, long lifetimeMs, String principalName, Long startTimeMs)
token - Value containing the compact serialization as a base 64 string that can be parsed, decoded, and validated as a well-formed JWS. Must be non-null, non-blank, and non-whitespace only.scopes - Set of non-null scopes. May contain case-sensitive "duplicates". The given set is copied and made unmodifiable so neither the caller of this constructor nor any downstream users can modify it.lifetimeMs - The token's lifetime, expressed as the number of milliseconds since the epoch. Must be non-negative.principalName - The name of the principal to which this credential applies. Must be non-null, non-blank, and non-whitespace only.startTimeMs - The token's start time, expressed as the number of milliseconds since the epoch, if available, otherwise null. Must be non-negative if a non-null value is provided.public String value()
b64token value as defined in RFC 6750 Section 2.1value in interface OAuthBearerTokenb64token value as defined in RFC 6750 Section 2.1public Set<String> scope()
scope in interface OAuthBearerTokenpublic long lifetimeMs()
lifetimeMs in interface OAuthBearerTokenpublic String principalName()
principalName in interface OAuthBearerTokenpublic Long startTimeMs()
startTimeMs in interface OAuthBearerToken