FileDocCategorySizeDatePackage
SingleSignOnEntry.javaAPI DocApache Tomcat 6.0.146651Fri Jul 20 04:20:34 BST 2007org.apache.catalina.authenticator

SingleSignOnEntry

public class SingleSignOnEntry extends Object
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.
author
B Stansberry, based on work by Craig R. McClanahan
version
$Revision: 500629 $
see
SingleSignOn
see
AuthenticatorBase#reauthenticateFromSSO

Fields Summary
protected String
authType
protected String
password
protected Principal
principal
protected org.apache.catalina.Session[]
sessions
protected String
username
protected boolean
canReauthenticate
Constructors Summary
public SingleSignOnEntry(Principal principal, String authType, String username, String password)
Creates a new SingleSignOnEntry

param
principal the Principal returned by the latest call to Realm.authenticate.
param
authType the type of authenticator used (BASIC, CLIENT_CERT, DIGEST or FORM)
param
username the username (if any) used for the authentication
param
password the password (if any) used for the authentication


    // ---------------------------------------------------------  Constructors

                                                                                             
        
                                 
        super();
        updateCredentials(principal, authType, username, password);
    
public SingleSignOnEntry()

    
Methods Summary
public synchronized voidaddSession(SingleSignOn sso, org.apache.catalina.Session session)
Adds a Session to the list of those associated with this SSO.

param
sso The SingleSignOn valve that is managing the SSO session.
param
session The Session being associated with the SSO.

        for (int i = 0; i < sessions.length; i++) {
            if (session == sessions[i])
                return;
        }
        Session results[] = new Session[sessions.length + 1];
        System.arraycopy(sessions, 0, results, 0, sessions.length);
        results[sessions.length] = session;
        sessions = results;
        session.addSessionListener(sso);
    
public synchronized org.apache.catalina.Session[]findSessions()
Returns the Sessions associated with this SSO.

        return (this.sessions);
    
public java.lang.StringgetAuthType()
Gets the name of the authentication type originally used to authenticate the user associated with the SSO.

return
"BASIC", "CLIENT_CERT", "DIGEST", "FORM" or "NONE"

        return (this.authType);
    
public booleangetCanReauthenticate()
Gets whether the authentication type associated with the original authentication supports reauthentication.

return
true if getAuthType returns "BASIC" or "FORM", false otherwise.

        return (this.canReauthenticate);
    
public java.lang.StringgetPassword()
Gets the password credential (if any) associated with the SSO.

return
the password credential associated with the SSO, or null if the original authentication type does not involve a password.

        return (this.password);
    
public java.security.PrincipalgetPrincipal()
Gets the Principal that has been authenticated by the SSO.

        return (this.principal);
    
public java.lang.StringgetUsername()
Gets the username provided by the user as part of the authentication process.

        return (this.username);
    
public synchronized voidremoveSession(org.apache.catalina.Session session)
Removes the given Session from the list of those associated with this SSO.

param
session the Session to remove.

        Session[] nsessions = new Session[sessions.length - 1];
        for (int i = 0, j = 0; i < sessions.length; i++) {
            if (session == sessions[i])
                continue;
            nsessions[j++] = sessions[i];
        }
        sessions = nsessions;
    
public voidupdateCredentials(java.security.Principal principal, java.lang.String authType, java.lang.String username, java.lang.String password)
Updates the SingleSignOnEntry to reflect the latest security information associated with the caller.

param
principal the Principal returned by the latest call to Realm.authenticate.
param
authType the type of authenticator used (BASIC, CLIENT_CERT, DIGEST or FORM)
param
username the username (if any) used for the authentication
param
password the password (if any) used for the authentication


        this.principal = principal;
        this.authType = authType;
        this.username = username;
        this.password = password;
        this.canReauthenticate =
            (Constants.BASIC_METHOD.equals(authType)
                || Constants.FORM_METHOD.equals(authType));