Package com.nimbusds.oauth2.sdk.id
Class State
java.lang.Object
com.nimbusds.oauth2.sdk.id.Identifier
com.nimbusds.oauth2.sdk.id.State
- All Implemented Interfaces:
Serializable
,Comparable<Identifier>
,net.minidev.json.JSONAware
Opaque value used to maintain state between a request and a callback. Also
serves as a protection against XSRF attacks, among other uses.
- See Also:
-
Field Summary
Fields inherited from class com.nimbusds.oauth2.sdk.id.Identifier
DEFAULT_BYTE_LENGTH, secureRandom
-
Constructor Summary
-
Method Summary
Methods inherited from class com.nimbusds.oauth2.sdk.id.Identifier
compareTo, getValue, hashCode, toJSONString, toString, toStringList
-
Constructor Details
-
State
Creates a new state with the specified value.- Parameters:
value
- The state value. Must not benull
or empty string.
-
State
Creates a new state with a randomly generated value of the specified byte length, Base64URL-encoded.- Parameters:
byteLength
- The byte length of the value to generate. Must be greater than one.
-
State
public State()Creates a new state with a randomly generated 256-bit (32-byte) value, Base64URL-encoded.
-
-
Method Details
-
equals
- Overrides:
equals
in classIdentifier
-
parse
Parses a state from the specified string.- Parameters:
s
- The string to parse,null
or empty if no state is specified.- Returns:
- The state,
null
if the parsed string wasnull
or empty.
-