Interface IdPSession

All Superinterfaces:
Component, IdentifiedComponent
All Known Implementing Classes:
AbstractIdPSession, StorageBackedIdPSession

@ThreadSafe
public interface IdPSession
extends IdentifiedComponent
An identity provider session belonging to a particular subject and client device.
  • Field Details

    • MDC_ATTRIBUTE

      static final String MDC_ATTRIBUTE
      Name of MDC attribute that holds the current session ID: idp.session.id.
      See Also:
      Constant Field Values
  • Method Details

    • 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 SessionException
      Test 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 of AuthenticationResults associated with this session.
      Returns:
      unmodifiable set of results
    • getAuthenticationResult

      @Nullable AuthenticationResult getAuthenticationResult​(@Nonnull @NotEmpty String flowId)
      Get an associated AuthenticationResult given its flow ID.
      Parameters:
      flowId - the ID of the AuthenticationResult
      Returns:
      the authentication result, or null
    • addAuthenticationResult

      @Nullable AuthenticationResult addAuthenticationResult​(@Nonnull AuthenticationResult result) throws SessionException
      Add a new AuthenticationResult to 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 SessionException
      Update the recorded activity timestamp for an AuthenticationResult associated 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 SessionException
      Disassociate an AuthenticationResult from 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

      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 SessionException
      Disassociate 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