SingleSignOnEntry (Apache Tomcat 10.1.48 API Documentation)
Description: declaration: package: org.apache.catalina.authenticator, class: SingleSignOnEntry

# Class SingleSignOnEntry

java.lang.Object
org.apache.catalina.authenticator.SingleSignOnEntry

All Implemented Interfaces:
  `Serializable`

public class SingleSignOnEntry extends Object implements Serializable
A class that represents entries in the cache of authenticated users. This is necessary to make it available to `AuthenticatorBase` subclasses that need it in order to perform reauthentications when SingleSignOn is in use.

See Also:
  - `SingleSignOn`
  - `AuthenticatorBase.reauthenticateFromSSO(String, Request)`
  - Serialized Form

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `SingleSignOnEntry(Principal principal, String authType, String username, String password)`
  Creates a new SingleSignOnEntry

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `addSession(SingleSignOn sso, String ssoId, Session session)`
  Adds a `Session` to the list of those associated with this SSO.
  `Set<SingleSignOnSessionKey>`
  `findSessions()`
  Returns the HTTP Session identifiers associated with this SSO.
  `String`
  `getAuthType()`
  Gets the name of the authentication type originally used to authenticate the user associated with the SSO.
  `boolean`
  `getCanReauthenticate()`
  Gets whether the authentication type associated with the original authentication supports reauthentication.
  `String`
  `getPassword()`
  Gets the password credential (if any) associated with the SSO.
  `Principal`
  `getPrincipal()`
  Gets the `Principal` that has been authenticated by the SSO.
  `String`
  `getUsername()`
  Gets the username provided by the user as part of the authentication process.
  `void`
  `removeSession(Session session)`
  Removes the given `Session` from the list of those associated with this SSO.
  `void`
  `removeSession(Session session, String oldSessionId)`
  Removes the given `Session` from the list of those associated with this SSO, using the previous sessionId
  `void`
  `updateCredentials(Principal principal, String authType, String username, String password)`
  Updates the SingleSignOnEntry to reflect the latest security information associated with the caller.

  ### Methods inherited from class Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### SingleSignOnEntry

    public SingleSignOnEntry(Principal principal, String authType, String username, String password)
    Creates a new SingleSignOnEntry
    Parameters:
      `principal` - the `Principal` returned by the latest call to `Realm.authenticate`.
      `authType` - the type of authenticator used (BASIC, CLIENT_CERT, DIGEST or FORM)
      `username` - the username (if any) used for the authentication
      `password` - the password (if any) used for the authentication

- ## Method Details

  - ### addSession

    public void addSession(SingleSignOn sso, String ssoId, Session session)
    Adds a `Session` to the list of those associated with this SSO.
    Parameters:
      `sso` - The `SingleSignOn` valve that is managing the SSO session.
      `ssoId` - The ID of the SSO session.
      `session` - The `Session` being associated with the SSO.

  - ### removeSession

    public void removeSession(Session session)
    Removes the given `Session` from the list of those associated with this SSO.
    Parameters:
      `session` - the `Session` to remove.

  - ### removeSession

    public void removeSession(Session session, String oldSessionId)
    Removes the given `Session` from the list of those associated with this SSO, using the previous sessionId
    Parameters:
      `session` - the `Session` to remove.
      `oldSessionId` - the previous sessionId of the `Session` to remove.

  - ### findSessions

    public Set<SingleSignOnSessionKey> findSessions()
    Returns the HTTP Session identifiers associated with this SSO.
    Returns:
      the identifiers for the HTTP sessions that are currently associated with this SSO entry

  - ### getAuthType

    public String getAuthType()
    Gets the name of the authentication type originally used to authenticate the user associated with the SSO.
    Returns:
      "BASIC", "CLIENT_CERT", "DIGEST", "FORM" or "NONE"

  - ### getCanReauthenticate

    public boolean getCanReauthenticate()
    Gets whether the authentication type associated with the original authentication supports reauthentication.
    Returns:
      `true` if `getAuthType` returns "BASIC" or "FORM", `false` otherwise.

  - ### getPassword

    public String getPassword()
    Gets the password credential (if any) associated with the SSO.
    Returns:
      the password credential associated with the SSO, or `null` if the original authentication type does not involve a password.

  - ### getPrincipal

    public Principal getPrincipal()
    Gets the `Principal` that has been authenticated by the SSO.
    Returns:
      The Principal that was created by the authentication that triggered the creation of the SSO entry

  - ### getUsername

    public String getUsername()
    Gets the username provided by the user as part of the authentication process.
    Returns:
      The username that was authenticated as part of the authentication that triggered the creation of the SSO entry

  - ### updateCredentials

    public void updateCredentials(Principal principal, String authType, String username, String password)
    Updates the SingleSignOnEntry to reflect the latest security information associated with the caller.
    Parameters:
      `principal` - the `Principal` returned by the latest call to `Realm.authenticate`.
      `authType` - the type of authenticator used (BASIC, CLIENT_CERT, DIGEST or FORM)
      `username` - the username (if any) used for the authentication
      `password` - the password (if any) used for the authentication