Package org.alfresco.repo.serviceaccount
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 Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidRetrieves the names of all service accounts.getServiceAccountRole(String serviceAccountName) Retrieves the role of a specific service account.voidRegisters a service account with its corresponding role.voidsetGlobalProperties(Properties globalProperties)
-
Field Details
-
KEY_PREFIX
- See Also:
-
-
Constructor Details
-
ServiceAccountRegistryImpl
public ServiceAccountRegistryImpl()
-
-
Method Details
-
setGlobalProperties
-
register
Description copied from interface:ServiceAccountRegistryRegisters a service account with its corresponding role.- Specified by:
registerin interfaceServiceAccountRegistry- Parameters:
serviceAccountName- The name of the service account to be registered.serviceAccountRole- The role of the service account to be registered.
-
getServiceAccountRole
Description copied from interface:ServiceAccountRegistryRetrieves the role of a specific service account.- Specified by:
getServiceAccountRolein interfaceServiceAccountRegistry- 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
Description copied from interface:ServiceAccountRegistryRetrieves the names of all service accounts.- Specified by:
getServiceAccountNamesin interfaceServiceAccountRegistry- Returns:
- A set of service account names. If no service accounts are present, an empty set is returned.
-
afterPropertiesSet
- Specified by:
afterPropertiesSetin interfaceorg.springframework.beans.factory.InitializingBean- Throws:
Exception
-