Class AbstractIdPSession
- All Implemented Interfaces:
IdPSession,Component,IdentifiedComponent
- Direct Known Subclasses:
StorageBackedIdPSession
IdPSession, handles basic management of the
instance data without addressing persistence.
Data that can change post-construction can be modified using doSet/doAdd/doRemove methods that maintain the object state. Abstract methods defined here or left unimplemented from the interface should be implemented to call these methods and perform any additional work required to maintain the coherence of the underlying store, if any.
The checkAddress(String) method is implemented by calling into other abstract and defined
methods to check session state and update address information as required.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumAddress syntaxes supported for address binding. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final ConcurrentMap<String,Optional<AuthenticationResult>> Tracks authentication results that have occurred during this session.private final InstantTime when this session was created.private final StringUnique ID of this session.private StringAn IPv4 address to which the session is bound.private StringAn IPv6 address to which the session is bound.private InstantLast activity instant for this session.private final org.slf4j.LoggerClass logger.private final StringA canonical name for the subject of the session.private final ConcurrentMap<String,Optional<SPSession>> Tracks services which have been issued authentication tokens during this session.private StringAn "unknown" address to which the session is bound.Fields inherited from interface net.shibboleth.idp.session.IdPSession
MDC_ATTRIBUTE -
Constructor Summary
ConstructorsConstructorDescriptionAbstractIdPSession(String sessionId, String canonicalName, Instant creationTime) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionAdd a newAuthenticationResultto this IdP session, replacing any existing result of the same flow ID.addSPSession(SPSession spSession) Add a new SP session to this IdP session, replacing any existing session for the same service.voidbindToAddress(String address) Associate an address with this session.booleancheckAddress(String address) Test the session's validity based on the supplied client address, possibly binding it to the session if appropriate.booleanTest the session's validity based on inactivity, while updating the last activity time.Add a newAuthenticationResultto this IdP session, replacing any existing result of the same flow ID.doAddSPSession(SPSession spSession) Add a new SP session to this IdP session, replacing any existing session for the same service.voiddoBindToAddress(String address) Associate an address with this session.booleanDisassociate anAuthenticationResultfrom this IdP session.booleandoRemoveSPSession(SPSession spSession) Disassociate the given SP session from this IdP session.voiddoSetLastActivityInstant(Instant instant) Set the last activity instant for the session.booleanGet an address to which this session is bound.protected static AbstractIdPSession.AddressFamilygetAddressFamily(String address) Returns the address family for an input address.getAuthenticationResult(String flowId) Get an associatedAuthenticationResultgiven its flow ID.protected Map<String,Optional<AuthenticationResult>> Accessor for the underlyingAuthenticationResultmap maintained with the IdP session.Get the unmodifiable set ofAuthenticationResults associated with this session.Get the time when this session was created.getId()Get the last activity instant for the session.Get the canonical principal name for the session.getSPSession(String serviceId) Get the SPSession for a given service.Accessor for the underlyingSPSessionmap maintained with the IdP session.Gets the unmodifiable collection of service sessions associated with this session.inthashCode()booleanDisassociate anAuthenticationResultfrom this IdP session.booleanremoveSPSession(SPSession spSession) Disassociate the given SP session from this IdP session.voidsetLastActivityInstant(Instant instant) Set the last activity instant for the session.toString()Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface net.shibboleth.idp.session.IdPSession
updateAuthenticationResultActivity
-
Field Details
-
log
@Nonnull private final org.slf4j.Logger logClass logger. -
id
Unique ID of this session. -
principalName
A canonical name for the subject of the session. -
creationInstant
Time when this session was created. -
lastActivityInstant
Last activity instant for this session. -
ipV4Address
An IPv4 address to which the session is bound. -
ipV6Address
An IPv6 address to which the session is bound. -
unknownAddress
An "unknown" address to which the session is bound. -
authenticationResults
Tracks authentication results that have occurred during this session. -
spSessions
Tracks services which have been issued authentication tokens during this session.
-
-
Constructor Details
-
AbstractIdPSession
public AbstractIdPSession(@Nonnull @NotEmpty String sessionId, @Nonnull @NotEmpty String canonicalName, @Nonnull Instant creationTime) Constructor.- Parameters:
sessionId- identifier for this sessioncanonicalName- canonical name of subjectcreationTime- creation time of session
-
-
Method Details
-
getId
- Specified by:
getIdin interfaceIdentifiedComponent
-
getPrincipalName
Get the canonical principal name for the session.- Specified by:
getPrincipalNamein interfaceIdPSession- Returns:
- the principal name
-
getCreationInstant
Get the time when this session was created.- Specified by:
getCreationInstantin interfaceIdPSession- Returns:
- time this session was created
-
getLastActivityInstant
Get the last activity instant for the session.- Specified by:
getLastActivityInstantin interfaceIdPSession- Returns:
- last activity instant for the session
-
setLastActivityInstant
Set the last activity instant for the session.- Parameters:
instant- last activity instant for the session- Throws:
SessionException- if an error occurs updating the session
-
doSetLastActivityInstant
Set the last activity instant for the session.This manipulates only the internal state of the object. The
setLastActivityInstant(Instant)method must be overridden to support other persistence requirements.- Parameters:
instant- last activity instant for the session
-
checkAddress
Test the session's validity based on the supplied client address, possibly binding it to the session if appropriate.- Specified by:
checkAddressin interfaceIdPSession- Parameters:
address- client address for validation- Returns:
- true iff the session is valid for the specified client address
- Throws:
SessionException- if an error occurs binding the address to the session
-
getAddress
Get an address to which this session is bound.- Parameters:
family- the address family to inquire- Returns:
- bound address or null
-
bindToAddress
Associate an address with this session.- Parameters:
address- the address to associate- Throws:
SessionException- if an error occurs binding the address to the session
-
doBindToAddress
Associate an address with this session.This manipulates only the internal state of the object. The
bindToAddress(String)method must be overridden to support other persistence requirements.- Parameters:
address- the address to associate
-
checkTimeout
Test the session's validity based on inactivity, while updating the last activity time.- Specified by:
checkTimeoutin interfaceIdPSession- Returns:
- true iff the session is still valid
- Throws:
SessionException- if an error occurs updating the activity time
-
getAuthenticationResults
Get the unmodifiable set ofAuthenticationResults associated with this session.- Specified by:
getAuthenticationResultsin interfaceIdPSession- Returns:
- unmodifiable set of results
-
getAuthenticationResult
Get an associatedAuthenticationResultgiven its flow ID.- Specified by:
getAuthenticationResultin interfaceIdPSession- Parameters:
flowId- the ID of theAuthenticationResult- Returns:
- the authentication result, or null
-
addAuthenticationResult
@Nullable public AuthenticationResult addAuthenticationResult(@Nonnull AuthenticationResult result) throws SessionException Add a newAuthenticationResultto this IdP session, replacing any existing result of the same flow ID.- Specified by:
addAuthenticationResultin interfaceIdPSession- Parameters:
result- the result to add- Returns:
- a previously existing result replaced by the new one, if any
- Throws:
SessionException- if an error occurs updating the session
-
removeAuthenticationResult
public boolean removeAuthenticationResult(@Nonnull AuthenticationResult result) throws SessionException Disassociate anAuthenticationResultfrom this IdP session.- Specified by:
removeAuthenticationResultin interfaceIdPSession- Parameters:
result- the result to disassociate- Returns:
- true iff the given result had been associated with this IdP session and now is not
- Throws:
SessionException- if an error occurs accessing the session
-
doAddAuthenticationResult
@Nullable public AuthenticationResult doAddAuthenticationResult(@Nonnull AuthenticationResult result) Add a newAuthenticationResultto this IdP session, replacing any existing result of the same flow ID.This manipulates only the internal state of the object. The
addAuthenticationResult(AuthenticationResult)method must be implemented to support other persistence requirements.- Parameters:
result- the result to add- Returns:
- a previously existing result replaced by the new one, if any
-
doRemoveAuthenticationResult
Disassociate anAuthenticationResultfrom this IdP session.This manipulates only the internal state of the object. The
removeAuthenticationResult(AuthenticationResult)method must be implemented to support other persistence requirements.- Parameters:
result- the result to disassociate- Returns:
- true iff the given result had been associated with this IdP session and now is not
-
getSPSessions
Gets the unmodifiable collection of service sessions associated with this session.- Specified by:
getSPSessionsin interfaceIdPSession- Returns:
- unmodifiable collection of service sessions associated with this session
-
getSPSession
Get the SPSession for a given service.- Specified by:
getSPSessionin interfaceIdPSession- Parameters:
serviceId- ID of the service- Returns:
- the session service or null if no session exists for that service, may be null
-
addSPSession
Add a new SP session to this IdP session, replacing any existing session for the same service.- Specified by:
addSPSessionin interfaceIdPSession- Parameters:
spSession- the SP session- Returns:
- a previously existing SPSession replaced by the new one, if any
- Throws:
SessionException- if an error occurs accessing the session
-
removeSPSession
Disassociate the given SP session from this IdP session.- Specified by:
removeSPSessionin interfaceIdPSession- Parameters:
spSession- the SP session- Returns:
- true iff the given SP session had been associated with this IdP session and now is not
- Throws:
SessionException- if an error occurs accessing the SP session
-
doAddSPSession
Add a new SP session to this IdP session, replacing any existing session for the same service.This manipulates only the internal state of the object. The
addSPSession(SPSession)method must be implemented to support other persistence requirements.- Parameters:
spSession- the SP session- Returns:
- a previously existing SPSession replaced by the new one, if any
-
doRemoveSPSession
Disassociate the given SP session from this IdP session.This manipulates only the internal state of the object. The
removeSPSession(SPSession)method must be implemented to support other persistence requirements.- Parameters:
spSession- the SP session- Returns:
- true iff the given SP session had been associated with this IdP session and now is not
-
equals
-
hashCode
public int hashCode() -
toString
-
getAuthenticationResultMap
Accessor for the underlyingAuthenticationResultmap maintained with the IdP session.- Returns:
- direct access to the result map
-
getSPSessionMap
Accessor for the underlyingSPSessionmap maintained with the IdP session.- Returns:
- direct access to the service session map
-
getAddressFamily
@Nonnull protected static AbstractIdPSession.AddressFamily getAddressFamily(@Nonnull @NotEmpty String address) Returns the address family for an input address.- Parameters:
address- the string to check- Returns:
- the address family
-