Reputation: 2891
I have a service that uses Ocelot to build a simple API gateway. I am attempting to upgrade Microsoft.Identity.Web from version 1.8.2 to 2.13.4.
When I make the library upgrade everything builds and starts but authorized endpoints fail with the error below. Is there a way to get more logging or details out of Ocelot?
I have looked at a successful JWT and a failing one and they are identical. My Ocelot version is 16.0.1 and the service is on dotnet 8.
The Error:
warn: Ocelot.Headers.Middleware.ClaimsToHeadersMiddleware[0]
requestId: 0HN62RRG1II3K:00000001, previousRequestId: no previous request id, message: Error setting headers on context, setting pipeline error
warn: Ocelot.Responder.Middleware.ResponderMiddleware[0]
requestId: 0HN62RRG1II3K:00000001, previousRequestId: no previous request id, message: Error Code: CannotFindClaimError Message: Cannot find claim for key: role errors found in ResponderMiddleware. Setting error response for request path:/mypath/uid/local%7Cxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx, request method: GET
The relevant part of the Ocelot file looks like this:
"DownstreamPathTemplate": "/v1/mypath/{everything}",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "__MYPATH_API_HOST__",
"Port": 80
}
],
"UpstreamPathTemplate": "/mypath/{everything}",
"UpstreamHttpMethod": [
"OPTIONS",
"GET",
"PATCH",
"POST",
"PUT"
],
"AuthenticationOptions": {
"AuthenticationProviderKey": "MYKEY",
"AllowedScopes": []
},
"AddHeadersToRequest": {
"uid": "Claims[sub] > value > |",
"role": "Claims[role] > value > |",
"organizationGuid": "Claims[organization_guid] > value > |"
}
Upvotes: 0
Views: 242