Package com.vmware.security.credstore
Interface CredentialStore
-
public interface CredentialStoreA credential store.For each method with a
hostparameter, the host may be specified as a DNS domain name, an IPv4 address, or an IPv6 address. When looking up a username or password, the host must be specified in the same manner (DNS, IPv4, or IPv6) as when it was stored.The methods in this interface may be invoked concurrently by multiple threads.
- See Also:
CredentialStoreFactory
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description booleanaddPassword(java.lang.String host, java.lang.String username, java.lang.String password)Stores the password for a given host and username.voidclearPasswords()Removes all passwords.voidclose()Closes this credential store and frees all resources associated with it.java.util.Set<java.lang.String>getHosts()Returns all hosts that have entries in the credential store.java.lang.StringgetPassword(java.lang.String host, java.lang.String username)Gets the password for a given host and username.java.util.Set<java.lang.String>getUsernames(java.lang.String host)Returns all usernames that have passwords stored for a given host.booleanremovePassword(java.lang.String host, java.lang.String username)Removes the password for a given host and username.
-
-
-
Method Detail
-
getPassword
java.lang.String getPassword(java.lang.String host, java.lang.String username) throws java.io.IOException, javax.crypto.IllegalBlockSizeException, javax.crypto.BadPaddingExceptionGets the password for a given host and username.- Returns:
- the password, or
nullif none is found - Throws:
java.io.IOExceptionjavax.crypto.IllegalBlockSizeExceptionjavax.crypto.BadPaddingException
-
addPassword
boolean addPassword(java.lang.String host, java.lang.String username, java.lang.String password) throws java.io.IOExceptionStores the password for a given host and username. If a password already exists for that host and username, it is overwritten.- Returns:
trueif a password for this host and username did not already exist- Throws:
java.io.IOException
-
removePassword
boolean removePassword(java.lang.String host, java.lang.String username) throws java.io.IOExceptionRemoves the password for a given host and username. If no such password exists, this method has no effect.- Returns:
trueif the password existed and was removed- Throws:
java.io.IOException
-
clearPasswords
void clearPasswords() throws java.io.IOExceptionRemoves all passwords.- Throws:
java.io.IOException
-
getHosts
java.util.Set<java.lang.String> getHosts() throws java.io.IOExceptionReturns all hosts that have entries in the credential store.- Throws:
java.io.IOException
-
getUsernames
java.util.Set<java.lang.String> getUsernames(java.lang.String host) throws java.io.IOExceptionReturns all usernames that have passwords stored for a given host.- Throws:
java.io.IOException
-
close
void close() throws java.io.IOExceptionCloses this credential store and frees all resources associated with it. No furtherCredentialStoremethods may be invoked on this object.- Throws:
java.io.IOException
-
-