Package org.trustdeck.service
Class ProjectOIDCService
java.lang.Object
org.trustdeck.service.ProjectOIDCService
This class is responsible for handling OIDC (OpenID Connect) related operations for project-level interactions
within the application. E.g. for rights and roles management in Keycloak.
- Author:
- Eric Wündisch and Armin Müller
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected CachingServiceCaching service to improve performance by caching frequently used OIDC data.protected JwtPropertiesJWT configuration properties, handling token attributes like expiration and signing.protected RoleConfigRole configuration to manage role-based access control and authorization in the project. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncanBeUsedAsProjectGroup(String projectName) Checks if a project name can be used as a group name within the Keycloak realm.voidcreateProjectGroupsAndRolesAndJoin(String projectName, String userId) Creates a new set of project-related groups and roles, and assigns them to a user.voidRemoves all role-groups from Keycloak except the basic, non-project-specific roles by first removing all users from the group and then removing the group from Keycloak.voidRemoves all non-operation roles for all users.voidleaveAndDeleteProjectGroupsAndRoles(String projectName) Removes all users from groups containing this project name and deletes the groups.voidupdateProjectGroups(String oldProjectName, String newProjectName, String userId) Updates the name of project-related groups and roles within the Keycloak server.
-
Field Details
-
jwtProperties
JWT configuration properties, handling token attributes like expiration and signing. -
roleConfig
Role configuration to manage role-based access control and authorization in the project. -
cachingService
Caching service to improve performance by caching frequently used OIDC data.
-
-
Constructor Details
-
ProjectOIDCService
public ProjectOIDCService()
-
-
Method Details
-
createProjectGroupsAndRolesAndJoin
Creates a new set of project-related groups and roles, and assigns them to a user.- Parameters:
projectName- the name of the project to be createduserId- the unique identifier of the user to be added to the groups
-
leaveAndDeleteProjectGroupsAndRoles
Removes all users from groups containing this project name and deletes the groups. Updates the cache entries for the affected users. Additionally, the role for this projectName is removed from all users and then deleted.- Parameters:
projectName- the name of the project that should be purged from Keycloak
-
deleteAllProjectGroups
public void deleteAllProjectGroups()Removes all role-groups from Keycloak except the basic, non-project-specific roles by first removing all users from the group and then removing the group from Keycloak. Initiates a cache update on the removed users. The audit trail user type names are also kept as groups. -
deleteAllProjectRoles
public void deleteAllProjectRoles()Removes all non-operation roles for all users. Deletes the roles from Keycloak. -
updateProjectGroups
Updates the name of project-related groups and roles within the Keycloak server.- Parameters:
oldProjectName- the name of the project to be updatednewProjectName- the new name to be assigned to the project-related roles and groups
-
canBeUsedAsProjectGroup
Checks if a project name can be used as a group name within the Keycloak realm. This method iterates through all role-groups and checks if any sub-group with the specified project name already exists. If a matching group is found, it returnsfalse, indicating that the project name is already in use.- Parameters:
projectName- the project name to be checked- Returns:
trueif the project name is not in use, orfalseif a group with this name already exists
-