org.apache.qpid.server.security.auth.database
Interface PrincipalDatabase

All Known Implementing Classes:
Base64MD5PasswordFilePrincipalDatabase, PlainPasswordFilePrincipalDatabase, PropertiesPrincipalDatabase

public interface PrincipalDatabase

Represents a "user database" which is really a way of storing principals (i.e. usernames) and passwords.


Method Summary
 boolean createPrincipal(Principal principal, char[] password)
          Create a new principal in the database
 boolean deletePrincipal(Principal principal)
          Delete a principal
 Map<String,AuthenticationProviderInitialiser> getMechanisms()
           
 Principal getUser(String username)
          Get the principal from the database with the given username
 List<Principal> getUsers()
           
 void reload()
          Reload the database to its ensure contents are up to date
 void setPassword(Principal principal, PasswordCallback callback)
          Set the password for a given principal in the specified callback.
 boolean updatePassword(Principal principal, char[] password)
          Update(Change) the password for the given principal
 boolean verifyPassword(String principal, char[] password)
          Used to verify that the presented Password is correct.
 

Method Detail

setPassword

void setPassword(Principal principal,
                 PasswordCallback callback)
                 throws IOException,
                        AccountNotFoundException
Set the password for a given principal in the specified callback. This is used for certain SASL providers. The user database implementation should look up the password in any way it chooses and set it in the callback by calling its setPassword method.

Parameters:
principal - the principal
callback - the password callback that wants to receive the password
Throws:
AccountNotFoundException - if the account for specified principal could not be found
IOException - if there was an error looking up the principal

verifyPassword

boolean verifyPassword(String principal,
                       char[] password)
                       throws AccountNotFoundException
Used to verify that the presented Password is correct. Currently only used by Management Console

Parameters:
principal - The principal to authenticate
password - The password to check
Returns:
true if password is correct
Throws:
AccountNotFoundException - if the principal cannot be found

updatePassword

boolean updatePassword(Principal principal,
                       char[] password)
                       throws AccountNotFoundException
Update(Change) the password for the given principal

Parameters:
principal - Who's password is to be changed
password - The new password to use
Returns:
True if change was successful
Throws:
AccountNotFoundException - If the given principal doesn't exist in the Database

createPrincipal

boolean createPrincipal(Principal principal,
                        char[] password)
Create a new principal in the database

Parameters:
principal - The principal to create
password - The password to set for the principal
Returns:
True on a successful creation

deletePrincipal

boolean deletePrincipal(Principal principal)
                        throws AccountNotFoundException
Delete a principal

Parameters:
principal - The principal to delete
Returns:
True on a successful creation
Throws:
AccountNotFoundException - If the given principal doesn't exist in the Database

getUser

Principal getUser(String username)
Get the principal from the database with the given username

Parameters:
username - of the principal to lookup
Returns:
The Principal object for the given username or null if not found.

reload

void reload()
            throws IOException
Reload the database to its ensure contents are up to date

Throws:
IOException - If there was an error reloading the database

getMechanisms

Map<String,AuthenticationProviderInitialiser> getMechanisms()

getUsers

List<Principal> getUsers()


Licensed to the Apache Software Foundation