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 java.lang.String` | `_callbackHandlerClass`
    `protected JAASUserPrincipal` | `_defaultUser`
    `protected IdentityService` | `_identityService`
    `protected java.lang.String` | `_loginModuleName`
    `protected java.lang.String` | `_realmName`
    `protected java.lang.String[]` | `_roleClassNames`
    `static java.lang.String` | `DEFAULT_ROLE_CLASS_NAME`
    `static java.lang.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(java.lang.String name)` Constructor.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `doStart()`
    `IdentityService` | `getIdentityService()` Get the identityService.
    `java.lang.String` | `getName()` Get the name of the realm.
    `java.lang.String[]` | `getRoleClassNames()`
    `UserIdentity` | `login(java.lang.String username, java.lang.Object credentials)` Login a user.
    `void` | `logout(UserIdentity user)`
    `void` | `setCallbackHandlerClass(java.lang.String classname)`
    `void` | `setIdentityService(IdentityService identityService)` Set the identityService.
    `void` | `setLoginModuleName(java.lang.String name)` Set the name to use to index into the config file of LoginModules.
    `void` | `setName(java.lang.String name)` Set the name of the realm
    `void` | `setRoleClassNames(java.lang.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 java.lang.String DEFAULT_ROLE_CLASS_NAME

    - #### DEFAULT_ROLE_CLASS_NAMES

          public static java.lang.String[] DEFAULT_ROLE_CLASS_NAMES

    - #### _roleClassNames

          protected java.lang.String[] _roleClassNames

    - #### _callbackHandlerClass

          protected java.lang.String _callbackHandlerClass

    - #### _realmName

          protected java.lang.String _realmName

    - #### _loginModuleName

          protected java.lang.String _loginModuleName

    - #### _defaultUser

          protected JAASUserPrincipal _defaultUser

    - #### _identityService

          protected IdentityService _identityService

  - ### Constructor Detail

    - #### JAASLoginService

          public JAASLoginService()

      Constructor.

    - #### JAASLoginService

          public JAASLoginService(java.lang.String name)

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

  - ### Method Detail

    - #### getName

          public java.lang.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(java.lang.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(java.lang.String name)

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

    - #### setCallbackHandlerClass

          public void setCallbackHandlerClass(java.lang.String classname)

    - #### setRoleClassNames

          public void setRoleClassNames(java.lang.String[] classnames)

    - #### getRoleClassNames

          public java.lang.String[] getRoleClassNames()

    - #### doStart

          protected void doStart()
                          throws java.lang.Exception

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

    - #### login

          public UserIdentity login(java.lang.String username,
                           java.lang.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 © 2013 FuseSource, Corp.. All Rights Reserved.