com.vmware.security.credstore
Interface CredentialStore


public interface CredentialStore

A credential store.

For each method with a host parameter, 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
 boolean addPassword(java.lang.String host, java.lang.String username, char[] password)
          Stores the password for a given host and username.
 void clearPasswords()
          Removes all passwords.
 void close()
          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.
 char[] getPassword(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.
 boolean removePassword(java.lang.String host, java.lang.String username)
          Removes the password for a given host and username.
 

Method Detail

getPassword

char[] getPassword(java.lang.String host,
                   java.lang.String username)
                   throws java.io.IOException
Gets the password for a given host and username.

Returns:
the password, or null if none is found
Throws:
java.io.IOException

addPassword

boolean addPassword(java.lang.String host,
                    java.lang.String username,
                    char[] password)
                    throws java.io.IOException
Stores the password for a given host and username. If a password already exists for that host and username, it is overwritten.

Returns:
true if 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.IOException
Removes the password for a given host and username. If no such password exists, this method has no effect.

Returns:
true if the password existed and was removed
Throws:
java.io.IOException

clearPasswords

void clearPasswords()
                    throws java.io.IOException
Removes all passwords.

Throws:
java.io.IOException

getHosts

java.util.Set<java.lang.String> getHosts()
                                         throws java.io.IOException
Returns 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.IOException
Returns all usernames that have passwords stored for a given host.

Throws:
java.io.IOException

close

void close()
           throws java.io.IOException
Closes this credential store and frees all resources associated with it. No further CredentialStore methods may be invoked on this object.

Throws:
java.io.IOException