LoginContext (Shibboleth Identity Provider 2.2.0 Java API.)
Date: 2010-09-23

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## edu.internet2.middleware.shibboleth.idp.authn
Class LoginContext

    java.lang.Object
      edu.internet2.middleware.shibboleth.idp.authn.LoginContext

All Implemented Interfaces:
  Serializable

Direct Known Subclasses:
  Saml2LoginContext, ShibbolethSSOLoginContext

    public class LoginContext

extends Object
implements Serializable

Login context created by a profile handler and interpreted by the authentication package. Two properties are tracked by default:

- `forceAuth` - Should user authentication be forced (default value: false).
- `passiveAuth` - Should user authentication not control the UI (default value: false).

A `Map`<String, Object> is provided to store other properties. Alternatively, a profile handler may create a subclass of LoginContext with extra fields. LoginContexts should be created by a profile handler when authentication is needed. Once control has returned to the profile handler, it should remove the LoginContext from the HttpSession. The `AuthenticationEngine` should set the `setAuthenticationAttempted()`, `setPrincipalAuthenticated(boolean)`, `setAuthenticationFailure(AuthenticationException)`, appropriately.

See Also:
  Serialized Form

Field Summary
`static String` | `LOGIN_CONTEXT_KEY` the key in a HttpSession where login contexts are stored.

Constructor Summary
`LoginContext()` Creates a new instance of LoginContext.
`LoginContext(boolean force, boolean passive)` Creates a new instance of LoginContext.

Method Summary
`String` | `getAttemptedAuthnMethod()` Gets the authentication method that was used when attempting to authenticate the user.
`boolean` | `getAuthenticationAttempted()` Returns if authentication has been attempted for this user.
`long` | `getAuthenticationDuration()` Gets the duration of authentication.
`String` | `getAuthenticationEngineURL()` Gets the authentication engine's URL.
`AuthenticationException` | `getAuthenticationFailure()` Gets the error that occurred during authentication.
`DateTime` | `getAuthenticationInstant()` Gets the authentication instant.
`String` | `getAuthenticationMethod()` Gets the method used to authenticate the user.
`AuthenticationMethodInformation` | `getAuthenticationMethodInformation()` Gets information about the authentication event.
`String` | `getDefaultAuthenticationMethod()` Gets the authentication method to use if none is requested.
`String` | `getPrincipalName()` Returns the ID of the authenticated user.
`String` | `getProfileHandlerURL()` Gets the ProfileHandler URL.
`Object` | `getProperty(String key)` Get an optional property object.
`String` | `getRelyingPartyId()` Gets the entity ID of the relying party.
`List<String>` | `getRequestedAuthenticationMethods()` Return the acceptable authentication handler URIs, in preference order, for authenticating this user.
`String` | `getSessionID()` Gets the `Session` ID.
`boolean` | `isForceAuthRequired()` Returns if authentication must be forced.
`boolean` | `isPassiveAuthRequired()` Returns if authentication must be passive.
`boolean` | `isPrincipalAuthenticated()` Returns if authentication succeeded.
`void` | `setAttemptedAuthnMethod(String method)` Sets the authentication method that was used when attempting to authenticate the user.
`void` | `setAuthenticationAttempted()` Set if authentication has been attempted.
`void` | `setAuthenticationDuration(long duration)` Deprecated. this information is contained in the `AuthenticationMethodInformation`
`void` | `setAuthenticationEngineURL(String url)` Sets the authentication engine's URL.
`void` | `setAuthenticationFailure(AuthenticationException error)` Sets the error that occurred during authentication.
`void` | `setAuthenticationInstant(DateTime instant)` Deprecated. this information is contained in the `AuthenticationMethodInformation`
`void` | `setAuthenticationMethod(String method)` Deprecated. this information is contained in the `AuthenticationMethodInformation`
`void` | `setAuthenticationMethodInformation(AuthenticationMethodInformation info)` Sets the information about the authentication event.
`void` | `setDefaultAuthenticationMethod(String method)` Sets the authentication method to use if none is requested.
`void` | `setForceAuthRequired(boolean force)` Sets if authentication must be forced.
`void` | `setPassiveAuthRequired(boolean passive)` Sets if authentication must be passive.
`void` | `setPrincipalAuthenticated(boolean authnOK)` Sets if authentication succeeded.
`void` | `setPrincipalName(String id)` Deprecated. this information is contained in the `AuthenticationMethodInformation`
`void` | `setProfileHandlerURL(String url)` Sets the ProfileHandler URL.
`void` | `setProperty(String key, Serializable obj)` Sets an optional property object.
`void` | `setRelyingParty(String id)` Gets the entity ID of the relying party.
`void` | `setSessionID(String id)` Sets the `Session` ID.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### LOGIN_CONTEXT_KEY

    public static final String LOGIN_CONTEXT_KEY

  the key in a HttpSession where login contexts are stored.

  See Also:
    Constant Field Values

