scottctr
scottctr

Reputation: 803

What is the simplest way to get Asp.Net Core 6 to recognize JWT scp claims as roles?

We're using Okta as our authorization server and we're using scopes as roles for our web APIs. Okta provides the scopes as scp claims, but we need .Net to view the scopes as roles. I can add a custom claim in Okta that duplicates those scp claims as role claims and all works as expected.

Unfortunately, there's some reluctance to add the custom claim to Okta so is there a simple way to have .Net recognize those scp claims as roles?

Upvotes: 0

Views: 622

Answers (1)

Lasse P
Lasse P

Reputation: 325

You could use IClaimsTransformation to map those scp claims to roles. Like this: https://learn.microsoft.com/en-us/aspnet/core/security/authentication/claims?view=aspnetcore-6.0#extend-or-add-custom-claims-using-iclaimstransformation

Upvotes: 0

Related Questions