Ocelot icon indicating copy to clipboard operation
Ocelot copied to clipboard

Alternate array syntax to resolve : issue in key names for RouteClaimsRequirement option in configuration

Open ghorsey opened this issue 4 years ago • 3 comments

New Feature

Add an alternate syntax to the RouteClaimsRequirement configuration. Instead of the current shorter (and nicer) current syntax of:

"RouteClaimsRequirement": {
  "{ClaimType}": "{ClaimValue}"
}

Support a more verbose array syntax as well:

"RouteClaimsRequirement": [
  {
    "type": "{ClaimType}",
    "value": "{ClaimValue}"
  }
]

Motivation for New Feature

Microsoft uses a : to signify hierarchy in configuration files. See https://github.com/dotnet/extensions/issues/782

There is a great workaround on issue 679 that would be unnecessary if an alternate syntax could be used without the : in a key value.

The most common/reported issue is with the default MS role claim type http://schemas.microsoft.com/ws/2008/06/identity/claims/role

Currently this does not work and requires a workaround:

"RouteClaimsRequirement": {
  "http://schemas.microsoft.com/ws/2008/06/identity/claims/role": "Administrator"
}

Having an alternate syntax would fix this and "just work":

"RouteClaimsRequirement": [
  {
    "type": "http://schemas.microsoft.com/ws/2008/06/identity/claims/role",
    "value": "Administrator"
  }
]

ghorsey avatar Aug 03 '20 22:08 ghorsey

Don't implemented?

ShvetsovAU avatar Jun 17 '21 13:06 ShvetsovAU

I'm having the same problem and was about to suggest the same feature.

olssonp avatar Jun 30 '22 06:06 olssonp

@ghorsey Hi Geoff! Will you personally contribute and be responsible for feature delivery?

raman-m avatar Mar 27 '24 12:03 raman-m