Class JpaRefreshToken2
java.lang.Object
com.broadleafcommerce.auth.token.provider.jpa.domain.JpaRefreshToken2
- All Implemented Interfaces:
RefreshToken
,Serializable
JPA Shard partition for recording a refresh token assignment
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
boolean
The primary key value of the first refresh token assigned in the current inheritance line.The maximum lifespan of a refresh token.getId()
The primary key of the refresh token.Refresh token rotation allows for a configurable window of time in which a refresh token may be used multiple times without failure.int
hashCode()
boolean
Whether or not this refresh token instance has been used as part of a refresh attemptvoid
setAncestor
(String ancestor) void
setExpiration
(Long expiration) void
void
setRotated
(boolean isRotated) void
setRotationExpiration
(Long rotationExpiration) toString()
-
Constructor Details
-
JpaRefreshToken2
public JpaRefreshToken2()
-
-
Method Details
-
getId
Description copied from interface:RefreshToken
The primary key of the refresh token. Aligns with theJTI
param in the refresh token JWT. Note, for a rotatable token, the JTI is two-part. The first segment is the partition identifier (e.g. seeJpaRefreshToken1
as an integer. The second segment is the id captured in this field.- Specified by:
getId
in interfaceRefreshToken
- Returns:
- The primary key of the refresh token
-
getAncestor
Description copied from interface:RefreshToken
The primary key value of the first refresh token assigned in the current inheritance line. Every time a refresh token is used to get a new access token, the rotated refresh token returned in the access token / refresh token pair will reference the original refresh token used at the beginning. Any attempt to re-use a refresh token outside of theRefreshToken.setRotationExpiration(Long)
timeline will result in immediate revocation of the entire inheritance line of refresh tokens.- Specified by:
getAncestor
in interfaceRefreshToken
- Returns:
- The primary key value of the first refresh token assigned in the current inheritance line
-
isRotated
public boolean isRotated()Description copied from interface:RefreshToken
Whether or not this refresh token instance has been used as part of a refresh attempt- Specified by:
isRotated
in interfaceRefreshToken
- Returns:
- Whether or not this refresh token instance has been used as part of a refresh attempt
-
getRotationExpiration
Description copied from interface:RefreshToken
Refresh token rotation allows for a configurable window of time in which a refresh token may be used multiple times without failure. Once this point in time is exceeded, the security response detailed inRefreshToken.getAncestor()
is triggered. This window is designed to allow for system irregularities like network latency or outage in which an application may be forced to quickly retry a rotation. Represented as milliseconds after epoch.JpaAuthorizedClient.getRefreshTokenRotationIntervalSeconds()
and the system harvests from there and converts to millis based on the current client being used in the oauth flow.- Specified by:
getRotationExpiration
in interfaceRefreshToken
- Returns:
- The configurable window of time in which a refresh token may be used multiple times without failure
-
getExpiration
Description copied from interface:RefreshToken
The maximum lifespan of a refresh token. Any attempt (even valid) to use this refresh token after this point in time will result in an invalid security response. Represented as milliseconds after epoch.JpaAuthorizedClient.getRefreshTokenTimeoutSeconds()
and the system harvest from there and converts to millis based on the current client being used in the oauth flow.- Specified by:
getExpiration
in interfaceRefreshToken
- Returns:
- The maximum lifespan of a refresh token
-
setId
- Specified by:
setId
in interfaceRefreshToken
- See Also:
-
setAncestor
- Specified by:
setAncestor
in interfaceRefreshToken
- See Also:
-
setRotated
public void setRotated(boolean isRotated) - Specified by:
setRotated
in interfaceRefreshToken
- See Also:
-
setRotationExpiration
- Specified by:
setRotationExpiration
in interfaceRefreshToken
- See Also:
-
setExpiration
- Specified by:
setExpiration
in interfaceRefreshToken
- See Also:
-
toString
-
equals
-
canEqual
-
hashCode
public int hashCode()
-