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
@Immutable public final class State extends Identifier
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:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class com.nimbusds.oauth2.sdk.id.Identifier
DEFAULT_BYTE_LENGTH, secureRandom
-
-
Constructor Summary
Constructors Constructor Description State()
Creates a new state with a randomly generated 256-bit (32-byte) value, Base64URL-encoded.State(int byteLength)
Creates a new state with a randomly generated value of the specified byte length, Base64URL-encoded.State(String value)
Creates a new state with the specified value.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object object)
static State
parse(String s)
Parses a state from the specified string.-
Methods inherited from class com.nimbusds.oauth2.sdk.id.Identifier
compareTo, getValue, hashCode, toJSONString, toString, toStringList
-
-
-
-
Constructor Detail
-
State
public State(String value)
Creates a new state with the specified value.- Parameters:
value
- The state value. Must not benull
or empty string.
-
State
public State(int byteLength)
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 Detail
-
equals
public boolean equals(Object object)
- Overrides:
equals
in classIdentifier
-
-