Class KeyStoreManagementServiceImpl
java.lang.Object
de.xima.fc.certificate.mgmt.internal.KeyStoreManagementServiceImpl
- All Implemented Interfaces:
KeyStoreManagementService
@ApplicationScoped
public class KeyStoreManagementServiceImpl
extends Object
implements KeyStoreManagementService
- Since:
- 30.01.26
- Author:
- Norman Lorenz
-
Method Summary
Modifier and TypeMethodDescriptioncreateCustomKeyStore(NewKeyStoreDefinition newKeyStoreDefinition, CertificateManagementUser user) Creates a new custom keystore with the specified name, description, assignee type, and assignee ID.voiddeleteKeyStore(Long keyStoreId, CertificateManagementUser user) Deletes the keystore with the specified ID.voidexportKeyStore(Long keyStoreId, char[] password, OutputStream outputStream, CertificateManagementUser user) Exports the keystore with the specified ID to the provided output stream.findById(Long keyStoreId, CertificateManagementUser user) Retrieves the keystore with the specified ID.findByName(String name, KeyStoreScope scope, CertificateManagementUser user) Retrieves the keystore with the specified name in the given scope if it exists.findByUserId(Long userId, CertificateManagementUser user) Retrieves the keystore of the user with the specified ID.getAllByAssigneeType(Set<EAssigneeType> assigneeTypes, CertificateManagementUser user) Retrieves a list of all keystores assigned to the specified type of assignee.getAllByKeyStoreScopes(Set<KeyStoreScope> keyStoreScopes, CertificateManagementUser user) Retrieves a list of all keystores for the given scopes.getDefaultKeyStore(KeyStoreScope defaultScope, CertificateManagementUser user) Retrieves the default keystore for the specified scope.getKeyStoreListing(Long keyStoreId, CertificateManagementUser user) Retrieves a list of certificates stored in the specified keystore.
-
Method Details
-
createCustomKeyStore
public KeyStoreInfoDTO createCustomKeyStore(NewKeyStoreDefinition newKeyStoreDefinition, CertificateManagementUser user) throws FcCertificateManagementException Description copied from interface:KeyStoreManagementServiceCreates a new custom keystore with the specified name, description, assignee type, and assignee ID.- Specified by:
createCustomKeyStorein interfaceKeyStoreManagementService- Parameters:
newKeyStoreDefinition- the definition of the new keystore to be created, containing the name, description, and scope.user- the user who is creating the keystore.- Returns:
- a
KeyStoreInfoDTOobject containing information about the created keystore. - Throws:
FcCertificateManagementException- if the keystore already exists for the specified name and/or scope or if the user does not have permission to create it.
-
deleteKeyStore
public void deleteKeyStore(Long keyStoreId, CertificateManagementUser user) throws FcCertificateManagementException Description copied from interface:KeyStoreManagementServiceDeletes the keystore with the specified ID.- Specified by:
deleteKeyStorein interfaceKeyStoreManagementService- Parameters:
keyStoreId- the ID of the keystore to delete.user- the user who is deleting the keystore.- Throws:
FcCertificateManagementException- if the keystore does not exist, cannot be deleted, or if the user does not have permission to delete it.
-
exportKeyStore
public void exportKeyStore(Long keyStoreId, char[] password, OutputStream outputStream, CertificateManagementUser user) throws FcCertificateManagementException, IOException Description copied from interface:KeyStoreManagementServiceExports the keystore with the specified ID to the provided output stream.- Specified by:
exportKeyStorein interfaceKeyStoreManagementService- Parameters:
keyStoreId- the ID of the keystore to export.password- the password to use for the keystore.outputStream- the output stream to write the keystore data to.user- the user who is exporting the keystore.- Throws:
FcCertificateManagementException- if the keystore does not exist, cannot be exported, or if the user does not have permission to export it.IOException
-
findById
public Optional<KeyStoreInfoDTO> findById(Long keyStoreId, CertificateManagementUser user) throws FcCertificateManagementException Description copied from interface:KeyStoreManagementServiceRetrieves the keystore with the specified ID.- Specified by:
findByIdin interfaceKeyStoreManagementService- Parameters:
keyStoreId- the ID of the keystore to retrieve.user- the user who is requesting the keystore.- Returns:
- an
Optionalcontaining theKeyStoreInfoDTOobject with the specified ID. - Throws:
FcCertificateManagementException- if the user does not have permission to access the keystore.
-
findByName
public Optional<KeyStoreInfoDTO> findByName(String name, KeyStoreScope scope, CertificateManagementUser user) throws FcCertificateManagementException Description copied from interface:KeyStoreManagementServiceRetrieves the keystore with the specified name in the given scope if it exists.- Specified by:
findByNamein interfaceKeyStoreManagementService- Parameters:
name- the name of the keystore to retrieve.scope- the scope of the keystore to retrieve.user- the user who is requesting the keystore.- Returns:
- an
Optionalcontaining theKeyStoreInfoDTOobject with the specified name and scope if it exists. - Throws:
FcCertificateManagementException- if the user does not have permission to access the keystore.
-
findByUserId
public KeyStoreInfoDTO findByUserId(Long userId, CertificateManagementUser user) throws FcCertificateManagementException Description copied from interface:KeyStoreManagementServiceRetrieves the keystore of the user with the specified ID. There can only be one keystore per user, the default keystore. If the keystore does not exist, it will be created automatically.- Specified by:
findByUserIdin interfaceKeyStoreManagementService- Parameters:
userId- the ID of the user the keystore is assigned to.user- the user who is requesting the keystore.- Returns:
- a
KeyStoreInfoDTOobject containing information about the keystore. - Throws:
FcCertificateManagementException- if the user does not have permission to access the keystore.
-
getAllByAssigneeType
public Set<KeyStoreInfoDTO> getAllByAssigneeType(Set<EAssigneeType> assigneeTypes, CertificateManagementUser user) throws FcCertificateManagementException Description copied from interface:KeyStoreManagementServiceRetrieves a list of all keystores assigned to the specified type of assignee.- Specified by:
getAllByAssigneeTypein interfaceKeyStoreManagementService- Parameters:
assigneeTypes- the types of the assignee (e.g., user, group).user- the user who is requesting the keystores.- Returns:
- a set of
KeyStoreInfoDTOobjects containing information about the keystores assigned to the specified assignee if the user has permission to access them. - Throws:
FcCertificateManagementException- if an error occurs while retrieving the keystores.
-
getAllByKeyStoreScopes
public Set<KeyStoreInfoDTO> getAllByKeyStoreScopes(Set<KeyStoreScope> keyStoreScopes, CertificateManagementUser user) throws FcCertificateManagementException Description copied from interface:KeyStoreManagementServiceRetrieves a list of all keystores for the given scopes.Note: If the default keystore for a given scope does not exist, it will be created automatically and returned with the list of keystores.
- Specified by:
getAllByKeyStoreScopesin interfaceKeyStoreManagementService- Parameters:
keyStoreScopes- the scopes of the keystores to retrieve.user- the user who is requesting the keystores.- Returns:
- a set of
KeyStoreInfoDTOobjects containing information about the keystores for the specified scopes if the user has permission to access them. - Throws:
FcCertificateManagementException- if an error occurs while retrieving the keystores.
-
getDefaultKeyStore
public KeyStoreInfoDTO getDefaultKeyStore(KeyStoreScope defaultScope, CertificateManagementUser user) throws FcCertificateManagementException Description copied from interface:KeyStoreManagementServiceRetrieves the default keystore for the specified scope. If the default keystore does not exist, it will be created.Note: The default keystore is a special keystore that is automatically created for each scope. There can only be one default keystore per scope.
- Specified by:
getDefaultKeyStorein interfaceKeyStoreManagementService- Parameters:
defaultScope- the scope for which to retrieve the default keystore.user- the user who is requesting the default keystore.- Returns:
- a
KeyStoreInfoDTOobject containing information about the default keystore. - Throws:
FcCertificateManagementException- if the user does not have permission to access the keystore.
-
getKeyStoreListing
public Set<CertificateInfoDTO> getKeyStoreListing(Long keyStoreId, CertificateManagementUser user) throws FcCertificateManagementException Description copied from interface:KeyStoreManagementServiceRetrieves a list of certificates stored in the specified keystore.- Specified by:
getKeyStoreListingin interfaceKeyStoreManagementService- Parameters:
keyStoreId- the ID of the keystore.user- the user who is requesting the certificate listing.- Returns:
- a set of
CertificateInfoDTOobjects containing information about the certificates in the keystore if the user has permission to access them. - Throws:
FcCertificateManagementException
-