Skip to content

AllowedScopes does not match string array in JWT scope claim #913

@fsmullinslc

Description

@fsmullinslc

Expected Behavior / New Feature

Expected AllowedScopes to parse scope claim and match one or more values in string array similar to RouteClaimsRequirement. For example JWT scope claim value has two scopes, space delimited by whitespace: Values.Read Values.Write

Actual Behavior / Motivation for New Feature

ScopesAuthoriser compares the entire claim value to the AllowedScopes array causing it to fail to match either scope. It looks like you addressed a similar issue in RouteClaimsRequirement. Is that the workaround for this issue? Or, can AllowedScopes be modified to use that behavior?

Steps to Reproduce the Problem

  1. Generate a JWT with "scp" claim containing two or more scopes delimited by whitespace
  2. Send JWT to Ocelot for route with a single AllowedScope
  3. Allowed scope is not matched even though the scope exists in the claim

Specifications

  • Version: Ocelot 13.5.0 and 19.0.2
  • Platform: .NET Core 2.2 and .NET 7

Metadata

Metadata

Assignees

Labels

AuthorizationOcelot feature: AuthorizationSummer'25Summer 2025 releasebugIdentified as a potential bugmergedIssue has been merged to dev and is waiting for the next releaseproposalProposal for a new functionality in Ocelot

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions