# Feature SI-207 - Synchronize group information based on claims in the OIDC userinfo

Project: Stream Integration Basics
Status: closed
URL: https://community.openproject.org/work_packages/SI-207

## Planning

| Attribute | Value |
| --- | --- |
| Date |  |
| Priority | Medium |
| Target versions | 16.4.0 |
| Votes |  |
| List |  |
| Roadmap |  |
| Relevance |  |

## OPEN POINTS / FEEDBACK

_No work packages_

## Use cases

_No work packages_

## Features and Chunks

_No work packages_

## Bugs and other work packages

| ID | Type | Subject | Status | Assignee | Target versions | Spent time | Module |
| --- | --- | --- | --- | --- | --- | --- | --- |
| SI-210 | Bug | User gets a 500 when updating the group mapping of a configured OIDC provider | closed |  | 16.4.0 |  | Authentication / OpenID Connect (OIDC) |

## Technical Details

| Attribute | Value |
| --- | --- |
| Module | Authentication / OpenID Connect (OIDC) |
| Feature Flag |  |
| Requires doc change | No |
| Enterprise plan | Enterprise / Professional (PRO) |

## Details

| Attribute | Value |
| --- | --- |
| Pull preview |  |
| Mockups | https://www.figma.com/design/RZn5wOqQlfNFREwHXf9dfX/OpenID-Connect--OIDC--Admin-Settings?node-id=280-7357&p=f&t=UVjOVZjlbYbknkfM-0 |
| Accessibility | No |

## People

| Attribute | Value |
| --- | --- |
| Assignee |  |
| Accountable |  |
| Product manager |  |
| Feature Lead |  |
| Developers | Jan Sandbrink |
| Designer | Parimal Satyal |
| Ordered by |  |
| Signed off by |  |
| Interest by |  |

## Estimates and progress

| Attribute | Value |
| --- | --- |
| PD (min) |  |
| PD (max) |  |
| Work |  |
| Labor costs |  |

## Description

**As** an OpenProject admin  
**I want** users' groups to be synchronized on OIDC login  
**so that** I can control their group memberships in my identity provider, especially when self-registering is desirable.

<br>

**Acceptance criteria**

  - The OpenID provider configuration allows enable group synchronization (cf. [OpenID Connect claims in OpenProject](https://www.openproject.org/docs/installation-and-operations/misc/custom-openid-connect-providers/#claims), [configuring group claims in okta](https://developer.okta.com/docs/guides/customize-tokens-groups-claim/main/#request-a-token-that-contains-the-custom-claim))

  - The configuration of an OpenID provider allows to configure how to process groups received from the identity provider
    
      - It should be possible to filter groups (i.e. select/reject certain groups based on their name)
    
      - It should be possible to select only a substring of the group name as the group name to be used
    
      - Example: for `urn:example.com:delegation:groups:my-group:subgroup` it should be possible to extract group name "my-group:subgroup"
    
      - Bonus: It should be possible to quickly evaluate in the UI how a group name would be matched by configured regular expressions

  - Administrators can later rename the created groups if desired

  - Visually separate local memberships in groups from the synced memberships (similar to LDAP group sync)

  - These groups and memberships can be deleted by an admin
    
      - This would be different from LDAP synchronized groups. Reasoning: The time between logins might be indefinite. We want to give admins control over removing certain permissions from groups and their members.

**Technical notes**

  - When group synchronization is enabled, the `groups` claim should be requested from the OIDC provider

  - The `groups` claim should be evaluated on login
    
      - synchronize groups from IdP to OpenProject
        
          - if group is not yet known, try to match by name, otherwise create them on-the-fly
    
      - assign user to groups passed in groups claim

  - Groups need to reference original OIDC claim name to be recognizable even after an admin renamed them

  - Group memberships need to include reference to OIDC sync, so that deletions of memberships through OIDC can work as well

**Implementation sketch**

  - Add mapping columns user - group - OIDC claim/provider

  - Implement group sync service triggered on login

  - Group filtering and automatic naming could be accomplished through a matching regex technically
