Class SimpleCredentialVault

  • All Implemented Interfaces:
    java.io.Serializable, CredentialVault

    public class SimpleCredentialVault
    extends java.lang.Object
    implements CredentialVault, java.io.Serializable
    A simple implementation of a credential vault.

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

    See Also:
    Serialized Form
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String[] getStoredIds()
      Returns the ids for stored credentials
      boolean hasCredentials​(java.lang.String endpointId)  
      Credentials newCredentials​(java.lang.String endpointId)
      Creates new credentials which are stored in this vault
      void remove​(java.lang.String endpointId)
      Removes credentials for a given endpoint id from the vault
      Credentials retrieve​(java.lang.String endpointId)
      Retrieves credentials for a given endpoint id from the vault
      void store​(Credentials credentials)
      Places the given credentials into the vault
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • id

        protected final java.lang.String id
      • credentialsMap

        protected final java.util.Map<java.lang.String,​Credentials> credentialsMap
    • Constructor Detail

      • SimpleCredentialVault

        public SimpleCredentialVault​(java.lang.String id,
                                     RemoteConfigElement remote)
        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​(java.lang.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​(java.lang.String endpointId)
        Description copied from interface: CredentialVault
        Removes credentials for a given endpoint id from the vault
        Specified by:
        remove in interface CredentialVault
        Parameters:
        endpointId - String
      • hasCredentials

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

        public java.lang.String[] getStoredIds()
        Description copied from interface: CredentialVault
        Returns the ids for stored credentials
        Specified by:
        getStoredIds in interface CredentialVault
        Returns:
        String[]
      • newCredentials

        public Credentials newCredentials​(java.lang.String endpointId)
        Description copied from interface: CredentialVault
        Creates new credentials which are stored in this vault
        Specified by:
        newCredentials in interface CredentialVault
        Parameters:
        endpointId - String
        Returns:
        the credentials object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object