Package net.shibboleth.idp.session
Interface IdPSession
-
- All Superinterfaces:
Component,IdentifiedComponent
- All Known Implementing Classes:
AbstractIdPSession
@ThreadSafe public interface IdPSession extends IdentifiedComponent
An identity provider session belonging to a particular subject and client device.
-
-
Field Summary
Fields Modifier and Type Field Description static StringMDC_ATTRIBUTEName ofMDCattribute that holds the current session ID:idp.session.id.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description AuthenticationResultaddAuthenticationResult(AuthenticationResult result)Add a newAuthenticationResultto this IdP session, replacing any existing result of the same flow ID.SPSessionaddSPSession(SPSession spSession)Add a new SP session to this IdP session, replacing any existing session for the same service.booleancheckAddress(String address)Test the session's validity based on the supplied client address, possibly binding it to the session if appropriate.booleancheckTimeout()Test the session's validity based on inactivity, while updating the last activity time.AuthenticationResultgetAuthenticationResult(String flowId)Get an associatedAuthenticationResultgiven its flow ID.Set<AuthenticationResult>getAuthenticationResults()Get the unmodifiable set ofAuthenticationResults associated with this session.InstantgetCreationInstant()Get the time when this session was created.InstantgetLastActivityInstant()Get the last activity instant for the session.StringgetPrincipalName()Get the canonical principal name for the session.SPSessiongetSPSession(String serviceId)Get the SPSession for a given service.Set<SPSession>getSPSessions()Gets the unmodifiable collection of service sessions associated with this session.booleanremoveAuthenticationResult(AuthenticationResult result)Disassociate anAuthenticationResultfrom this IdP session.booleanremoveSPSession(SPSession spSession)Disassociate the given SP session from this IdP session.voidupdateAuthenticationResultActivity(AuthenticationResult result)Update the recorded activity timestamp for anAuthenticationResultassociated with this session.-
Methods inherited from interface net.shibboleth.utilities.java.support.component.IdentifiedComponent
getId
-
-
-
-
Field Detail
-
MDC_ATTRIBUTE
static final String MDC_ATTRIBUTE
Name ofMDCattribute that holds the current session ID:idp.session.id.- See Also:
- Constant Field Values
-
-
Method Detail
-
getPrincipalName
@Nonnull @NotEmpty String getPrincipalName()
Get the canonical principal name for the session.- Returns:
- the principal name
-
getCreationInstant
@Nonnull Instant getCreationInstant()
Get the time when this session was created.- Returns:
- time this session was created
-
getLastActivityInstant
@Nonnull Instant getLastActivityInstant()
Get the last activity instant for the session.- Returns:
- last activity instant for the session
-
checkAddress
boolean checkAddress(@Nonnull @NotEmpty String address) throws SessionException
Test the session's validity based on the supplied client address, possibly binding it to the session if appropriate.- 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
-
checkTimeout
boolean checkTimeout() throws SessionExceptionTest the session's validity based on inactivity, while updating the last activity time.- Returns:
- true iff the session is still valid
- Throws:
SessionException- if an error occurs updating the activity time
-
getAuthenticationResults
@Nonnull @NonnullElements @NotLive @Unmodifiable Set<AuthenticationResult> getAuthenticationResults()
Get the unmodifiable set ofAuthenticationResults associated with this session.- Returns:
- unmodifiable set of results
-
getAuthenticationResult
@Nullable AuthenticationResult getAuthenticationResult(@Nonnull @NotEmpty String flowId)
Get an associatedAuthenticationResultgiven its flow ID.- Parameters:
flowId- the ID of theAuthenticationResult- Returns:
- the authentication result, or null
-
addAuthenticationResult
@Nullable AuthenticationResult addAuthenticationResult(@Nonnull AuthenticationResult result) throws SessionException
Add a newAuthenticationResultto this IdP session, replacing any existing result of the same flow ID.- 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
-
updateAuthenticationResultActivity
void updateAuthenticationResultActivity(@Nonnull AuthenticationResult result) throws SessionExceptionUpdate the recorded activity timestamp for anAuthenticationResultassociated with this session.- Parameters:
result- the result to update- Throws:
SessionException- if an error occurs updating the session
-
removeAuthenticationResult
boolean removeAuthenticationResult(@Nonnull AuthenticationResult result) throws SessionExceptionDisassociate anAuthenticationResultfrom this IdP session.- 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
-
getSPSessions
@Nonnull @NonnullElements @NotLive @Unmodifiable Set<SPSession> getSPSessions()
Gets the unmodifiable collection of service sessions associated with this session.- Returns:
- unmodifiable collection of service sessions associated with this session
-
getSPSession
@Nullable SPSession getSPSession(@Nonnull @NotEmpty String serviceId)
Get the SPSession for a given service.- Parameters:
serviceId- ID of the service- Returns:
- the session service or null if no session exists for that service, may be null
-
addSPSession
@Nullable SPSession addSPSession(@Nonnull SPSession spSession) throws SessionException
Add a new SP session to this IdP session, replacing any existing session for the same service.- 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
boolean removeSPSession(@Nonnull SPSession spSession) throws SessionExceptionDisassociate the given SP session from this IdP session.- 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
-
-