org.springframework.extensions.webscripts.connector
Class SimpleCredentialVault

java.lang.Object
  extended by org.springframework.extensions.webscripts.connector.SimpleCredentialVault
All Implemented Interfaces:
Serializable, CredentialVault
Direct Known Subclasses:
AbstractPersistentCredentialVault

public class SimpleCredentialVault
extends Object
implements CredentialVault, Serializable

A simple implementation of a credential vault that does not persist anything to disk or database.

Credentials can be stored and retrieved from this vault but they will be lost when the server is restarted.

That said, this implementation will likely be very useable for any situations where you wish to explicitly challenge the end user but only challenge them once.

Author:
muzquiano
See Also:
Serialized Form

Field Summary
 Map<String,Credentials> credentialsMap
           
 String id
           
 
Constructor Summary
SimpleCredentialVault(String id)
          Instantiates a new simple credential vault.
 
Method Summary
 String[] getStoredIds()
          Returns the ids for stored credentials
 boolean hasCredentials(String endpointId)
           
 boolean load()
          Tells the Credential Vault to load state from persisted store
 Credentials newCredentials(String endpointId)
          Creates new credentials which are stored in this vault
 void remove(String endpointId)
          Removes credentials for a given endpoint id from the vault
 Credentials retrieve(String endpointId)
          Retrieves credentials for a given endpoint id from the vault
 boolean save()
          Tells the Credential Vault to write state to persisted store
 void store(Credentials credentials)
          Places the given credentials into the vault
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

id

public String id

credentialsMap

public Map<String,Credentials> credentialsMap
Constructor Detail

SimpleCredentialVault

public SimpleCredentialVault(String id)
Instantiates a new simple credential vault.

Parameters:
id - the id
Method Detail

store

public void store(Credentials credentials)
Description copied from interface: CredentialVault
Places the given credentials into the vault

Specified by:
store in interface CredentialVault
Parameters:
credentials - the credentials

retrieve

public Credentials retrieve(String endpointId)
Description copied from interface: CredentialVault
Retrieves credentials for a given endpoint id from the vault

Specified by:
retrieve in interface CredentialVault
Parameters:
endpointId - the endpoint id
Returns:
the credentials

remove

public void remove(String endpointId)
Description copied from interface: CredentialVault
Removes credentials for a given endpoint id from the vault

Specified by:
remove in interface CredentialVault

hasCredentials

public boolean hasCredentials(String endpointId)
Specified by:
hasCredentials in interface CredentialVault
Returns:
true if any credentials are stored for this endpoint id

getStoredIds

public String[] getStoredIds()
Description copied from interface: CredentialVault
Returns the ids for stored credentials

Specified by:
getStoredIds in interface CredentialVault
Returns:

newCredentials

public Credentials newCredentials(String endpointId)
Description copied from interface: CredentialVault
Creates new credentials which are stored in this vault

Specified by:
newCredentials in interface CredentialVault
Returns:
the credentials object

load

public boolean load()
Description copied from interface: CredentialVault
Tells the Credential Vault to load state from persisted store

Specified by:
load in interface CredentialVault
Returns:
whether the credential vault successfully loaded

save

public boolean save()
Description copied from interface: CredentialVault
Tells the Credential Vault to write state to persisted store

Specified by:
save in interface CredentialVault
Returns:
whether the credential vault successfully saved

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2009 SpringSource, Inc. All Rights Reserved.