Interface PasswordStorage


public interface PasswordStorage
This interface provides the ability to store passwords in a central storage. Each password in the storage is identified by an alias. The alias is a string and may contain [a-zA-Z0-9], and "_" characters.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Deletes the password assigned to the given alias.
    char[]
    Returns the password associated with the given alias.
    void
    setPassword(String alias, char[] password)
    Stores the given password and assigns it to the given alias.
  • Method Details

    • getPassword

      char[] getPassword(String alias) throws PasswordStorageException
      Returns the password associated with the given alias. The password must have been associated with the alias by call to setPassword.
      Parameters:
      alias - the alias name. Alias may contain [a-zA-Z0-9], and "_" characters.
      Returns:
      the requested password, or null if the given alias does not exist or does not identify a password.
      Throws:
      PasswordStorageException - If there was an error while trying to get the password.
      IllegalArgumentException - If alias is null or alias passed to the method contains unsupported characters.
    • setPassword

      void setPassword(String alias, char[] password) throws PasswordStorageException
      Stores the given password and assigns it to the given alias. If there is already a password assigned to this alias, it will be replaced.
      Parameters:
      alias - the alias name. Alias may contain [a-zA-Z0-9], and "_" characters.
      password - the password to be stored assigned to the given alias. The password length should be not smaller than 6 characters and not bigger than 255 characters.
      Throws:
      PasswordStorageException - If there was an error while trying to set the password.
      IllegalArgumentException - If alias or password is null, if alias passed to the method contains unsupported characters, or if password is smaller than 6 characters or bigger than 255.
    • deletePassword

      void deletePassword(String alias) throws PasswordStorageException
      Deletes the password assigned to the given alias. Does nothing if there is no password associated with this alias.
      Parameters:
      alias - the alias name. Alias may contain [a-zA-Z0-9], and "_" characters.
      Throws:
      PasswordStorageException - If there was an error while trying to delete the password.
      IllegalArgumentException - If alias is null.