com.nimbusds.oauth2.sdk.id
Class State

java.lang.Object
  extended by com.nimbusds.oauth2.sdk.id.Identifier
      extended by com.nimbusds.oauth2.sdk.id.State
All Implemented Interfaces:
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. This class is immutable.

Version:
$version$ (2013-01-15)
Author:
Vladimir Dzhuvinov

Constructor Summary
State()
          Creates a new state with a randomly generated value.
State(int length)
          Creates a new state with a randomly generated value of the specified length.
State(String value)
          Creates a new state with the specified value.
 
Method Summary
 boolean equals(Object object)
          Overrides Object.equals().
static State parse(String s)
          Parses a state from the specified string.
 
Methods inherited from class com.nimbusds.oauth2.sdk.id.Identifier
getValue, hashCode, toJSONString, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

State

public State(String value)
Creates a new state with the specified value.

Parameters:
value - The state value. Must not be null or empty string.

State

public State(int length)
Creates a new state with a randomly generated value of the specified length. The value will be made up of mixed-case alphanumeric ASCII characters.

Parameters:
length - The number of characters. Must be a positive integer.

State

public State()
Creates a new state with a randomly generated value. The value will be made up of 32 mixed-case alphanumeric ASCII characters.

Method Detail

equals

public boolean equals(Object object)
Description copied from class: Identifier
Overrides Object.equals().

Specified by:
equals in class Identifier
Parameters:
object - The object to compare to.
Returns:
true if the objects have the same value, otherwise false.

parse

public static State parse(String s)
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 was null or empty.


Copyright © 2013 NimbusDS. All Rights Reserved.