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
-
Method Summary
-
Constructor Details
-
AuthenticationState
public AuthenticationState()Creates a newAuthenticationState
instance.
-
-
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
- TheMap
key orList
index to add.object
- The Java object to add.- Returns:
- This
AuthenticationState
. - Throws:
AuthenticationStateException
- If not aMap
or theMap
key already exists.
-
isDefined
Returnstrue
if thisAuthenticationState
contains the specified item.- Parameters:
key
- TheMap
key orList
index of the item to seek.- Returns:
true
if thisAuthenticationState
contains the specified member.- Throws:
NullPointerException
- Ifkey
isnull
.
-
get
Returns the specified item value. If no such member value exists, then aAuthenticationState
containingnull
is returned.- Parameters:
key
- TheMap
key orList
index identifying the item to return.- Returns:
- a
AuthenticationState
containing the value ornull
.
-
asBoolean
Returns theAuthenticationState
as aBoolean
object. If the value isnull
, this method returnsnull
.- Returns:
- The boolean value.
- Throws:
AuthenticationStateException
- If the value is not a boolean type.
-
asInteger
Returns theAuthenticationState
as anInteger
object. 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.
-