Skip to content

How to read RouteClaimsRequirement value from header? #2011

Answered by raman-m
aspramsh asked this question in Q&A
Discussion options

You must be logged in to vote

All functionality for claims is in our docs:

Read docs carefully please!


userType

According to Authorization doc, userType claim must exist in JWT auth token.
Also, userId claim should also exist in auth token claims list.


but userId is from upstream header and not from the URL?

Well... You can read any header mostly in all Ocelot classes where you have HttpContext or HttpRequestMessage objects.
Also some useful info about headers can be read from DownstreamRoute object like this: httpContext.Items().DownstreamRoute(). But better to read headers from HttpContext for sure.

To read the header you can develop Delegating Handler, but further applica…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@raman-m
Comment options

Answer selected by raman-m
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
Middlewares Ocelot feature: Middleware Injection Authorization Ocelot feature: Authorization
2 participants
Converted from issue

This discussion was converted from issue #1217 on March 23, 2024 17:40.