org.eclipse.jetty.plus.jaas

## Class JAASLoginService

- java.lang.Object
- - org.eclipse.jetty.util.component.AbstractLifeCycle
  - - org.eclipse.jetty.plus.jaas.JAASLoginService

- All Implemented Interfaces:
    LoginService, LifeCycle

      public class JAASLoginService
      extends AbstractLifeCycle
      implements LoginService

  JAASLoginService
  Apache XBean:
    element="jaasUserRealm" description="Creates a UserRealm suitable for use with JAAS"

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle

      `AbstractLifeCycle.AbstractLifeCycleListener`

    - ### Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.LifeCycle

      `LifeCycle.Listener`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected String` | `_callbackHandlerClass`
    `protected JAASUserPrincipal` | `_defaultUser`
    `protected IdentityService` | `_identityService`
    `protected String` | `_loginModuleName`
    `protected String` | `_realmName`
    `protected String[]` | `_roleClassNames`
    `static String` | `DEFAULT_ROLE_CLASS_NAME`
    `static String[]` | `DEFAULT_ROLE_CLASS_NAMES`

    - ### Fields inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle

      `_listeners, FAILED, RUNNING, STARTED, STARTING, STOPPED, STOPPING`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `JAASLoginService()` Constructor.
    `JAASLoginService(String name)` Constructor.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `doStart()`
    `IdentityService` | `getIdentityService()` Get the identityService.
    `String` | `getName()` Get the name of the realm.
    `String[]` | `getRoleClassNames()`
    `UserIdentity` | `login(String username, Object credentials)` Login a user.
    `void` | `logout(UserIdentity user)`
    `void` | `setCallbackHandlerClass(String classname)`
    `void` | `setIdentityService(IdentityService identityService)` Set the identityService.
    `void` | `setLoginModuleName(String name)` Set the name to use to index into the config file of LoginModules.
    `void` | `setName(String name)` Set the name of the realm
    `void` | `setRoleClassNames(String[] classnames)`
    `boolean` | `validate(UserIdentity user)` Validate a user identity.

    - ### Methods inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle

      `addLifeCycleListener, doStop, getState, getState, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop`

    - ### Methods inherited from class java.lang.Object

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

- - ### Field Detail

    - #### DEFAULT_ROLE_CLASS_NAME

          public static String DEFAULT_ROLE_CLASS_NAME

    - #### DEFAULT_ROLE_CLASS_NAMES

          public static String[] DEFAULT_ROLE_CLASS_NAMES

    - #### _roleClassNames

          protected String[] _roleClassNames

    - #### _callbackHandlerClass

          protected String _callbackHandlerClass

    - #### _realmName

          protected String _realmName

    - #### _loginModuleName

          protected String _loginModuleName

    - #### _defaultUser

          protected JAASUserPrincipal _defaultUser

    - #### _identityService

          protected IdentityService _identityService

  - ### Constructor Detail

    - #### JAASLoginService

          public JAASLoginService()

      Constructor.

    - #### JAASLoginService

          public JAASLoginService(String name)

      Constructor.
      Parameters:
        `name` - the name of the realm

  - ### Method Detail

    - #### getName

          public String getName()

      Get the name of the realm.
      Specified by:
        `getName` in interface `LoginService`
      Returns:
        name or null if not set.

    - #### setName

          public void setName(String name)

      Set the name of the realm
      Parameters:
        `name` - a `String` value

    - #### getIdentityService

          public IdentityService getIdentityService()

      Get the identityService.
      Specified by:
        `getIdentityService` in interface `LoginService`
      Returns:
        the identityService

    - #### setIdentityService

          public void setIdentityService(IdentityService identityService)

      Set the identityService.
      Specified by:
        `setIdentityService` in interface `LoginService`
      Parameters:
        `identityService` - the identityService to set

    - #### setLoginModuleName

          public void setLoginModuleName(String name)

      Set the name to use to index into the config file of LoginModules.
      Parameters:
        `name` - a `String` value

    - #### setCallbackHandlerClass

          public void setCallbackHandlerClass(String classname)

    - #### setRoleClassNames

          public void setRoleClassNames(String[] classnames)

    - #### getRoleClassNames

          public String[] getRoleClassNames()

    - #### doStart

          protected void doStart()
                          throws Exception

      Overrides:
        `doStart` in class `AbstractLifeCycle`
      Throws:
        `Exception`
      See Also:
        `AbstractLifeCycle.doStart()`

    - #### login

          public UserIdentity login(String username,
                           Object credentials)

      Description copied from interface: `LoginService`
      Login a user.
      Specified by:
        `login` in interface `LoginService`
      Parameters:
        `username` - The user name
        `credentials` - The users credentials
      Returns:
        A UserIdentity if the credentials matched, otherwise null

    - #### validate

          public boolean validate(UserIdentity user)

      Description copied from interface: `LoginService`
      Validate a user identity. Validate that a UserIdentity previously created by a call to `LoginService.login(String, Object)` is still valid.
      Specified by:
        `validate` in interface `LoginService`
      Parameters:
        `user` - The user to validate
      Returns:
        true if authentication has not been revoked for the user.

    - #### logout

          public void logout(UserIdentity user)

      Specified by:
        `logout` in interface `LoginService`

Copyright © 1995-2013 Mort Bay Consulting. All Rights Reserved.