Skip to content

[BUG] Support roles in a nested claim within JWT #5343

Closed
@cwperks

Description

@cwperks

What is the bug?

While uncommon, its possible for JWT claims to contain nested objects. i.e.

{
    "sub": "craig",
    "attributes": {
        "roles": "roleA,roleB"
    }
}

With JWT auth, its not possible to configure any JWT-backed auth backend to extract the backend roles from such a structure. When configuring the rolesKey on any JWT-backed auth backend, it assumes that the roles are a top-level claim of the JWT payload.

Additional Context:

All JWT-backend auth backend extend the AbstractHttpJwtAuthenticator which has an extractRoles method.

This backend assumes that the roles are either comma-separated string or an array of strings.

The rolesKey could be abstracted to support nesting.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueThese are recommended starting points for newcomers looking to make their first contributions.triagedIssues labeled as 'Triaged' have been reviewed and are deemed actionable.v3.1.0Issues targeting release v3.1.0

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions