Skip to content

How to find service name on PreAuthorizationMiddleware? #1979

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

You must be logged in to vote

Hi Shadman!
Welcome to Ocelot world! 🐯

Short answer: Use Service discovery!

First,

You don't have to override PreAuthorizationMiddleware! You need to develop a kind of dynamic routing vs Consul solution...
Also, you can read httpContext.User.Claims from any class after authentication passed, so you need just to define authenticated route to have claims.

Second,

Classic approach of overriding of overwriting something in Ocelot is Delegating Handlers feature. Most of user scenarios can be implemented using delegating handler.
But your scenario is quite complicated! You want to use dynamic routing, and Consul. See the next point!

Third,

I believe to implement your user scenario you need to

  • D…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@raman-m
Comment options

@Iran-asp
Comment options

@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
Service Discovery Ocelot feature: Service Discovery Delegating Handlers Ocelot feature: Delegating Handlers Consul Service discovery by Consul
2 participants
Converted from issue

This discussion was converted from issue #1978 on March 01, 2024 17:09.