-
Notifications
You must be signed in to change notification settings - Fork 377
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OAuth flow failed while using SecurityPolicy with EnvoyGateway #5073
Comments
cc @zhaohuabing |
@HannaManista Could you please paste your Gateway, SPs and HTTPRoutes resoures? You can substitue the sensitive info with some placeholders, but please keep the original configurations as much as possible. |
I think you can't do that because the redirect urls for different SPs should not be the same. https://gateway.envoyproxy.io/docs/tasks/security/oidc/#register-an-oidc-application |
Gateway:
HTTPRoute for app1:
HTTPRoute for appp2:
SecurityPolicy for app1:
SecurityPolicy for app2:
Concerning the redirect URLs for both SPs, in the Azure Application it is possible to set multiple (different) redirect URIs: It doesn't say that the authentication application and SP should be 1-1, as I understand. |
@HannaManista I'v tested a similar setup: two ScecurityPolicies configured with the same application id targeting on two HTTPRoutes with different hosts, and it worked as expected. If you could enable the debug log on the Envoy and share the log, I'd be happy to help investigate and debug this issue further. Debug log can be enabled through EnvoyProxy:
|
Hi @zhaohuabing , I enabled the logging level to debug on EnvoyProxy. After calling the service in envoy-gateway's pod logs there is: and here another request. For some reason it looks different: based on this error: |
One more observation regarding those two SecurityPolicies: this time I set up the SecurityPolicy for alertmanager firstly and afterward SecurityPolicy for prometheus was created. Result is that SecurityPolicy for alertmanager works correctly whereas the SecurityPolicy for (secondly created) prometheus fails on authentication. In my earlier investigation I created the prometheus SecurityPolicy firstly and it worked, while secondly (at that time) created alertmanager SecurityPolicy failed. So the order of creation here might be crucial, not really the service itself. |
Title: OAuth flow failed while using multiple authentication sessions with EnvoyGateway
Description:
I set up 2 separate SecurityPolicies (using api: gateway.envoyproxy.io/v1alpha1) for each of my HTPRoutes (from gateway.networking.k8s.io/v1). Both of the SecurityPolicies point to the same Azure application. Their configuration is as follows:
Firstly I set only one of the SecurityPolicies to authenticate the traffic to the HTTPRoute. It worked - routed to the login page and after logging in to the service page.
I wanted to enable the second SecurityPolicy for another HTTPRoute (another service). After its successful creation I called the service's url, was once again redirected to the authentication page, but after logging in I get the error page: "OAuth flow failed."
In the Envoy gateway's pod the log looks as following:
the only information here is that it is a 401 error code, while with the same credentials I am authenticated by the same Azure application to another service (using different HTTPRoute).
The same behavior was observed when attaching 2 HTTPRoutes to one SecurityPolicy.
Also what is the way to track the authorized OIDC sessions in SecurityPolicy provided by EnvoyGateway? (Analogically to oauth2 which has redis.)
Config:
Envoy is installed using helm chart gateway-helm from docker.io/envoyproxy , chart version 1.2.1.
EnvoyProxy customization is only annotations:
The text was updated successfully, but these errors were encountered: