org.apache.qpid.server.security.auth.database
Class PropertiesPrincipalDatabase

java.lang.Object
  extended by org.apache.qpid.server.security.auth.database.PropertiesPrincipalDatabase
All Implemented Interfaces:
PrincipalDatabase

public class PropertiesPrincipalDatabase
extends Object
implements PrincipalDatabase


Constructor Summary
PropertiesPrincipalDatabase(Properties users)
           
 
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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PropertiesPrincipalDatabase

public PropertiesPrincipalDatabase(Properties users)
Method Detail

setPassword

public void setPassword(Principal principal,
                        PasswordCallback callback)
                 throws IOException,
                        AccountNotFoundException
Description copied from interface: PrincipalDatabase
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.

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

verifyPassword

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

Specified by:
verifyPassword in interface PrincipalDatabase
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

public boolean updatePassword(Principal principal,
                              char[] password)
                       throws AccountNotFoundException
Description copied from interface: PrincipalDatabase
Update(Change) the password for the given principal

Specified by:
updatePassword in interface PrincipalDatabase
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

public boolean createPrincipal(Principal principal,
                               char[] password)
Description copied from interface: PrincipalDatabase
Create a new principal in the database

Specified by:
createPrincipal in interface PrincipalDatabase
Parameters:
principal - The principal to create
password - The password to set for the principal
Returns:
True on a successful creation

deletePrincipal

public boolean deletePrincipal(Principal principal)
                        throws AccountNotFoundException
Description copied from interface: PrincipalDatabase
Delete a principal

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

getMechanisms

public Map<String,AuthenticationProviderInitialiser> getMechanisms()
Specified by:
getMechanisms in interface PrincipalDatabase

getUsers

public List<Principal> getUsers()
Specified by:
getUsers in interface PrincipalDatabase

getUser

public Principal getUser(String username)
Description copied from interface: PrincipalDatabase
Get the principal from the database with the given username

Specified by:
getUser in interface PrincipalDatabase
Parameters:
username - of the principal to lookup
Returns:
The Principal object for the given username or null if not found.

reload

public void reload()
            throws IOException
Description copied from interface: PrincipalDatabase
Reload the database to its ensure contents are up to date

Specified by:
reload in interface PrincipalDatabase
Throws:
IOException - If there was an error reloading the database


Licensed to the Apache Software Foundation