Class SecretsStoreConnector

All Implemented Interfaces:
AuditLoggingComponent, SecureConnectorExtension, VirtualConnectorExtension
Direct Known Subclasses:
YAMLSecretsStoreConnector

public abstract class SecretsStoreConnector extends ConnectorBase implements AuditLoggingComponent
SecretsStoreConnector is the interface for a connector that is able to retrieve secrets (passwords, certificates, ...) from a secure location. The secrets store connector is embedded in a connector that needs one or more secrets to perform its tasks. Both connectors are initialised together by the ConnectorBroker. The secrets store connector is called by the surrounding connector to extract the needed secrets. When the ConnectorBroker detects that there is a secrets store connector embedded in another connector, it attempts to retrieve the standard secrets for the corresponding connection object (if they are null):
  • userId
  • clearPassword
  • encryptedPassword
This means that even if the outer connector is written to expect these secrets in its connection object, they do not need to be stored in the connection object (ie in the configuration document or in the metadata store) but will be placed in the right fields by the ConnectorBroker. If the name(s) of the secret(s) needed by the connector must be configured, they can be stored in the secureProperties.
  • Field Details

    • secretsCollectionName

      protected String secretsCollectionName
  • Constructor Details

    • SecretsStoreConnector

      public SecretsStoreConnector()
  • Method Details

    • getConnectorComponentDescription

      public ComponentDescription getConnectorComponentDescription()
      Return the component description that is used by this connector in the audit log.
      Specified by:
      getConnectorComponentDescription in interface AuditLoggingComponent
      Returns:
      id, name, description, wiki page URL.
    • setAuditLog

      public void setAuditLog(AuditLog auditLog)
      Receive an audit log object that can be used to record audit log messages. The caller has initialized it with the correct component description and log destinations.
      Specified by:
      setAuditLog in interface AuditLoggingComponent
      Parameters:
      auditLog - audit log object
    • start

      Indicates that the connector is completely configured and can begin processing.
      Overrides:
      start in class ConnectorBase
      Throws:
      ConnectorCheckedException - the connector detected a problem.
      UserNotAuthorizedException - the connector was disconnected before/during start
    • isSecretsCollectionNameRequired

      protected boolean isSecretsCollectionNameRequired()
      Does this connector need the secretsCollectionName configuration property to start? A connector that works with a single collection does, which is the default. One that manages whole collections - and so is told which collection to use on each request - overrides this to return false.
      Returns:
      boolean
    • checkSecretsStillValid

      public void checkSecretsStillValid() throws ConnectorCheckedException
      Called by subclass to determine if the secrets should be refreshed
      Throws:
      ConnectorCheckedException
    • getSecretsCollectionName

      public String getSecretsCollectionName()
      Return the name of the configured secrets collection name.
      Returns:
      string name
    • getSecretsLocation

      public String getSecretsLocation()
      Return the location of the secrets store. (Endpoint network address.)
      Returns:
      string
    • getSecretsProvider

      public String getSecretsProvider()
      Return the class name of this connector's provider.
      Returns:
      string
    • refreshSecrets

      protected abstract void refreshSecrets() throws ConnectorCheckedException
      Request that the subclass refreshes its secrets.
      Throws:
      ConnectorCheckedException
    • saveSecrets

      protected abstract void saveSecrets() throws ConnectorCheckedException
      Request that the subclass saves its secrets.
      Throws:
      ConnectorCheckedException
    • resetRefreshTime

      protected void resetRefreshTime() throws ConnectorCheckedException
      Reset the next refresh time
      Throws:
      ConnectorCheckedException - problem with the store
    • getSecret

      public abstract String getSecret(String secretName) throws ConnectorCheckedException
      Retrieve a secret from the secrets store.
      Parameters:
      secretName - name of the secret.
      Returns:
      secret
      Throws:
      ConnectorCheckedException - a problem with the connector
    • getRefreshTimeInterval

      public abstract long getRefreshTimeInterval() throws ConnectorCheckedException
      Retrieve the refresh time from the secrets store.
      Returns:
      how long the secrets can be cached - 0 means indefinitely
      Throws:
      ConnectorCheckedException - a problem with the connector
    • isSecretsCollectionUpdateSupported

      public boolean isSecretsCollectionUpdateSupported()
      Return whether this connector can save and delete whole secrets collections - see saveSecretsCollection() and deleteSecretsCollection(). Most secrets stores are read-only to Egeria, so the default is false.
      Returns:
      boolean
    • saveSecretsCollection

      public void saveSecretsCollection(String collectionName, SecretsCollection newSecretsCollection) throws ConnectorCheckedException
      Create or replace a secrets collection in the secrets store. A connector that supports this overrides it, along with isSecretsCollectionUpdateSupported().
      Parameters:
      collectionName - name of the collection
      newSecretsCollection - the collection's contents
      Throws:
      ConnectorCheckedException - this connector does not support changes to its secrets collections, or there was a problem saving the collection
    • deleteSecretsCollection

      public void deleteSecretsCollection(String collectionName) throws ConnectorCheckedException
      Remove a secrets collection from the secrets store. A connector that supports this overrides it, along with isSecretsCollectionUpdateSupported().
      Parameters:
      collectionName - name of the collection
      Throws:
      ConnectorCheckedException - this connector does not support changes to its secrets collections, or there was a problem deleting the collection
    • getUser

      public UserAccount getUser(String userId) throws ConnectorCheckedException
      Retrieve the requested user definitions stored in the secrets collection.
      Parameters:
      userId - userId for the lookup
      Returns:
      associated user details or null
      Throws:
      ConnectorCheckedException - a problem with the connector
    • saveUser

      public void saveUser(String userId, UserAccount userAccount) throws ConnectorCheckedException
      Save the requested user definitions in the secrets collection.
      Parameters:
      userId - userId for the lookup
      userAccount - associated user details
      Throws:
      ConnectorCheckedException - a problem with the connector
    • deleteUser

      public void deleteUser(String userId) throws ConnectorCheckedException
      Delete the requested user definitions stored in the secrets collection.
      Parameters:
      userId - userId for the lookup
      Throws:
      ConnectorCheckedException - a problem with the connector
    • getUsers

      public Map<String,UserAccount> getUsers() throws ConnectorCheckedException
      Retrieve any user definitions stored in the secrets collection.
      Returns:
      map of userIds to user details
      Throws:
      ConnectorCheckedException - a problem with the connector
    • saveSecurityAccessControl

      public void saveSecurityAccessControl(String controlName, SecurityAccessControl securityAccessControl) throws ConnectorCheckedException
      Save the requested security access control in the secrets collection.
      Parameters:
      controlName - controlName for the lookup
      securityAccessControl - associated control details
      Throws:
      ConnectorCheckedException - a problem with the connector
    • deleteSecurityAccessControl

      public void deleteSecurityAccessControl(String controlName) throws ConnectorCheckedException
      Delete the requested security access control stored in the secrets collection.
      Parameters:
      controlName - control for the lookup
      Throws:
      ConnectorCheckedException - a problem with the connector
    • getNamedList

      public NamedList getNamedList(String listName) throws ConnectorCheckedException
      Look up a particular named list in the collection.
      Parameters:
      listName - name of a list
      Returns:
      corresponding named list or null
      Throws:
      ConnectorCheckedException - a problem with the connector
    • getNamedLists

      public Map<String,NamedList> getNamedLists() throws ConnectorCheckedException
      Return all the known named lists in this collection
      Returns:
      map of named lists in this collection
      Throws:
      ConnectorCheckedException - a problem with the connector
    • getSecurityAccessControl

      public SecurityAccessControl getSecurityAccessControl(String controlName) throws ConnectorCheckedException
      Look up a particular named security access control in the collection.
      Parameters:
      controlName - name of the control
      Returns:
      corresponding named control or null
      Throws:
      ConnectorCheckedException - a problem with the connector