Package com.sap.cloud.security.password
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 TypeMethodDescriptionvoid
deletePassword
(String alias) Deletes the password assigned to the given alias.char[]
getPassword
(String alias) 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
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 isnull
or alias passed to the method contains unsupported characters.
-
setPassword
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 isnull
, if alias passed to the method contains unsupported characters, or if password is smaller than 6 characters or bigger than 255.
-
deletePassword
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 isnull
.
-