org.openmdx.security.auth.context.spi
Interface AuthenticationContext

All Known Implementing Classes:
AuthenticationContextThread

public interface AuthenticationContext

Authentication

Callbacks can be handled in either of two ways:

The AuthenticationContext pattern helps to follow the service request sequence strategy. The invocation sequence would look like that, if it wasn't distributed over different HTTP requests:

 for(
      boolean handleCallbacks = authentication.startLogin();
      handleCallbacks;
 ) try {
     Callback[] callbacks = authentication.getCallbacks();
     // Handle Callbacks
     handleCallbacks = authentication.resumeLogin();
 } catch (IOException exception) {
     handleCallbacks = authentication.resumeLogin(exception);
 } catch (UnsupportedCallbackException exception) {
     handleCallbacks = authentication.resumeLogin(exception);
 }
 Subject subject = authentication.getSubject();
 


Method Summary
 boolean continueLogin()
          Continue execution
 int getAttempt()
          Tells how often the login sequence has been started for the associated LoginContext.
 Callback[] getCallbacks()
          Retrieve the callbacks to be handled.
 String getCorrelationId()
          Retrieve the correlation id.
 String getName()
          Returns the Authentication object's name
 Subject getSubject()
          Return the authenticated Subject.
 boolean restartLogin()
          Re-starts the authentication sequence
 boolean resumeLogin()
          Resumes execution
 boolean resumeLogin(IOException exception)
          Resumes execution
 boolean resumeLogin(UnsupportedCallbackException exception)
          Resumes execution
 void setCorrelationId(String id)
          Set the correlation id.
 boolean startLogin(Subject subject)
          Starts the authentication sequence
 

Method Detail

startLogin

boolean startLogin(Subject subject)
                   throws LoginException,
                          IOException
Starts the authentication sequence

Parameters:
subject - the Subject to authenticate, or null
Returns:
true if there are no more callbacks to be handled and login has commpleted successfully.
Throws:
LoginException - if the login attempt failed
IllegalStateException - if the authenticator is in an inappropriate state
IOException

restartLogin

boolean restartLogin()
                     throws LoginException,
                            IOException
Re-starts the authentication sequence

Returns:
true if there are no more callbacks to be handled and login has commpleted successfully.
Throws:
LoginException - if the login attempt failed
IllegalStateException - if the authenticator is in an inappropriate state
IOException

resumeLogin

boolean resumeLogin()
                    throws LoginException,
                           IOException
Resumes execution

Returns:
true if there are no more callbacks to be handled and login has commpleted successfully.
Throws:
IllegalStateException - if the authenticator is in an inappropriate state
LoginException - if the login process failed
IOException

continueLogin

boolean continueLogin()
                      throws LoginException,
                             IOException
Continue execution

Returns:
true if there are no more callbacks to be handled and login has commpleted successfully.
Throws:
IllegalStateException - if the authenticator is in an inappropriate state
LoginException - if the login process failed
IOException

resumeLogin

boolean resumeLogin(IOException exception)
                    throws LoginException,
                           IOException
Resumes execution

Parameters:
exception - The IOException which occured during callback handling.
Returns:
true if there are no more callbacks to be handled and the login process has commpleted successfully.
Throws:
IllegalStateException - if the authenticator is in an inappropriate state
NullPointerException - if exception is null.
LoginException - if the login process failed
IOException

resumeLogin

boolean resumeLogin(UnsupportedCallbackException exception)
                    throws LoginException,
                           IOException
Resumes execution

Parameters:
exception - The UnsupportedCallbackException which occured during callback handling.
Returns:
true if there are no more callbacks to be handled and the login process has commpleted successfully.
Throws:
IllegalStateException - if the authenticator is in an inappropriate state
NullPointerException - if exception is null.
LoginException - if the login process failed
IOException

getAttempt

int getAttempt()
Tells how often the login sequence has been started for the associated LoginContext.

Returns:
the number of starts or re-starts.

getSubject

Subject getSubject()
Return the authenticated Subject.

Returns:
the authenticated Subject. If the caller specified a Subject to this Authentication's login(Subject) method, this method returns the caller-specified Subject. If a Subject was not specified and authentication succeeds, this method returns the Subject instantiated and used for authentication by this Authentication. If a Subject was not specified, and authentication fails, this method returns null.

getCallbacks

Callback[] getCallbacks()
                        throws LoginException
Retrieve the callbacks to be handled.

Returns:
the callbacks to be handled
Throws:
LoginException - if the callback handler is not ACTIVE and a LoginException is pending

getCorrelationId

String getCorrelationId()
Retrieve the correlation id.

Returns:
the id's value

setCorrelationId

void setCorrelationId(String id)
Set the correlation id.

Parameters:
id - The id's value

getName

String getName()
Returns the Authentication object's name

This method is meant for logging and debugging purposes only.

Returns:
the Authentication object's name


This software is published under the BSD license. Copyright © 2003-2008, OMEX AG, Switzerland, All rights reserved. Use is subject to license terms.