Package net.shibboleth.idp.session

# 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 Summary

Fields
Modifier and Type
Field
Description
`static final String`
`MDC_ATTRIBUTE`
Name of `MDC` attribute that holds the current session ID: `idp.session.id`.

## Method Summary

Modifier and Type
Method
Description
`AuthenticationResult`
`addAuthenticationResult(AuthenticationResult result)`
Add a new `AuthenticationResult` to this IdP session, replacing any existing result of the same flow ID.
`SPSession`
`addSPSession(SPSession spSession)`
Add a new SP session to this IdP session, replacing any existing session for the same service.
`boolean`
`checkAddress(String address)`
Test the session's validity based on the supplied client address, possibly binding it to the session if appropriate.
`boolean`
`checkTimeout()`
Test the session's validity based on inactivity, while updating the last activity time.
`AuthenticationResult`
`getAuthenticationResult(String flowId)`
Get an associated `AuthenticationResult` given its flow ID.
`Set<AuthenticationResult>`
`getAuthenticationResults()`
Get the unmodifiable set of `AuthenticationResult`s associated with this session.
`Instant`
`getCreationInstant()`
Get the time when this session was created.
`Instant`
`getLastActivityInstant()`
Get the last activity instant for the session.
`String`
`getPrincipalName()`
Get the canonical principal name for the session.
`SPSession`
`getSPSession(String serviceId)`
Get the SPSession for a given service.
`Set<SPSession>`
`getSPSessions()`
Gets the unmodifiable collection of service sessions associated with this session.
`boolean`
`removeAuthenticationResult(AuthenticationResult result)`
Disassociate an `AuthenticationResult` from this IdP session.
`boolean`
`removeSPSession(SPSession spSession)`
Disassociate the given SP session from this IdP session.
`void`
`updateAuthenticationResultActivity(AuthenticationResult result)`
Update the recorded activity timestamp for an `AuthenticationResult` associated with this session.

### Methods inherited from interface net.shibboleth.shared.component.IdentifiedComponent

`getId`

## Field Details

### MDC_ATTRIBUTE

@Nonnull @NotEmpty 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 @NotLive @Unmodifiable Set<AuthenticationResult> getAuthenticationResults()
Get the unmodifiable set of `AuthenticationResult`s 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

@Nonnull @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 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