-
Notifications
You must be signed in to change notification settings - Fork 2
feat(): DSPX-49 Info for Claims and Keycloak ERSs #97
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,4 +21,6 @@ assertation | |
| JavaScript | ||
| Autoconfigure | ||
| requester(?('s)) | ||
| rewrap(?(s)) | ||
| rewrap(?(s)) | ||
| Keycloak | ||
| ERS | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -192,3 +192,153 @@ | |
| ``` | ||
|
|
||
| In the above example, each entity in the request is resolved into its corresponding entity data. | ||
|
|
||
| ## Built-In Entity Resolution Services | ||
|
|
||
| The platform includes two built-in Entity Resolution Services (ERS): **Keycloak ERS** and **Claims ERS**. These services provide flexibility for different use cases and IdP configurations. | ||
|
Check failure on line 198 in docs/components/entity_resolution.md
|
||
elizabethhealy marked this conversation as resolved.
Show resolved
Hide resolved
elizabethhealy marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| ### Keycloak Entity Resolution Service | ||
|
Check failure on line 200 in docs/components/entity_resolution.md
|
||
elizabethhealy marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| The **Keycloak ERS** is tightly integrated with Keycloak, a popular open-source identity and access management solution. It retrieves entity information directly from Keycloak's APIs and is ideal for environments where Keycloak is the primary IdP. | ||
|
Check failure on line 201 in docs/components/entity_resolution.md
|
||
elizabethhealy marked this conversation as resolved.
Show resolved
Hide resolved
elizabethhealy marked this conversation as resolved.
Show resolved
Hide resolved
elizabethhealy marked this conversation as resolved.
Show resolved
Hide resolved
elizabethhealy marked this conversation as resolved.
Show resolved
Hide resolved
elizabethhealy marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| #### Key Features: | ||
| - Direct integration with Keycloak's identity management system. | ||
elizabethhealy marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| - Supports resolving entities using Keycloak-specific attributes and roles. | ||
elizabethhealy marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| - Leverages Keycloak's APIs for detailed entity information. | ||
elizabethhealy marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| #### Behavior of `CreateEntityChainFromJwt` | ||
elizabethhealy marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| The **Keycloak ERS** processes each JWT by interacting with Keycloak's APIs to extract entity information. The behavior includes: | ||
elizabethhealy marked this conversation as resolved.
Show resolved
Hide resolved
elizabethhealy marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| - Parsing the JWT to extract claims such as `client_id` and `username`. | ||
| - Categorizing entities as either `CATEGORY_SUBJECT` (e.g., users) or `CATEGORY_ENVIRONMENT` (e.g., clients or service accounts). | ||
| - Constructing an entity chain for each token, where each chain contains the extracted entities and their associated metadata. | ||
|
|
||
| For example: | ||
| - A token with a `client_id` claim is resolved into a chain with the client as the environment entity and the client service account as the subject entity. | ||
| - A token with a `username` claim is resolved into a chain with the user as the subject entity and the client as the environment entity. | ||
|
|
||
| #### Behavior of `ResolveEntities` | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [LanguageTool] reported by reviewdog 🐶 |
||
| The **Keycloak ERS** resolves entities by querying Keycloak's APIs based on the provided entity identifiers (e.g., `email`, `username`, or `client_id`). The behavior includes: | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [LanguageTool] reported by reviewdog 🐶
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [LanguageTool] reported by reviewdog 🐶 |
||
| - Looking up users or clients in Keycloak using the provided identifiers. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [LanguageTool] reported by reviewdog 🐶 |
||
| - Returning detailed entity representations, including attributes such as roles, permissions, and metadata. | ||
|
|
||
| For example: | ||
| - An entity with an `email` identifier is resolved into a user entity with detailed attributes. | ||
| - An entity with a `client_id` identifier is resolved into a client entity with its associated permissions. | ||
|
|
||
| ### Claims Entity Resolution Service | ||
| The **Claims ERS** is a more flexible service that resolves entities based on claims embedded in tokens (e.g., JWTs). It is designed for environments where tokens come from multiple sources or where Keycloak is not used. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [LanguageTool] reported by reviewdog 🐶 |
||
|
|
||
| #### Key Features: | ||
| - Processes claims-based tokens to extract and resolve entities. | ||
| - Supports custom token formats and claims structures. | ||
| - Does not require Keycloak as a dependency. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [LanguageTool] reported by reviewdog 🐶 |
||
|
|
||
| #### Behavior of `CreateEntityChainFromJwt` | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [LanguageTool] reported by reviewdog 🐶 |
||
| The **Claims ERS** processes each JWT by extracting claims directly from the token without relying on an external IdP. The behavior includes: | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [LanguageTool] reported by reviewdog 🐶 |
||
| - Parsing the JWT to extract claims. | ||
| - Wrapping the claims in a structured format (e.g., `structpb.Struct`) for further processing. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [LanguageTool] reported by reviewdog 🐶 |
||
| - Categorizing all produced entities as `CATEGORY_SUBJECT`. | ||
| - Constructing an entity chain for each token, where each chain contains a single entity of type `claims` with the claims of that token. | ||
|
|
||
|
|
||
| #### Behavior of `ResolveEntities` | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [LanguageTool] reported by reviewdog 🐶 |
||
| The **Claims ERS** resolves entities by processing the claims embedded in the provided entities. The behavior includes: | ||
| - Extracting claims from the entity's `claims` field. | ||
| - Converting the claims into a structured format for further processing. | ||
| - Returning detailed entity representations, including the extracted claims as additional properties. | ||
|
|
||
| For example: | ||
| - An entity with a `claims` field containing `roles` and `department` is resolved into a subject entity with those attributes. | ||
| - An entity with a `claims` field containing custom attributes is resolved into a subject entity with those custom attributes. | ||
|
|
||
| ### Comparison: Keycloak ERS vs. Claims ERS | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [LanguageTool] reported by reviewdog 🐶 |
||
|
|
||
| | Feature | Keycloak ERS | Claims ERS | | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [LanguageTool] reported by reviewdog 🐶 |
||
| |--------------------------------|-----------------------------------------------|---------------------------------------------| | ||
| | **Primary Use Case** | Keycloak-based identity resolution. | Claims-based token resolution. | | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [LanguageTool] reported by reviewdog 🐶 |
||
| | **Integration** | Tightly coupled with Keycloak. | Works with any token format containing claims. | | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [LanguageTool] reported by reviewdog 🐶 |
||
| | **Customization** | Limited to Keycloak's identity model. | Highly customizable for different token formats. | | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [LanguageTool] reported by reviewdog 🐶 |
||
| | **Dependency** | Requires Keycloak as the IdP. | No external dependency on Keycloak. | | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [LanguageTool] reported by reviewdog 🐶
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [LanguageTool] reported by reviewdog 🐶
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [LanguageTool] reported by reviewdog 🐶 |
||
|
|
||
| --- | ||
|
|
||
| ## Selecting an Entity Resolution Service | ||
|
|
||
| You can configure which ERS to use by updating the platform's configuration file (e.g., `config.yaml`). | ||
| ```yaml | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [LanguageTool] reported by reviewdog 🐶 |
||
| services: | ||
| entityresolution: | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [LanguageTool] reported by reviewdog 🐶 |
||
| mode: "claims" # Options: "keycloak", "claims" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [LanguageTool] reported by reviewdog 🐶 |
||
| ``` | ||
|
|
||
| ### Default Behavior: | ||
| If no ERS is specified, the platform defaults to the Keycloak ERS. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [LanguageTool] reported by reviewdog 🐶 |
||
|
|
||
| By configuring the appropriate ERS, you can tailor the platform to your specific IdP and token requirements. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [LanguageTool] reported by reviewdog 🐶 |
||
|
|
||
| ## Examples | ||
|
|
||
| ### Claims Entity Resolution Service with Token and Subject Mapping | ||
|
|
||
| This example demonstrates how the **Claims Entity Resolution Service (ERS)** processes a token to resolve claims into entities and maps a specific claim value to an attribute using a subject mapping. | ||
|
|
||
| #### Scenario | ||
|
|
||
| A user has a token with the following claims: | ||
| ```json | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [LanguageTool] reported by reviewdog 🐶 |
||
| { | ||
| "sub": "user123", | ||
| "roles": ["developer", "admin"], | ||
| "department": "engineering" | ||
| } | ||
| ``` | ||
| We want to map the `department` claim `"engineering"` to an attribute that grants access to a specific resource. | ||
|
|
||
| #### Step 1: Token Processing by Claims ERS | ||
| The **Claims ERS** processes the token to extract claims and resolve them into entities. The getEntitiesFromToken function in the Claims ERS converts the token into an entity representation. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [LanguageTool] reported by reviewdog 🐶 |
||
|
|
||
| ##### Resolved entity: | ||
| ```json | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [LanguageTool] reported by reviewdog 🐶 |
||
| { | ||
| "id": "jwtentity-claims", | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [LanguageTool] reported by reviewdog 🐶 |
||
| "category": "CATEGORY_SUBJECT", | ||
| "additional_props": [ | ||
| { | ||
| "department": "engineering", | ||
| "roles": ["developer", "admin"] | ||
| } | ||
| ] | ||
| } | ||
| ``` | ||
|
|
||
| #### Step 2: Subject Mapping Configuration | ||
| The subject mapping defines how the `department` claim is mapped to an attribute. For example: | ||
| ```yaml | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [LanguageTool] reported by reviewdog 🐶 |
||
| subject_mappings: | ||
| - attribute_value_id: "74babca6-016f-4f3e-a99b-4e46ea8d0fd8" # ID of the attribute value | ||
| subject_condition_set: | ||
| conditions: | ||
| - key: "department" | ||
| operator: "SUBJECT_MAPPING_OPERATOR_ENUM_IN" | ||
| values: | ||
| - "engineering" | ||
| ``` | ||
| This configuration specifies: | ||
|
|
||
| - The `department` claim must have the value `"engineering"`. | ||
| - If the condition is met, the user is granted the attribute with ID `74babca6-016f-4f3e-a99b-4e46ea8d0fd8`. | ||
|
|
||
| #### Step 3: Subject Mapping Evaluation | ||
| The resolved entity is evaluated against the subject mapping. The `department` claim matches the condition `"engineering"`, so the mapping is applied. | ||
|
|
||
| Evaluation Logic: | ||
|
|
||
| 1. The `department` claim is extracted from the resolved entity. | ||
| 2. The value `"engineering"` is checked against the subject mapping condition. | ||
| 3. Since the condition is satisfied, the attribute value (`74babca6-016f-4f3e-a99b-4e46ea8d0fd8`) is granted. | ||
|
|
||
| #### Step 4: Result | ||
| The user is granted an entitlement to the attribute value corresponding to `74babca6-016f-4f3e-a99b-4e46ea8d0fd8`. Ex: `https://example.com/attr/department/value/engineering` | ||
|
|
||
|
|
||
| #### Summary | ||
| This example illustrates how the **Claims ERS** processes a token, resolves claims into entities, and evaluates subject mappings to grant entitlements. By defining subject mappings, administrators can enforce fine-grained access control based on token claims. | ||
Uh oh!
There was an error while loading. Please reload this page.