Constructor Detail

### LoginContext

    public LoginContext()

  Creates a new instance of LoginContext.

### LoginContext

    public LoginContext(boolean force,
                        boolean passive)

  Creates a new instance of LoginContext.

  Parameters:
    `force` - if the authentication manager must re-authenticate the user.
    `passive` - if the authentication manager must not interact with the users UI.

Method Detail

### getAttemptedAuthnMethod

    public String getAttemptedAuthnMethod()

  Gets the authentication method that was used when attempting to authenticate the user. Note, this may be different than the authentication method reported within `getAuthenticationMethodInformation()`.

  Returns:
    authentication method that was used when attempting to authenticate the user

### getAuthenticationAttempted

    public boolean getAuthenticationAttempted()

  Returns if authentication has been attempted for this user.

  Returns:
    if authentication has been attempted for this user

### getAuthenticationDuration

    public long getAuthenticationDuration()

  Gets the duration of authentication.

  Returns:
    The duration of authentication, or zero if none was set.

### getAuthenticationEngineURL

    public String getAuthenticationEngineURL()

  Gets the authentication engine's URL.

  Returns:
    the URL of the authentication engine

### getAuthenticationFailure

    public AuthenticationException getAuthenticationFailure()

  Gets the error that occurred during authentication.

  Returns:
    error that occurred during authentication

### getAuthenticationInstant

    public DateTime getAuthenticationInstant()

  Gets the authentication instant.

  Returns:
    The instant of authentication, or `null` if none was set.

### getAuthenticationMethod

    public String getAuthenticationMethod()

  Gets the method used to authenticate the user.

  Returns:
    The method used to authenticate the user.

### getAuthenticationMethodInformation

    public AuthenticationMethodInformation getAuthenticationMethodInformation()

  Gets information about the authentication event.

  Returns:
    information about the authentication event.

### getDefaultAuthenticationMethod

    public String getDefaultAuthenticationMethod()

  Gets the authentication method to use if none is requested.

  Returns:
    authentication method to use if none is requested, may be null which indicates any method may be used

### getPrincipalName

    public String getPrincipalName()

  Returns the ID of the authenticated user.

  Returns:
    the ID of the user, or `null` if authentication failed.

### getProfileHandlerURL

    public String getProfileHandlerURL()

  Gets the ProfileHandler URL.

  Returns:
    the URL of the profile handler that is invoking the Authentication Manager.

### getProperty

    public Object getProperty(String key)

  Get an optional property object.

  Parameters:
    `key` - The key in the properties Map.
  Returns:
    The object, or `null` is no object exists for the key.

### getRelyingPartyId

    public String getRelyingPartyId()

  Gets the entity ID of the relying party.

  Returns:
    entity ID of the relying party

### getRequestedAuthenticationMethods

    public List<String> getRequestedAuthenticationMethods()

  Return the acceptable authentication handler URIs, in preference order, for authenticating this user. If no authentication methods are preferred the resultant list will be empty.

  Returns:
    an list of authentication method identifiers

### getSessionID

    public String getSessionID()

  Gets the `Session` ID.

  Returns:
    the Session id

### isForceAuthRequired

    public boolean isForceAuthRequired()

  Returns if authentication must be forced.

  Returns:
    `true` if the authentication manager must re-authenticate the user.

### isPassiveAuthRequired

    public boolean isPassiveAuthRequired()

  Returns if authentication must be passive.

  Returns:
    `true` if the authentication manager must not interact with the users UI.

### isPrincipalAuthenticated

    public boolean isPrincipalAuthenticated()

  Returns if authentication succeeded.

  Returns:
    `true` is the user was successfully authenticated.

### setAttemptedAuthnMethod

    public void setAttemptedAuthnMethod(String method)

  Sets the authentication method that was used when attempting to authenticate the user.

  Parameters:
    `method` - authentication method that was used when attempting to authenticate the user

### setAuthenticationAttempted

    public void setAuthenticationAttempted()

  Set if authentication has been attempted. This method should be called by an `LoginHandler` while processing a request.

### setAuthenticationDuration

    public void setAuthenticationDuration(long duration)

  Deprecated. this information is contained in the `AuthenticationMethodInformation`

  Sets the duration of authentication.

  Parameters:
    `duration` - The duration of authentication.

### setAuthenticationEngineURL

    public void setAuthenticationEngineURL(String url)

  Sets the authentication engine's URL.

  Parameters:
    `url` - the URL of the authentication engine

### setAuthenticationFailure

    public void setAuthenticationFailure(AuthenticationException error)

  Sets the error that occurred during authentication.

  Parameters:
    `error` - error that occurred during authentication

### setAuthenticationInstant

    public void setAuthenticationInstant(DateTime instant)

  Deprecated. this information is contained in the `AuthenticationMethodInformation`

  Sets the authentication instant.

  Parameters:
    `instant` - The instant of authentication.

### setAuthenticationMethod

    public void setAuthenticationMethod(String method)

  Deprecated. this information is contained in the `AuthenticationMethodInformation`

  Sets the method used to authenticate the user.

  Parameters:
    `method` - The method used to authenticate the user.

### setAuthenticationMethodInformation

    public void setAuthenticationMethodInformation(AuthenticationMethodInformation info)

  Sets the information about the authentication event.

  Parameters:
    `info` - information about the authentication event

### setDefaultAuthenticationMethod

    public void setDefaultAuthenticationMethod(String method)

  Sets the authentication method to use if none is requested.

  Parameters:
    `method` - authentication method to use if none is requested, may be null which indicates any method may be used

### setForceAuthRequired

    public void setForceAuthRequired(boolean force)

  Sets if authentication must be forced.

  Parameters:
    `force` - if the authentication manager must re-authenticate the user.

### setPassiveAuthRequired

    public void setPassiveAuthRequired(boolean passive)

  Sets if authentication must be passive.

  Parameters:
    `passive` - if the authentication manager must not interact with the users UI.

### setPrincipalAuthenticated

    public void setPrincipalAuthenticated(boolean authnOK)

  Sets if authentication succeeded.

  Parameters:
    `authnOK` - if authentication succeeded;

### setPrincipalName

    public void setPrincipalName(String id)

  Deprecated. this information is contained in the `AuthenticationMethodInformation`

  Sets the ID of the authenticated user.

  Parameters:
    `id` - The userid.

### setProfileHandlerURL

    public void setProfileHandlerURL(String url)

  Sets the ProfileHandler URL.

  Parameters:
    `url` - The URL of the profile handler that invoked the AuthenticationManager/

### setProperty

    public void setProperty(String key,
                            Serializable obj)

  Sets an optional property object. If an object is already associated with key, it will be overwritten.

  Parameters:
    `key` - The key to set.
    `obj` - The object to associate with key.

### setRelyingParty

    public void setRelyingParty(String id)

  Gets the entity ID of the relying party.

  Parameters:
    `id` - entity ID of the relying party

### setSessionID

    public void setSessionID(String id)

  Sets the `Session` ID.

  Parameters:
    `id` - the Session ID

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2006-2010 Internet2. All Rights Reserved.