Closed pPanda-beta closed 4 years ago
cc @verdan
cc @verdan
Will take a look once I am back from my holiday!!
cc @verdan
I have this in my agenda as the next feature (once I am done with the users/owners part). I'll be working on fixing issues with this and also OIDC for google.
hey @verdan Just one general update, in my organisation we first started with google oidc, later moved to our own keycloak, which is working as oidc broker.
With google it was working fine. But the refresh token lifetime was quite high, and no option in the frontend to logout. It got solved when things are in our control using keycloak.
With keycloak there are slight glitches (clearing out cookies helped), with which we can live with.
I think the glitches
part in keycloak oidc is also what we are experiencing @verdan . I assume that's going in the fix as well.
@mgorsk1 @pPanda-beta what glitches ? Can you please be more specific or examples?
flaskoidc is not very complex or a fancy code, can you please help me fix those issues and open a PR if you see this happening as I can not reproduce all the issues sometimes, especially in the case of google OIDC.
But please feel free to open a PR and I will prioritise the review.
The one I have in mind is what we sometimes notice (the same thing I mentioned before internally) when every Amundsen request returns 500 and what helps is clearing cookies/opening in incognito mode. It seems that not redirecting to login screen when token has expired might be the issue.
@verdan
This is issue is mainly a proxy for https://github.com/verdan/flaskoidc/issues/1 , there is no problem on amundsen frontend actually.
For glitches of flaskoidc, I've not debugged myself. But mostly it happens when tokens are expired and on the same browser we have logged out and logged in with a different user on keycloak. I'll share a detailed reproduction steps on a fresh issue on flaskoidc, not here. This is in favour of concentrating on the current issue (that is over-ridding the scheme).
As an improvement of flaskoidc
the following I can suggest, (THIS IS ALIGNED WITH THE CURRENT ISSUE)
Identify scheme from x-forwarded-proto header IN RUNTIME since, both nginx and istio ingress automaticity sends this header.
This will help us to access any flaskoidc powered app
from both an http ingress as well as https ingress. The solution mentioned here can not support multiple schemes.
I believe this can be closed now with the latest version of flaskoidc. cc: @pPanda-beta
Sure @verdan Though there are some other oidc related problems on amundsen but all of those can be solved from flaskoidc. I'll raise corresponding issues on flaskoidc.
I was using amundsen frontend with flaskoidc as auth layer wrapper, and following is the kubernetes deployment architecture :
Browser(Client) --(HTTPS)--> Nginx Ingress Controller --(HTTP, port:5000)--> Amundsen-Frontend-Pod
So flask_oidc was detecting the wrong redirect_uri, (which I was able to fix by using proxy_redirect, aka find and replace in location header for 3xx) as well as it is sending a "state" variable which holds the redirect_uri in a JWT (Now nginx can not help anymore). So no escape by hacking the nginx router. Only solution is injecting OVERWRITE_REDIRECT_URI.
Expected Behavior
redirect uri comes correctly on "Location" header with "https" scheme
Current Behavior
incorrect redirect uri comes correctly on "Location" header with "http" scheme
Possible Solution
A pre start command (or init container) and env variable FLASK_OIDC_OVERWRITE_REDIRECT_URI
Steps to Reproduce
deploy the k8s app and expose using ingress
Screenshots (if appropriate)
Context
More info at : https://github.com/verdan/flaskoidc/issues/1
Your Environment
Amunsen version used: dockerimages : amundsendev/amundsen-search:2.4.0 amundsendev/amundsen-metadata:2.5.4 amundsendev/amundsen-frontend-oidc:2.2.2
Deployment: k8s behind ingress