Package org.forgerock.oauth2.core
Class StatefulRefreshToken
- java.lang.Object
-
- org.forgerock.json.JsonValue
-
- org.forgerock.oauth2.core.StatefulToken
-
- org.forgerock.oauth2.core.StatefulRefreshToken
-
- All Implemented Interfaces:
Cloneable,Iterable<org.forgerock.json.JsonValue>,IntrospectableToken,RefreshToken,Token
public class StatefulRefreshToken extends StatefulToken implements RefreshToken
Models a OAuth2 Refresh Token.- Since:
- 12.0.0
-
-
Constructor Summary
Constructors Constructor Description StatefulRefreshToken(String id, String resourceOwnerId, String clientId, String redirectUri, Set<String> scope, long expiryTime, String tokenType, String tokenName, String grantType, String realm, String authModules, String acr, String auditId, String authGrantId)Constructs a new RefreshToken.StatefulRefreshToken(String id, String resourceOwnerId, String clientId, String redirectUri, Set<String> scope, long expiryTime, String tokenType, String tokenName, String grantType, String realm, String authModules, String acr, String auditId, String authGrantId, long authTime)Constructs a new RefreshToken.StatefulRefreshToken(org.forgerock.json.JsonValue token)Constructs a new RefreshToken backed with the data in the specified JsonValue.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected longdefaultExpireTime()StringgetAuditTrackingId()Gets the audit id.AuditConstants.TrackingIdKeygetAuditTrackingIdKey()Get the audit tracking ID key for this token.StringgetAuthenticationContextClassReference()Get the Authentication Context Class Reference (acr).StringgetAuthGrantId()Gets the token's Auth Grant id.StringgetAuthModules()Gets the auth modules used for authentication.longgetAuthTimeSeconds()Gets the end user's authentication time in seconds.StringgetClaims()Gets the requested claims.longgetExpiryTime()Gets the token's expiry time.StringgetRealm()Gets the realm.StringgetRedirectUri()Gets the client's redirect uri.protected StringgetResourceString(String s)Gets the display String for the given String.Set<String>getScope()Gets the scope.protected LonggetTimeLeft()Map<String,Object>getTokenInfo()Gets the token's information.booleanisExpired()Determines if the Refresh Token has expired.protected voidsetAuditTrackingId(String auditId)Sets the audit id.protected voidsetAuthenticationContextClassReference(String acr)Sets the authentication context class reference (acr).protected voidsetAuthModules(String authModules)Sets the auth modules used for authentication.protected voidsetAuthTime(long authTime)Sets the end user's original authentication time in seconds since epoch.voidsetClaims(String claims)Sets the requested claims.protected voidsetExpiryTime(long expiryTime)Sets the expiry time.protected voidsetScope(Set<String> scope)Sets the scope.Map<String,Object>toMap()Converts the token into aMapof its key data.StringtoString()-
Methods inherited from class org.forgerock.oauth2.core.StatefulToken
getClientId, getResourceOwnerId, getSetProperty, getStringProperty, getTokenId, getTokenName, getTokenType, setAuthGrantId, setClientId, setGrantType, setId, setRedirectUri, setResourceOwnerId, setStringProperty, setTokenName, setTokenType, toJsonValue
-
Methods inherited from class org.forgerock.json.JsonValue
add, add, add, add, addPermissive, array, as, asBigDecimal, asBoolean, asCollection, asCollection, asDouble, asEnum, asInteger, asList, asList, asLong, asMap, asMap, asMapOfList, asNumber, asSet, asSet, asString, asURI, clear, clone, contains, copy, defaultTo, diff, expect, field, fieldIfNotNull, get, get, get, getObject, getPointer, isBoolean, isCollection, isDefined, isEqualTo, isList, isMap, isNotNull, isNull, isNumber, isSet, isString, iterator, json, keys, object, object, patch, put, put, put, putPermissive, remove, remove, remove, required, set, setObject, size, toIndex
-
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.forgerock.oauth2.core.IntrospectableToken
getClientId, getResourceOwnerId
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Methods inherited from interface org.forgerock.oauth2.core.RefreshToken
getTokenId, getTokenType
-
Methods inherited from interface org.forgerock.oauth2.core.Token
getTokenName, toJsonValue
-
-
-
-
Constructor Detail
-
StatefulRefreshToken
public StatefulRefreshToken(org.forgerock.json.JsonValue token) throws InvalidGrantExceptionConstructs a new RefreshToken backed with the data in the specified JsonValue.- Parameters:
token- The JsonValue of the token.- Throws:
InvalidGrantException- If the given token is not a Refresh Token.
-
StatefulRefreshToken
public StatefulRefreshToken(String id, String resourceOwnerId, String clientId, String redirectUri, Set<String> scope, long expiryTime, String tokenType, String tokenName, String grantType, String realm, String authModules, String acr, String auditId, String authGrantId)
Constructs a new RefreshToken.- Parameters:
id- The token id.resourceOwnerId- The resource owner's id.clientId- The client's id.redirectUri- The redirect uri.scope- The scope.expiryTime- The expiry time.tokenType- The token type.tokenName- The token name.grantType- The grant type.realm- The realm.authModules- The pipe-separated list of auth modules.acr- The authentication context.auditId- The audit id, used for tracking tokens throughout the audit logs.authGrantId- The authorization grant id.
-
StatefulRefreshToken
public StatefulRefreshToken(String id, String resourceOwnerId, String clientId, String redirectUri, Set<String> scope, long expiryTime, String tokenType, String tokenName, String grantType, String realm, String authModules, String acr, String auditId, String authGrantId, long authTime)
Constructs a new RefreshToken.- Parameters:
id- The token id.resourceOwnerId- The resource owner's id.clientId- The client's id.redirectUri- The redirect uri.scope- The scope.expiryTime- The expiry time.tokenType- The token type.tokenName- The token name.grantType- The grant type.realm- The realm.authModules- The pipe-separated list of auth modules.acr- The authentication context.auditId- The audit id, used for tracking tokens throughout the audit logs.authGrantId- The authorization grant id.authTime- The end user's original auth time in seconds.
-
-
Method Detail
-
setClaims
public void setClaims(String claims)
Sets the requested claims.- Parameters:
claims- Requested claims
-
getClaims
public String getClaims()
Gets the requested claims.- Specified by:
getClaimsin interfaceRefreshToken- Overrides:
getClaimsin classStatefulToken- Returns:
- The claims.
-
setScope
protected void setScope(Set<String> scope)
Sets the scope.- Overrides:
setScopein classStatefulToken- Parameters:
scope- The scope.
-
setExpiryTime
protected void setExpiryTime(long expiryTime)
Sets the expiry time.- Overrides:
setExpiryTimein classStatefulToken- Parameters:
expiryTime- The expiry time.
-
getRealm
public String getRealm()
Gets the realm.- Specified by:
getRealmin interfaceIntrospectableToken- Overrides:
getRealmin classStatefulToken- Returns:
- The token's realm.
-
getResourceString
protected String getResourceString(String s)
Gets the display String for the given String.- Overrides:
getResourceStringin classStatefulToken- Parameters:
s- The String.- Returns:
- The display String.
-
getScope
public Set<String> getScope()
Gets the scope.- Specified by:
getScopein interfaceIntrospectableToken- Overrides:
getScopein classStatefulToken- Returns:
- The scope.
-
getExpiryTime
public long getExpiryTime()
Gets the token's expiry time.- Specified by:
getExpiryTimein interfaceIntrospectableToken- Overrides:
getExpiryTimein classStatefulToken- Returns:
- The token's expiry time.
-
setAuthModules
protected void setAuthModules(String authModules)
Sets the auth modules used for authentication.- Parameters:
authModules- A pipe-delimited string of auth module names.
-
setAuthenticationContextClassReference
protected void setAuthenticationContextClassReference(String acr)
Sets the authentication context class reference (acr).- Parameters:
acr- The acr.
-
getRedirectUri
public String getRedirectUri()
Gets the client's redirect uri.- Specified by:
getRedirectUriin interfaceRefreshToken- Returns:
- The client's redirect uri.
-
getAuthenticationContextClassReference
public String getAuthenticationContextClassReference()
Get the Authentication Context Class Reference (acr).- Specified by:
getAuthenticationContextClassReferencein interfaceRefreshToken- Returns:
- The acr string matched, if any.
-
isExpired
public boolean isExpired()
Determines if the Refresh Token has expired.- Specified by:
isExpiredin interfaceIntrospectableToken- Overrides:
isExpiredin classStatefulToken- Returns:
trueif current time is greater than the expiry time.
-
defaultExpireTime
protected long defaultExpireTime()
- Specified by:
defaultExpireTimein classStatefulToken
-
getAuthModules
public String getAuthModules()
Gets the auth modules used for authentication.- Specified by:
getAuthModulesin interfaceRefreshToken- Returns:
- A pipe-delimited string of auth module names.
-
toMap
public Map<String,Object> toMap()
Description copied from interface:TokenConverts the token into aMapof its key data.- Specified by:
toMapin interfaceRefreshToken- Specified by:
toMapin interfaceToken- Returns:
- A
Mapof the token's key data.
-
getTokenInfo
public Map<String,Object> getTokenInfo()
Description copied from interface:TokenGets the token's information.- Specified by:
getTokenInfoin interfaceToken- Returns:
- A
Mapof the token's information.
-
getAuditTrackingIdKey
public AuditConstants.TrackingIdKey getAuditTrackingIdKey()
Description copied from interface:TokenGet the audit tracking ID key for this token.- Specified by:
getAuditTrackingIdKeyin interfaceToken- Returns:
- The tracking ID key.
-
getAuthGrantId
public String getAuthGrantId()
Description copied from interface:RefreshTokenGets the token's Auth Grant id.- Specified by:
getAuthGrantIdin interfaceRefreshToken- Returns:
- The token's Auth Grant id.
-
getTimeLeft
protected Long getTimeLeft()
- Overrides:
getTimeLeftin classStatefulToken
-
setAuditTrackingId
protected void setAuditTrackingId(String auditId)
Sets the audit id.- Parameters:
auditId- The audit id.
-
getAuditTrackingId
public String getAuditTrackingId()
Gets the audit id.- Specified by:
getAuditTrackingIdin interfaceRefreshToken- Specified by:
getAuditTrackingIdin interfaceToken- Overrides:
getAuditTrackingIdin classStatefulToken- Returns:
- The audit id.
-
setAuthTime
protected void setAuthTime(long authTime)
Sets the end user's original authentication time in seconds since epoch.- Overrides:
setAuthTimein classStatefulToken- Parameters:
authTime- The authentication time.
-
getAuthTimeSeconds
public long getAuthTimeSeconds()
Gets the end user's authentication time in seconds.- Specified by:
getAuthTimeSecondsin interfaceIntrospectableToken- Overrides:
getAuthTimeSecondsin classStatefulToken- Returns:
- The authentication time.
-
toString
public String toString()
- Overrides:
toStringin classorg.forgerock.json.JsonValue
-
-