Package net.shibboleth.sp.state
Class StateData
java.lang.Object
net.shibboleth.sp.state.StateData
A DTO class that carries protocol state information that needs to be recovered to validate a protocol
response; this class is designed for JSON serialization and deserialization for storage e.g. in a cookie
or database.
This class is designed to be extended to support non-generic protocol state as required.
The resource URL is typed internally as String and is opaque to this class so as to support any character encoding necessary without assuming UTF-8. Callers should take care to encode the URL as required (e.g., even base64 encoding is acceptable), or use the method suitable for operating to and from byte array to allow the class to address it.
-
Field Summary
FieldsModifier and TypeFieldDescriptionList of authentication context class references requested in the authentication request.private StringThe expected issuer of the authentication response.private StringThe client's address for optional enforcement.private StringThe identifier of the party that is making a request, i.e., us.private BooleanSet when request is passive.private InstantThe time at which a request was issued.private StringA resource location associated with the request.private StringThe location to which a response is expected. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected static byte[]Decode URL-encoded data using ISO-8859-1 to guarantee a single byte encoding.protected static Stringencode(byte[] bytes) A simple encoder for non-ASCII characters.booleangetAcrs()Get the mutable list of authentication context classes requested.Get the expected issuer of a response to the message.Get the IP address of the client associated with the state.Get the identifier of the party that is making the request, i.e., us.Get the passive request indicator.byte[]Get the resource location associated with the request in a raw form.Get the time at which the request was issued.Get the resource location associated with the request.Get the location to which the response is expected to be sent.inthashCode()private static inthexchar(int b) Converts a byte into a hex character.protected static StringA method to mask all but the last 2 characters of a string value for logging purposes.Set the authentication context classes requested.setAuthenticationAuthority(String authority) Set the expected issuer of a response to the message.setClientAddress(String address) Set the identifier of the client that is making the authentication request.Set the identifier of the party that is making the request, i.e., us.setPassive(Boolean flag) Set the passive request indicator.setRawResource(byte[] loc) Set the resource location associated with the request in a raw form.setRequestTime(Instant time) Set the time at which the request was issued.setResource(String loc) Set the resource location associated with the request.Set the location to which the response is expected to be sent.toString()
-
Field Details
-
clientAddress
The client's address for optional enforcement. -
issuer
The identifier of the party that is making a request, i.e., us. -
authenticatingAuthority
The expected issuer of the authentication response. -
passive
Set when request is passive. -
requestTime
The time at which a request was issued. -
acrs
List of authentication context class references requested in the authentication request. -
responseLocation
The location to which a response is expected. -
resource
A resource location associated with the request.
-
-
Constructor Details
-
StateData
public StateData()Constructor.
-
-
Method Details
-
getClientAddress
Get the IP address of the client associated with the state.Can be used to optionally enforce the address when recovering the state.
- Returns:
- the client's address
-
setClientAddress
Set the identifier of the client that is making the authentication request. Can be used to ensure the audience of the response matches the client that made the request.- Parameters:
address- client address- Returns:
- the updated object
-
getIssuer
Get the identifier of the party that is making the request, i.e., us.Can be used to ensure the audience of the response matches the client that made the request.
- Returns:
- the issuer
-
setIssuer
Set the identifier of the party that is making the request, i.e., us.- Parameters:
id- the issuer to set- Returns:
- the updated object
-
getAuthenticationAuthority
Get the expected issuer of a response to the message.- Returns:
- the authentication authority
-
setAuthenticationAuthority
Set the expected issuer of a response to the message.- Parameters:
authority- the authentication authority to set- Returns:
- the updated object
-
getPassive
Get the passive request indicator.- Returns:
- passive indicator
-
setPassive
Set the passive request indicator.- Parameters:
flag- indicator- Returns:
- the updated object
-
getRequestTime
Get the time at which the request was issued.- Returns:
- the time the request was issued
-
setRequestTime
Set the time at which the request was issued.- Parameters:
time- the time the request was issued- Returns:
- the updated object
-
getAcrs
Get the mutable list of authentication context classes requested.- Returns:
- the context classes
-
setAcrs
Set the authentication context classes requested.- Parameters:
refs- context class references- Returns:
- the updated object
-
getResponseLocation
Get the location to which the response is expected to be sent.- Returns:
- the expected response location
-
setResponseLocation
Set the location to which the response is expected to be sent.- Parameters:
loc- the location- Returns:
- the updated object
-
getResource
Get the resource location associated with the request.- Returns:
- the resource location
-
setResource
Set the resource location associated with the request.- Parameters:
loc- the location- Returns:
- the updated object
-
getRawResource
@Nullable public byte[] getRawResource()Get the resource location associated with the request in a raw form.The value retrieved must have previously been set via the
setRawResource(byte[])method.- Returns:
- resource as a byte array
-
setRawResource
Set the resource location associated with the request in a raw form.- Parameters:
loc- the location- Returns:
- the updated object
-
hashCode
public int hashCode() -
equals
-
toString
-
mask
A method to mask all but the last 2 characters of a string value for logging purposes.- Parameters:
value- the string value to mask- Returns:
- the masked string
-
encode
A simple encoder for non-ASCII characters.- Parameters:
bytes- bytes to encode- Returns:
- the encoded string
-
decode
Decode URL-encoded data using ISO-8859-1 to guarantee a single byte encoding.- Parameters:
s- input string- Returns:
- ISO-8859-1 byte string
-
hexchar
private static int hexchar(int b) Converts a byte into a hex character.- Parameters:
b- input byte- Returns:
- the hex character equivalent (capitalized)
-