Skip to content

Option to merge roles rather than overwrite #3

@brendanarnold

Description

@brendanarnold

Setting resource_access.my_client_name.roles as the Token Claim Name results in the other roles for other clients being overwritten - it would be good to have an option to merge the objects rather than overwrite.

As an example, here is the JWT without the external-claim-mapper plugin, you can see there are roles for the account client...

{
  // ... start of token
  "resource_access": {
    "account": {
      "roles": [
        "manage-account",
        "manage-account-links",
        "view-profile"
      ]
    }
  },
  // ... rest of token
}

After enabling external-claim-mapper with Token Claim Name set to resource_access.my_client_name.roles you can see that the roles for account are overwritten and so lost.

{
  // ... start of token
  "resource_access": {
    "my_client_name": {
      "roles": [
        "admin:1"
      ]
    }
  },
  // ... rest of token
}

There might be a use case for completely overwriting the roles so this might not be default behaviour but it should probably be an option?

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions