Interface PrincipalDatabase

    • 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

        List<String> getMechanisms()
        Get the list of mechanisms supported for use with the PrincipalDatabase
        Returns:
        space separated list of supported Sasl mechanisms