-
Expected Behavior / New Feature
Actual Behavior / Motivation for New FeatureI'm trying to set up the following scenario
I have
What I hoped for was that Ocelot could offload the browser authentication - detect that the browser wasn't authenticated and then redirect to the IdentityServer for authentication. But the only thing that happens is that Ocelot returns 401. (If I go to the IdentityServer "manually", log in and then go back to the web app it works.) I've tried configuring Ocelot with the
I can try to clean up the code to show what I'm currently doing, but first I just want to ask if such a scenario is even supported. Is it? |
Beta Was this translation helpful? Give feedback.
Replies: 13 comments
-
Hi @bremnes I have been away on a business trip for the last week so haven't had time to help with issues! Sorry for slow response :) This isn't supported at the moment. Ocelot just calls authenticate on the authentication provider the user registers. I think it would need to do Challenge and then redirect the user appropriately. This is something we could consider support but I don't know enough yet to say how hard / easy it is. If you want to take a look I would reccomend looking at AuthenticationMiddleware.cs in Ocelot and these docs in IdentityServer 4. |
Beta Was this translation helpful? Give feedback.
-
Hi @TomPallister, have you had any more thoughts on this? |
Beta Was this translation helpful? Give feedback.
-
I would really love this feature... In fact, I desperately need this feature at the moment 🙏 |
Beta Was this translation helpful? Give feedback.
-
I just found this issue after literally hours of finding out why it's not redirecting... I would also really love this! |
Beta Was this translation helpful? Give feedback.
-
Still trying to find a way to bypass the limitation, but yeah ... just reminding it could be an awesome feature! |
Beta Was this translation helpful? Give feedback.
-
Hi Lars! |
Beta Was this translation helpful? Give feedback.
-
Wow! So high interest by Ocelot community!... |
Beta Was this translation helpful? Give feedback.
-
@Simkiw @leoshusar @elvishsu66 @AlexHarper @bremnes My main concern is that IdentityServer has been archived by the owner on Dec 13, 2022 ❗ |
Beta Was this translation helpful? Give feedback.
-
I wasn't using IdentityServer, I was using Keycloak SSO, so I think the feature request for me would really be redirect unauthenticated requests to either configured SSO or an issuer URL in JWT(?) (or custom field?). But IdentityServer continues in another organization, just the original repo was archived I guess to keep the original links working. I personally don't need this at this moment since my focus is currently on another projects and I don't know when I'll return to the microservices world. |
Beta Was this translation helpful? Give feedback.
-
@raman-m Thanks for picking up this issue. At the time it was IdentityServer we were using, but as @leoshusar said I guess it should be vendor/software neutral. |
Beta Was this translation helpful? Give feedback.
-
@bremnes commented on Aug 5, 2018
It seems Not!
We cannot implement complex auth-logic... You can override AuthenticationMiddleware and do your own thing... you control everything.
Don't switch on authentication if Ocelot doesn't support such Auth-provider.
If you want to use external auth-providers. You need to do the following
Does this my answer make sense for you? |
Beta Was this translation helpful? Give feedback.
-
Well... But don't define route with switched on Auth feature, just use anonymous-route. In this case all traffic should be routed to required endpoint without any problems, including any Auth-server. I see only one problem, that Ocelot can return bad status code which is not compatible to your lovely client's or Auth providers... We can collaborate on that problem. 😉 |
Beta Was this translation helpful? Give feedback.
-
@bremnes commented on Nov 30, 2023:
We are not picking up this issue. As a team, we try to understand where to go.
If Identity Server was used in your project then I wonder about detailed discussion here... Your user scenario is quite common as other developers have. I recommend you just use and read my advices above. Ocelot is not so smart to do complex redirections. You need to define 2 routes: 1) unauthenticated traffic (but Ocelot cannot route some auth requests like Forms routing etc); 2) after creation of token you need 2nd route for authenticated requests with this token.
We use standard interfaces of standard Microsoft packages, also current integrated identity providers described here. Hope it helps! |
Beta Was this translation helpful? Give feedback.
@bremnes commented on Aug 5, 2018
It seems Not!
We cannot implement complex auth-logic... You can override AuthenticationMiddleware and do your own thing... you control everything.
We don't see much benefits in implementation of rare user scenarios. But we welcome to introduce custom Auth-providers in Ocelot as modules. So, any contribution is welcome!
Don't switch on authentication if Ocelot do…