Class ServiceAccountRegistryImpl

java.lang.Object
org.alfresco.repo.serviceaccount.ServiceAccountRegistryImpl
All Implemented Interfaces:
ServiceAccountRegistry, org.springframework.beans.factory.InitializingBean

public class ServiceAccountRegistryImpl extends Object implements ServiceAccountRegistry, org.springframework.beans.factory.InitializingBean
Processes the alfresco-global properties file and applies a naming convention to distinguish the service account's name and role.

The naming convention adheres to the following format:

   
     serviceaccount.role.<service-account-name>=<service-account-role>
   
 

Please note, any property with an invalid role value will be disregarded and the corresponding service account will not be registered.

For instance, to register a service account named 'custom-app-sa' with the 'Editor' role (which allows it to update node properties), the following should be defined in the alfresco-global properties file:

  • serviceaccount.role.custom-app-sa=EDITOR_SERVICE_ACCOUNT
  • or
  • serviceaccount.role.custom-app-sa=ROLE_EDITOR_SERVICE_ACCOUNT
Author:
Jamal Kaabi-Mofrad
  • Field Details

  • Constructor Details

    • ServiceAccountRegistryImpl

      public ServiceAccountRegistryImpl()
  • Method Details

    • setGlobalProperties

      public void setGlobalProperties(Properties globalProperties)
    • register

      public void register(String serviceAccountName, String serviceAccountRole)
      Description copied from interface: ServiceAccountRegistry
      Registers a service account with its corresponding role.
      Specified by:
      register in interface ServiceAccountRegistry
      Parameters:
      serviceAccountName - The name of the service account to be registered.
      serviceAccountRole - The role of the service account to be registered.
    • getServiceAccountRole

      public Optional<String> getServiceAccountRole(String serviceAccountName)
      Description copied from interface: ServiceAccountRegistry
      Retrieves the role of a specific service account.
      Specified by:
      getServiceAccountRole in interface ServiceAccountRegistry
      Parameters:
      serviceAccountName - The name of the service account.
      Returns:
      An Optional containing the role of the service account if it exists, otherwise an empty Optional.
    • getServiceAccountNames

      public Set<String> getServiceAccountNames()
      Description copied from interface: ServiceAccountRegistry
      Retrieves the names of all service accounts.
      Specified by:
      getServiceAccountNames in interface ServiceAccountRegistry
      Returns:
      A set of service account names. If no service accounts are present, an empty set is returned.
    • afterPropertiesSet

      public void afterPropertiesSet() throws Exception
      Specified by:
      afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
      Throws:
      Exception