## org.beepcore.beep.profile.sasl.otp.database
Class UserDatabasePool

    java.lang.Object
      org.beepcore.beep.profile.sasl.otp.database.UserDatabasePool

All Implemented Interfaces:
  UserDatabaseManager

public class UserDatabasePool
extends java.lang.Object
implements UserDatabaseManager

This class implements UserDatabaseManager with a simple implementation. More sophisticated implementations will use the ProfileConfiguration to tell SASLOTPProfile to load different classes to do this. WARNING: I have some serious concerns about the public nature of these methods. This won't stay this way, but the changes aren't cooked enough to shove into the first beta.

Field Summary

Fields inherited from interface org.beepcore.beep.profile.sasl.otp.database.UserDatabaseManager
`ERR_DB_PARSE, OTP_ALGO, OTP_AUTHENTICATOR, OTP_HEADER, OTP_LAST_HASH, OTP_MECH, OTP_SEED, OTP_SEQUENCE, OTP_SUFFIX`

Constructor Summary
`UserDatabasePool()`

Method Summary
`void` `addUser(java.lang.String username, java.lang.String algorithm, java.lang.String hash, java.lang.String seed, java.lang.String sequence)` Method addUser
`UserDatabase` `getUser(java.lang.String username)` Method getUser This method is provided as a means for users of the OTP databases to retrieve the information contained in them, in the form of an instance of UserDatabase.
`void` `populateUserDatabases()` Method populateUserDatabases is a simple stub routine used to test the library.
`void` `removeUserDB(java.lang.String authenticator)` Method removeUserDB causes the long-term representation (e.g. file) of the user's OTP database to be removed.
`void` `updateUserDB(UserDatabase ud)` Method updateUserDB causes the long-term representation (e.g. file) of the user's OTP database to be updated after a successful authentication.

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

Constructor Detail

### UserDatabasePool

    public UserDatabasePool()

Method Detail

### getUser

    public UserDatabase getUser(java.lang.String username)
                         throws SASLException

  Method getUser This method is provided as a means for users of the OTP databases to retrieve the information contained in them, in the form of an instance of UserDatabase. Please note that ALGORITHM should in time be added - to be part of how one looks up an OTP database (using both the username and the algorithm). The init-word and init-hex commands, in their nature, don't really allow for it, so this'll do for now, but in time it should be that way. It certainly wouldn't be a difficult thing to do. This would also entail evolving the way init-hex/word are processed, as well...which is slightly trickier than doing a dual parameter lookup.

  Specified by:
    `getUser` in interface `UserDatabaseManager`
  Parameters:
    `username` - Indicates which OTP database should be retrieved, based on who wishes to authenticate using it.
  Returns:
    UserDatabase the OTP database for the user specified.
  Throws:
    `SASLException` - is thrown if the parameter is null or some error is encountered during the reading or processing of the user's OTP database file.

### addUser

    public void addUser(java.lang.String username,
                        java.lang.String algorithm,
                        java.lang.String hash,
                        java.lang.String seed,
                        java.lang.String sequence)
                 throws SASLException

  Description copied from interface: `UserDatabaseManager`
  Method addUser

  Specified by:
    `addUser` in interface `UserDatabaseManager`
  Parameters:
    `username` - The identity of the user for whom this OTP database is used.
  Throws:
    `SASLException`

### updateUserDB

    public void updateUserDB(UserDatabase ud)
                      throws SASLException

  Method updateUserDB causes the long-term representation (e.g. file) of the user's OTP database to be updated after a successful authentication. This entails a decrementation of the sequence, and a storage of a new 'last hash' value.

  Specified by:
    `updateUserDB` in interface `UserDatabaseManager`
  Parameters:
    `ud` - The updated form of the OTP database.
  Throws:
    `SASLException` - if any issues are encountered during the storage of the user's OTP DB.

### removeUserDB

    public void removeUserDB(java.lang.String authenticator)
                      throws SASLException

  Method removeUserDB causes the long-term representation (e.g. file) of the user's OTP database to be removed.

  Specified by:
    `removeUserDB` in interface `UserDatabaseManager`
  Parameters:
    `authenticator` - The user of the OTP database.
  Throws:
    `SASLException` - if any issues are encountered during the removal of the user's OTP DB.

### populateUserDatabases

    public void populateUserDatabases()
                               throws SASLException

  Method populateUserDatabases is a simple stub routine used to test the library. It simply creates two temporary OTP databases.

  Throws:
    `SASLException` - if it encounters any issues storing the OTP databases.

Copyright ? 2001 Invisible Worlds, Inc. All Rights Reserved.