Skip to content

Allow custom claim parser during OIDC login procedure for teams resolution #3908

Closed

Description

@otbe

Current Behavior

Right now we can configure ALPINE_OIDC_TEAMS_CLAIM and specify the claim that carries the group/team association of a person that logs in. This currently only works if this claim is a list of strings.
Certain environments do not support this properly, for example if you connect an Azure AD to AWS Cognito and then sign in via OIDC into Dependency Track the original AD groups are mapped to a claim like "custom:groups", however Cognito only supports strings there. That means we end up with ID token claims like this

{
  "cognito:groups":["cognitoCreatedGroupForAllUsers"],
  "custom:groups: "[uuid1, uuid2, uuid3]"
}

I would like to be able to make use of our "custom:groups" claim to map it to DT teams at the end.

Proposed Behavior

I can imagine two ways of solving this.

  1. Create a way to allow users to inject custom claim parsers.
    If this would be a regular java library one could create an interface and let people register custom parsers for arbitrary fields. I have a hard time imagining how this could be achieved in the current docker based distribution.

  2. Create a special "relaxedGroupClaimParser" flag.
    This could be implemented in a way that

  • if its a list of strings then continue as before
  • if its a string then trim it, remove [], split it by ",", trim the result list (stuff like this)

Checklist

Activity

  1. added
    enhancement
    on Jul 1, 2024
  2. nscuro commented on Jul 2, 2024

    @nscuro
    Member

    Create a special "relaxedGroupClaimParser" flag.

    We could introduce a strategy flag for this. Such that users can switch between different strategies, and we can add more over time if required, without having to add new boolean flags for all of them.

    I do agree that custom parsers that are to be provided via custom JARs are unnecessary and too unwieldy here.

  3. added
    p2
    size/S
    on Jul 2, 2024
  4. added
    good first issue
    on Jul 5, 2024
  5. added
    hacktoberfest
    on Sep 26, 2024
  6. Akhil-1527 commented on Sep 27, 2026

    @Akhil-1527
    Contributor

    The comma-separated case works on main now (here), but the format from this report still doesn't parse. "[uuid1, uuid2, uuid3]" gets split into [uuid1, uuid2 and uuid3], so the first and last teams never match.

    I'd like to pick this up. My plan is to strip a leading [ and trailing ] from string claims before splitting, and add a test for the bracketed form. That keeps the current auto-detection instead of adding a strategy flag. Does that sound OK?

  7. added this to the 5.2 milestone on Sep 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementgood first issuehacktoberfestp2size/S

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions