Skip to content

Partial claim verification #212

@sirzooro

Description

@sirzooro

Describe the impediment
RedHat SSO allows configuration of roles for given service. When service gets its JWT token from SSO, it contains following claim with these roles:

"resource_access": {
   "my-service": {
     "roles": [
       "foo",
       "bar",
       "baz"
     ]
   }
 },

Trying to obtain
I need to verify that service called "my-service" has role "bar", and ignore any other roles present in this claim. I found example where custom claim value is checked against JSON object, but this is not exactly my case - I need to check for this JSON structure ("resource_access", "my-service", "roles" elements) and verify that roles array contains proper element. Is there a way to do this using .with_claim("resource_access", ...)? Or do I have to use verifier.verify() first, and then manually extract and verify this claim piece by piece?

Desktop:

  • OS: RedHat 8
  • Compiler g++ 10.3.1
  • Version jwt-cpp v0.6.0

Metadata

Metadata

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions