Skip to main content
Version: 3.20

Status: Work In Progress
This documentation page is currently being drafted and may be updated frequently.

Keycloak Authentication Integration in Phrasea

Status: Work In Progress
This documentation page is currently being drafted and may be updated frequently.

Overview

Phrasea relies on Keycloak with OpenID Connect for authentication management across its various services. During installation, a dedicated realm named Phrasea is created, containing individual clients for each Phrasea services.

Authentication and Authorization

  • Keycloak supports user authentication via standard protocols like OAuth2, OpenID Connect, and SAML. This facilitates integration with web, mobile applications, and APIs.
  • Keycloak allows role-based authorization management, offering granular user permission management, which can be aligned with roles defined in the Phrasea database (administrators, editors, viewers, etc.).

User and Group Management

  • Keycloak manages users and groups, allowing segmentation based on needs. Each user can be assigned to one or more groups, and permissions can be attributed to these groups.
  • User information (such as email addresses, usernames, and roles) can be synchronized with Phrasea, ensuring a smooth and centralized user experience.

Single Sign-On (SSO)

  • Keycloak provides SSO, allowing users to log in once to access all Phrasea-related applications, both internal and external. This improves user experience and simplifies session management.
  • User sessions can be managed centrally, and Keycloak also allows session revocation if needed (e.g., when a user leaves the organization).

Federation and Integration with External IdPs

  • Keycloak can connect to external identity providers (IdP) such as Microsoft Active Directory, or other SAML and OpenID Connect compatible providers. This allows using existing identities without creating new accounts for Phrasea.
  • Federation simplifies authentication for organizations already using other IAM systems.

Advanced Security Features

  • Multi-factor authentication (MFA): Keycloak supports two-factor authentication, enhancing security by requiring a second verification (such as a mobile app or token).
  • Session and token management: Keycloak allows configuring session and token lifetimes and can force token revocation in case of compromise.
  • Audit and Logs: Keycloak provides logging capabilities to track logins, authentication failures, and other security events, which is essential for compliance requirements.

Configuration

  • When deploying the stack, Phrasea runs a configurator that sets up a realm and clients dedicated to this installation. These clients are used by the various Phrasea services.
  • A root Keycloak account and a master admin account for the application are also initialized.
  • Interconnections with the client's IdP are declared manually at a later stage.
  • Phrasea can be configured with OAuth2 or OpenID Connect for user authentication, centralizing identity management and facilitating integration with third-party providers.

Roles and Scopes

You can start by reading this explanation of the difference between Scopes and Roles here.

Roles

Roles in Phrasea are used to define sets of permissions that can be assigned to users or service accounts. These roles are configured within the Phrasea realm in Keycloak and are referenced throughout the application to control access to specific features and modules.

  • Application Roles:
    Application roles are mapped to the different modules and functionalities within Phrasea. For example, roles may include admin, editor, viewer, or more granular roles specific to certain modules.
  • Role Assignment:
    Roles are assigned to users or clients during provisioning, either manually via the Keycloak admin console or automatically through migration scripts and configuration commands (see files in src/Configurator/Vendor/Keycloak/ and migration logic in src/Configurator/Vendor/Keycloak/Migrations/).

Scopes

Scopes in Phrasea are used to further restrict or define the context in which roles and permissions apply. Scopes are typically associated with OAuth2 and OpenID Connect flows, allowing clients to request specific levels of access.

  • Custom Scopes:
    Custom scopes can be defined for each client in the Phrasea realm, enabling fine-grained control over what data and actions are accessible during authentication and authorization.
  • Usage in Clients:
    Each client (representing a Phrasea service) can request specific scopes during authentication, ensuring that only the necessary permissions are granted for its operation.

Common Scopes

common scope to all service

ScopeDescription
acrOpenID Connect scope for add acr (authentication context class reference) to the token
addressOpenID Connect built-in scope: address
basicOpenID Connect scope for add all basic claims to the token
emailOpenID Connect built-in scope: email
microprofile-jwtMicroprofile - JWT built-in scope
offline_accessOpenID Connect built-in scope: offline_access
openid
phoneOpenID Connect built-in scope: phone
profileOpenID Connect built-in scope: profile
rolesOpenID Connect scope for add user roles to the access token
service_accountSpecific scope for a client enabled for service accounts
web-originsOpenID Connect scope for add allowed web origins to the access token

Databox Scopes

ScopeDescription
asset-data-template:createasset-data-template:create in Databox
asset-data-template:deleteasset-data-template:delete in Databox
asset-data-template:editasset-data-template:edit in Databox
asset-data-template:listasset-data-template:list in Databox
asset-data-template:operatorasset-data-template:operator in Databox
asset-data-template:ownerasset-data-template:owner in Databox
asset-data-template:readasset-data-template:read in Databox
asset:createasset:create in Databox
asset:deleteasset:delete in Databox
asset:editasset:edit in Databox
asset:listasset:list in Databox
asset:operatorasset:operator in Databox
asset:ownerasset:owner in Databox
asset:readasset:read in Databox
attribute-definition:createattribute-definition:create in Databox
attribute-definition:deleteattribute-definition:delete in Databox
attribute-definition:editattribute-definition:edit in Databox
attribute-definition:listattribute-definition:list in Databox
attribute-definition:operatorattribute-definition:operator in Databox
attribute-definition:ownerattribute-definition:owner in Databox
attribute-definition:readattribute-definition:read in Databox
attribute-entity:createattribute-entity:create in Databox
attribute-entity:deleteattribute-entity:delete in Databox
attribute-entity:editattribute-entity:edit in Databox
attribute-entity:listattribute-entity:list in Databox
attribute-entity:operatorattribute-entity:operator in Databox
attribute-entity:ownerattribute-entity:owner in Databox
attribute-entity:readattribute-entity:read in Databox
attribute-list:createattribute-list:create in Databox
attribute-list:deleteattribute-list:delete in Databox
attribute-list:editattribute-list:edit in Databox
attribute-list:listattribute-list:list in Databox
attribute-list:operatorattribute-list:operator in Databox
attribute-list:ownerattribute-list:owner in Databox
attribute-list:readattribute-list:read in Databox
attribute-policy:createattribute-policy:create in Databox
attribute-policy:deleteattribute-policy:delete in Databox
attribute-policy:editattribute-policy:edit in Databox
attribute-policy:listattribute-policy:list in Databox
attribute-policy:operatorattribute-policy:operator in Databox
attribute-policy:ownerattribute-policy:owner in Databox
attribute-policy:readattribute-policy:read in Databox
basket:createbasket:create in Databox
basket:deletebasket:delete in Databox
basket:editbasket:edit in Databox
basket:listbasket:list in Databox
basket:operatorbasket:operator in Databox
basket:ownerbasket:owner in Databox
basket:readbasket:read in Databox
collection:createcollection:create in Databox
collection:deletecollection:delete in Databox
collection:editcollection:edit in Databox
collection:listcollection:list in Databox
collection:operatorcollection:operator in Databox
collection:ownercollection:owner in Databox
collection:readcollection:read in Databox
emailOpenID Connect built-in scope: email
entity-list:createentity-list:create in Databox
entity-list:deleteentity-list:delete in Databox
entity-list:editentity-list:edit in Databox
entity-list:listentity-list:list in Databox
entity-list:operatorentity-list:operator in Databox
entity-list:ownerentity-list:owner in Databox
entity-list:readentity-list:read in Databox
integration:createintegration:create in Databox
integration:deleteintegration:delete in Databox
integration:editintegration:edit in Databox
integration:listintegration:list in Databox
integration:operatorintegration:operator in Databox
integration:ownerintegration:owner in Databox
integration:readintegration:read in Databox
rendition-definition:createrendition-definition:create in Databox
rendition-definition:deleterendition-definition:delete in Databox
rendition-definition:editrendition-definition:edit in Databox
rendition-definition:listrendition-definition:list in Databox
rendition-definition:operatorrendition-definition:operator in Databox
rendition-definition:ownerrendition-definition:owner in Databox
rendition-definition:readrendition-definition:read in Databox
rendition-policy:createrendition-policy:create in Databox
rendition-policy:deleterendition-policy:delete in Databox
rendition-policy:editrendition-policy:edit in Databox
rendition-policy:listrendition-policy:list in Databox
rendition-policy:operatorrendition-policy:operator in Databox
rendition-policy:ownerrendition-policy:owner in Databox
rendition-policy:readrendition-policy:read in Databox
rendition-rule:createrendition-rule:create in Databox
rendition-rule:deleterendition-rule:delete in Databox
rendition-rule:editrendition-rule:edit in Databox
rendition-rule:listrendition-rule:list in Databox
rendition-rule:operatorrendition-rule:operator in Databox
rendition-rule:ownerrendition-rule:owner in Databox
rendition-rule:readrendition-rule:read in Databox
rendition:createrendition:create in Databox
rendition:deleterendition:delete in Databox
rendition:editrendition:edit in Databox
rendition:listrendition:list in Databox
rendition:operatorrendition:operator in Databox
rendition:ownerrendition:owner in Databox
rendition:readrendition:read in Databox
workspace:createworkspace:create in Databox
workspace:deleteworkspace:delete in Databox
workspace:editworkspace:edit in Databox
workspace:listworkspace:list in Databox
workspace:operatorworkspace:operator in Databox
workspace:ownerworkspace:owner in Databox
workspace:readworkspace:read in Databox

Expose Scopes

ScopeDescription
publishpublish in Expose

Uploader Scopes

ScopeDescription
commit:listcommit:list in Uploader

Implementation Details

  • Environment Variables:
    The integration may rely on environment variables for Keycloak endpoints, client secrets, and realm configuration documentation generator.

References