Package org.forgerock.oauth2.core
Class DeviceCode
- java.lang.Object
-
- org.forgerock.json.JsonValue
-
- org.forgerock.oauth2.core.DeviceCode
-
-
Constructor Summary
Constructors Constructor Description DeviceCode(String deviceCode, String userCode, String resourceOwnerId, String clientId, String nonce, String responseType, String state, String acrValues, String prompt, String uiLocales, String loginHint, Integer maxAge, String claims, long expiryTime, Set<String> scope, String realm, String codeChallenge, String codeChallengeMethod, String auditTrackingId)
DeviceCode(org.forgerock.json.JsonValue token)
Constructs a new OpenAMAuthorizationCode backed with the data in the specified JsonValue.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getAcrValues()
Gets the ACR Values parameter.String
getAuditTrackingId()
Get the audit tracking ID for this token.AuditConstants.TrackingIdKey
getAuditTrackingIdKey()
Get the audit tracking ID key for this token.String
getClaims()
Returns the requested claims.String
getClientId()
Gets the Client ID parameter.String
getCodeChallenge()
Gets the Code Challenge parameter.String
getCodeChallengeMethod()
Gets the Code Challenge Method parameter.String
getDeviceCode()
Gets the Device Code - this is also theToken ID
.long
getExpiryTime()
Gets the expiry time of this device code.long
getLastPollTime()
Gets the time that this device code was last polled by the device.String
getLoginHint()
Gets the login hint parameter.Integer
getMaxAge()
Gets the max age parameter.String
getNonce()
Gets the Nonce parameter.String
getPrompt()
Gets the prompt parameter.String
getRealm()
Gets the realm.String
getResourceOwnerId()
Gets the Resource Owner ID parameter.String
getResponseType()
Gets the response type parameter.Set<String>
getScope()
Gets the set of scopes requested.String
getState()
Gets the state parameter.protected String
getStringProperty(String key)
String
getTokenId()
Gets the token's identifier.Map<String,Object>
getTokenInfo()
Gets the token's information.String
getTokenName()
Gets the token's name.String
getUiLocales()
Gets the UI Locales parameter.String
getUserCode()
Gets the User Code.boolean
isAuthorized()
boolean
isIssued()
Whether this device code has been issued.void
poll()
Updates the last poll time of this device code.void
setAuthorized(boolean authorized)
void
setResourceOwnerId(String resourceOwnerId)
Sets the Resource Owner ID parameter.org.forgerock.json.JsonValue
toJsonValue()
Gets theJsonValue
representation of the token.Map<String,Object>
toMap()
Converts the token into aMap
of its key data.-
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, toString
-
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Constructor Detail
-
DeviceCode
public DeviceCode(org.forgerock.json.JsonValue token) throws InvalidGrantException
Constructs a new OpenAMAuthorizationCode backed with the data in the specified JsonValue.- Parameters:
token
- The JsonValue of the token.- Throws:
InvalidGrantException
- If the given token is not an Authorization Code token.
-
DeviceCode
public DeviceCode(String deviceCode, String userCode, String resourceOwnerId, String clientId, String nonce, String responseType, String state, String acrValues, String prompt, String uiLocales, String loginHint, Integer maxAge, String claims, long expiryTime, Set<String> scope, String realm, String codeChallenge, String codeChallengeMethod, String auditTrackingId)
-
-
Method Detail
-
getDeviceCode
public String getDeviceCode()
Gets the Device Code - this is also theToken ID
.- Returns:
- The device code.
-
getUserCode
public String getUserCode()
Gets the User Code.- Returns:
- The user code.
-
getResourceOwnerId
public String getResourceOwnerId()
Gets the Resource Owner ID parameter.- Returns:
- The Resource Owner ID.
-
setResourceOwnerId
public void setResourceOwnerId(String resourceOwnerId)
Sets the Resource Owner ID parameter.- Parameters:
resourceOwnerId
- The Resource Owner ID.
-
getClientId
public String getClientId()
Gets the Client ID parameter.- Returns:
- The Client ID.
-
getNonce
public String getNonce()
Gets the Nonce parameter.- Returns:
- The nonce.
-
getAcrValues
public String getAcrValues()
Gets the ACR Values parameter.- Returns:
- The ACR Values String.
-
getCodeChallengeMethod
public String getCodeChallengeMethod()
Gets the Code Challenge Method parameter.- Returns:
- The code challenge method.
-
getCodeChallenge
public String getCodeChallenge()
Gets the Code Challenge parameter.- Returns:
- The code challenge.
-
getMaxAge
public Integer getMaxAge()
Gets the max age parameter.- Returns:
- The max age.
-
getLoginHint
public String getLoginHint()
Gets the login hint parameter.- Returns:
- The login hint.
-
getUiLocales
public String getUiLocales()
Gets the UI Locales parameter.- Returns:
- The ui locales.
-
getPrompt
public String getPrompt()
Gets the prompt parameter.- Returns:
- The prompt.
-
getState
public String getState()
Gets the state parameter.- Returns:
- The state.
-
getResponseType
public String getResponseType()
Gets the response type parameter.- Returns:
- The response type.
-
getClaims
public String getClaims()
Returns the requested claims.- Returns:
- The requested claims.
-
poll
public void poll()
Updates the last poll time of this device code.
-
getLastPollTime
public long getLastPollTime()
Gets the time that this device code was last polled by the device.- Returns:
- The last poll time in milliseconds.
-
getRealm
public String getRealm()
Gets the realm.- Returns:
- The realm.
-
getTokenId
public String getTokenId()
Description copied from interface:Token
Gets the token's identifier.- Specified by:
getTokenId
in interfaceToken
- Returns:
- The token's id.
-
getAuditTrackingId
public String getAuditTrackingId()
Description copied from interface:Token
Get the audit tracking ID for this token.- Specified by:
getAuditTrackingId
in interfaceToken
- Returns:
- The tracking ID.
-
getAuditTrackingIdKey
public AuditConstants.TrackingIdKey getAuditTrackingIdKey()
Description copied from interface:Token
Get the audit tracking ID key for this token.- Specified by:
getAuditTrackingIdKey
in interfaceToken
- Returns:
- The tracking ID key.
-
getTokenName
public String getTokenName()
Description copied from interface:Token
Gets the token's name.- Specified by:
getTokenName
in interfaceToken
- Returns:
- The token's name.
-
getExpiryTime
public long getExpiryTime()
Gets the expiry time of this device code.- Returns:
- The expiry time (ms since epoch).
-
isIssued
public boolean isIssued()
Whether this device code has been issued.
-
toMap
public Map<String,Object> toMap() throws ServerException
Description copied from interface:Token
Converts the token into aMap
of its key data.- Specified by:
toMap
in interfaceToken
- Returns:
- A
Map
of the token's key data. - Throws:
ServerException
- If any internal server error occurs.
-
getTokenInfo
public Map<String,Object> getTokenInfo()
Description copied from interface:Token
Gets the token's information.- Specified by:
getTokenInfo
in interfaceToken
- Returns:
- A
Map
of the token's information.
-
setAuthorized
public void setAuthorized(boolean authorized)
-
isAuthorized
public boolean isAuthorized()
-
toJsonValue
public org.forgerock.json.JsonValue toJsonValue()
Gets theJsonValue
representation of the token.- Specified by:
toJsonValue
in interfaceToken
- Returns:
- The
JsonValue
representation of the token.
-
-