org.eclipse.net4j.util.security

## Class UserManager

- java.lang.Object
- - org.eclipse.net4j.util.event.Notifier
  - - org.eclipse.net4j.util.lifecycle.Lifecycle
    - - org.eclipse.net4j.util.security.UserManager

- All Implemented Interfaces:
    INotifier, IDeactivateable, ILifecycle, ILifecycle.DeferrableActivation, IAuthenticator, IUserManager
  Direct Known Subclasses:
    FileUserManager

      public class UserManager
      extends Lifecycle
      implements IUserManager, IAuthenticator

  Author:
    Eike Stepper

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from interface org.eclipse.net4j.util.lifecycle.ILifecycle

      `ILifecycle.DeferrableActivation`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected Map<String,char[]>` | `users`

    - ### Fields inherited from class org.eclipse.net4j.util.lifecycle.Lifecycle

      `USE_LABEL`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `UserManager()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addUser(String userID, char[] password)`
    `void` | `authenticate(String userID, char[] password)` Authenticates the user with the passed `userID` by checking whether the supplied `password` matches the password stored for this user.
    `protected void` | `doActivate()`
    `protected void` | `doDeactivate()`
    `byte[]` | `encrypt(String userID, byte[] data, String algorithmName, byte[] salt, int count)`
    `char[]` | `getPassword(String userID)`
    `protected void` | `load(Map<String,char[]> users)`
    `void` | `removeUser(String userID)`
    `protected void` | `save(Map<String,char[]> users)`

    - ### Methods inherited from class org.eclipse.net4j.util.lifecycle.Lifecycle

      `activate, checkActive, checkArg, checkArg, checkInactive, checkNull, checkState, checkState, deactivate, deferredActivate, doAfterActivate, doBeforeActivate, doBeforeDeactivate, dump, getLifecycleState, isActive, isDeferredActivation, toString`

    - ### Methods inherited from class org.eclipse.net4j.util.event.Notifier

      `addListener, fireEvent, fireEvent, fireEvent, fireThrowable, firstListenerAdded, getListeners, getNotificationService, hasListeners, lastListenerRemoved, removeListener`

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

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

    - ### Methods inherited from interface org.eclipse.net4j.util.event.INotifier

      `addListener, getListeners, hasListeners, removeListener`

- - ### Field Detail

    - #### users

          protected transient Map<String,char[]> users

  - ### Constructor Detail

    - #### UserManager

          public UserManager()

  - ### Method Detail

    - #### addUser

          public void addUser(String userID,
                              char[] password)

      Specified by:
        `addUser` in interface `IUserManager`

    - #### removeUser

          public void removeUser(String userID)

      Specified by:
        `removeUser` in interface `IUserManager`

    - #### getPassword

          public char[] getPassword(String userID)

      Since:
        3.3

    - #### authenticate

          public void authenticate(String userID,
                                   char[] password)

      Description copied from interface: `IAuthenticator`
      Authenticates the user with the passed `userID` by checking whether the supplied `password` matches the password stored for this user.

      The implementation is required to throw a `SecurityException` if the passwords do not match.

      Specified by:
        `authenticate` in interface `IAuthenticator`
      Since:
        3.3

    - #### encrypt

          public byte[] encrypt(String userID,
                                byte[] data,
                                String algorithmName,
                                byte[] salt,
                                int count)
                         throws SecurityException

      Specified by:
        `encrypt` in interface `IUserManager`
      Throws:
        `SecurityException`
      Since:
        2.0

    - #### doActivate

          protected void doActivate()
                             throws Exception

      Overrides:
        `doActivate` in class `Lifecycle`
      Throws:
        `Exception`

    - #### doDeactivate

          protected void doDeactivate()
                               throws Exception

      Overrides:
        `doDeactivate` in class `Lifecycle`
      Throws:
        `Exception`

    - #### load

          protected void load(Map<String,char[]> users)
                       throws IORuntimeException

      Throws:
        `IORuntimeException`

    - #### save

          protected void save(Map<String,char[]> users)
                       throws IORuntimeException

      Throws:
        `IORuntimeException`

Copyright (c) 2014 Eike Stepper (Berlin, Germany) and others.
All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html