Class AuthenticationState
java.lang.Object
org.forgerock.caf.authentication.api.AuthenticationState
Maintains state information and provides to retrieve values in a type safe manner.
State values are represented with standard Java objects:String, Number,
Boolean, Map, List, Set and null.- Since:
- 2.0.0
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
AuthenticationState
public AuthenticationState()Creates a newAuthenticationStateinstance.
-
-
Method Details
-
add
Adds the specified value.
If adding to a list value, the specified key must be parseable as an unsigned base-10 integer and be less than or equal to the list size. Adding a value to a list shifts any existing elements at or above the specified index to the right by one.
- Parameters:
key- TheMapkey orListindex to add.object- The Java object to add.- Returns:
- This
AuthenticationState. - Throws:
AuthenticationStateException- If not aMapor theMapkey already exists.
-
isDefined
Returnstrueif thisAuthenticationStatecontains the specified item.- Parameters:
key- TheMapkey orListindex of the item to seek.- Returns:
trueif thisAuthenticationStatecontains the specified member.- Throws:
NullPointerException- Ifkeyisnull.
-
get
Returns the specified item value. If no such member value exists, then aAuthenticationStatecontainingnullis returned.- Parameters:
key- TheMapkey orListindex identifying the item to return.- Returns:
- a
AuthenticationStatecontaining the value ornull.
-
asBoolean
Returns theAuthenticationStateas aBooleanobject. If the value isnull, this method returnsnull.- Returns:
- The boolean value.
- Throws:
AuthenticationStateException- If the value is not a boolean type.
-
asInteger
Returns theAuthenticationStateas anIntegerobject. This may involve rounding or truncation. If the value isnull, this method returnsnull.- Returns:
- The integer value.
- Throws:
AuthenticationStateException- If the value is not a number.
-