## org.eclipse.jetty.security
Class MappedLoginService

    java.lang.Object
      org.eclipse.jetty.util.component.AbstractLifeCycle
          org.eclipse.jetty.security.MappedLoginService

All Implemented Interfaces:
  LoginService, LifeCycle

Direct Known Subclasses:
  DataSourceLoginService, HashLoginService, JDBCLoginService

    public abstract class MappedLoginService

extends AbstractLifeCycle
implements LoginService

A login service that keeps UserIdentities in a concurrent map either as the source or a cache of the users.

Nested Class Summary
`static class` `MappedLoginService.Anonymous`
`static class` `MappedLoginService.KnownUser`
`static class` `MappedLoginService.RolePrincipal`
`static interface` `MappedLoginService.UserPrincipal`

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
`protected IdentityService` `_identityService`
`protected String` `_name`
`protected ConcurrentMap<String,UserIdentity>` `_users`

Fields inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
`_listeners, FAILED, RUNNING, STARTED, STARTING, STOPPED, STOPPING`

Constructor Summary
`protected` `MappedLoginService()`

Method Summary
`protected void` `doStart()`
`protected void` `doStop()`
`IdentityService` `getIdentityService()` Get the identityService.
`String` `getName()` Get the name.
`ConcurrentMap<String,UserIdentity>` `getUsers()` Get the users.
`protected abstract UserIdentity` `loadUser(String username)`
`protected abstract void` `loadUsers()`
`UserIdentity` `login(String username, Object credentials)` Login a user.
`void` `logout(UserIdentity identity)`
`UserIdentity` `putUser(String userName, Credential credential, String[] roles)` Put user into realm.
`protected UserIdentity` `putUser(String userName, Object info)` Put user into realm.
`void` `removeUser(String username)`
`void` `setIdentityService(IdentityService identityService)` Set the identityService.
`void` `setName(String name)` Set the name.
`void` `setUsers(Map<String,UserIdentity> users)` Set the users.
`String` `toString()`
`boolean` `validate(UserIdentity user)` Validate a user identity.

Methods inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
`addLifeCycleListener, getState, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop`

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

Field Detail

### _identityService

    protected IdentityService _identityService

### _name

    protected String _name

### _users

    protected final ConcurrentMap<String,UserIdentity> _users

Constructor Detail

### MappedLoginService

    protected MappedLoginService()

Method Detail

### getName

    public String getName()

  Get the name.

  Specified by:
    `getName` in interface `LoginService`
  Returns:
    the name

### getIdentityService

    public IdentityService getIdentityService()

  Get the identityService.

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

### getUsers

    public ConcurrentMap<String,UserIdentity> getUsers()

  Get the users.

  Returns:
    the users

### setIdentityService

    public void setIdentityService(IdentityService identityService)

  Set the identityService.

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

### setName

    public void setName(String name)

  Set the name.

  Parameters:
    `name` - the name to set

### setUsers

    public void setUsers(Map<String,UserIdentity> users)

  Set the users.

  Parameters:
    `users` - the users to set

### doStart

    protected void doStart()
                    throws Exception

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

### doStop

    protected void doStop()
                   throws Exception

  Overrides:
    `doStop` in class `AbstractLifeCycle`
  Throws:
    `Exception`

### logout

    public void logout(UserIdentity identity)

  Specified by:
    `logout` in interface `LoginService`

### toString

    public String toString()

  Overrides:
    `toString` in class `Object`

### putUser

    protected UserIdentity putUser(String userName,
                                   Object info)

  Put user into realm. Called by implementations to put the user data loaded from file/db etc into the user structure.

  Parameters:
    `userName` - User name
    `info` - a UserIdentity instance, or a String password or Credential instance
  Returns:
    User instance

### putUser

    public UserIdentity putUser(String userName,
                                Credential credential,
                                String[] roles)

  Put user into realm.

  Parameters:
    `userName` - The user to add
    `credential` - The users Credentials
    `roles` - The users roles
  Returns:
    UserIdentity

### removeUser

    public void removeUser(String username)

### 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
  See Also:
    `LoginService.login(java.lang.String, java.lang.Object)`

### 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.

### loadUser

    protected abstract UserIdentity loadUser(String username)

### loadUsers

    protected abstract void loadUsers()
                               throws IOException

  Throws:
    `IOException`

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