## org.beepcore.beep.profile.sasl.otp.database
Interface UserDatabaseManager

All Known Implementing Classes:
  UserDatabasePool

public interface UserDatabaseManager

This class provides several routines through which one can retrieve implementations of SASL OTP User Databases. Implementors of any other UserDatabase implementations will want to expose them through this, or provide similar functionality elsewhere.

Field Summary
`static java.lang.String` `ERR_DB_PARSE`
`static java.lang.String` `OTP_ALGO`
`static java.lang.String` `OTP_AUTHENTICATOR`
`static java.lang.String` `OTP_HEADER`
`static java.lang.String` `OTP_LAST_HASH`
`static java.lang.String` `OTP_MECH`
`static java.lang.String` `OTP_SEED`
`static java.lang.String` `OTP_SEQUENCE`
`static java.lang.String` `OTP_SUFFIX`

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` `removeUserDB(java.lang.String username)` Method purgeUserDatabase is a routine designed to allow for the removal of a user db.
`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.

Field Detail

### OTP_ALGO

    public static final java.lang.String OTP_ALGO

See Also:
  Constant Field Values

### OTP_AUTHENTICATOR

    public static final java.lang.String OTP_AUTHENTICATOR

See Also:
  Constant Field Values

### OTP_HEADER

    public static final java.lang.String OTP_HEADER

See Also:
  Constant Field Values

### OTP_LAST_HASH

    public static final java.lang.String OTP_LAST_HASH

See Also:
  Constant Field Values

### OTP_MECH

    public static final java.lang.String OTP_MECH

See Also:
  Constant Field Values

### OTP_SEED

    public static final java.lang.String OTP_SEED

See Also:
  Constant Field Values

### OTP_SEQUENCE

    public static final java.lang.String OTP_SEQUENCE

See Also:
  Constant Field Values

### OTP_SUFFIX

    public static final java.lang.String OTP_SUFFIX

See Also:
  Constant Field Values

### ERR_DB_PARSE

    public static final java.lang.String ERR_DB_PARSE

See Also:
  Constant Field Values

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.

  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

  Method addUser

  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.

  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 username)
                      throws SASLException

  Method purgeUserDatabase is a routine designed to allow for the removal of a user db.

  Parameters:
    `username` - The username associated with a given db.
  Throws:
    `SASLException` - if any errors are encountered in the removal of the data (such as it not being there in the first place or encountering some rights issue, it can't be removed right now cuz it's being used etc.)

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