Class AbstractOAuth2Token
- java.lang.Object
-
- org.springframework.security.oauth2.core.AbstractOAuth2Token
-
- All Implemented Interfaces:
java.io.Serializable
,OAuth2Token
- Direct Known Subclasses:
Jwt
,OAuth2AccessToken
,OAuth2RefreshToken
,OidcIdToken
public abstract class AbstractOAuth2Token extends java.lang.Object implements OAuth2Token, java.io.Serializable
Base class for OAuth 2.0 Token implementations.- Since:
- 5.0
- See Also:
OAuth2Token
,OAuth2AccessToken
,OAuth2RefreshToken
, Serialized Form
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractOAuth2Token(java.lang.String tokenValue)
Sub-class constructor.protected
AbstractOAuth2Token(java.lang.String tokenValue, java.time.Instant issuedAt, java.time.Instant expiresAt)
Sub-class constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object obj)
java.time.Instant
getExpiresAt()
Returns the expiration time on or after which the token MUST NOT be accepted.java.time.Instant
getIssuedAt()
Returns the time at which the token was issued.java.lang.String
getTokenValue()
Returns the token value.int
hashCode()
-
-
-
Constructor Detail
-
AbstractOAuth2Token
protected AbstractOAuth2Token(java.lang.String tokenValue)
Sub-class constructor.- Parameters:
tokenValue
- the token value
-
AbstractOAuth2Token
protected AbstractOAuth2Token(java.lang.String tokenValue, @Nullable java.time.Instant issuedAt, @Nullable java.time.Instant expiresAt)
Sub-class constructor.- Parameters:
tokenValue
- the token valueissuedAt
- the time at which the token was issued, may benull
expiresAt
- the expiration time on or after which the token MUST NOT be accepted, may benull
-
-
Method Detail
-
getTokenValue
public java.lang.String getTokenValue()
Returns the token value.- Specified by:
getTokenValue
in interfaceOAuth2Token
- Returns:
- the token value
-
getIssuedAt
@Nullable public java.time.Instant getIssuedAt()
Returns the time at which the token was issued.- Specified by:
getIssuedAt
in interfaceOAuth2Token
- Returns:
- the time the token was issued or
null
-
getExpiresAt
@Nullable public java.time.Instant getExpiresAt()
Returns the expiration time on or after which the token MUST NOT be accepted.- Specified by:
getExpiresAt
in interfaceOAuth2Token
- Returns:
- the token expiration time or
null
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
-