-
Notifications
You must be signed in to change notification settings - Fork 1.2k
providers: add okta (take two) #528
base: master
Are you sure you want to change the base?
Conversation
That's great thanks. I can test it tomorrow. Is there a way to reproduce the original bug this addresses? |
This provider is testing fine for me but I'm curious about where the X-Forwarded-User gets set. I tried adding a GetUserName function to the provider but it doesn't look like it's being used as I would have expected. I'm probably doing something wrong but I haven't spent too much time looking at the code. From what I can tell the X-Forwarded-User header is simply taking the email address and stripping off the @Domain. That's not always ideal as sometimes usernames and email addresses are different. Looking at the payload returned from okta can someone point me in the right direction to change the passed header to look at the preferred_username? |
@rothgar Good catch! Just implemented that for you in my latest commit. Can you pull down and test again? |
Funny because I added that exact same block of code and it doesn't look like it works the way I would have expected. Lines 248 to 255 in 1209c63
|
@rothgar I finally had the time to test this myself, and it all seems to work fine. Can confirm that Would love to get this reviewed and landed. |
Did you set any specific flags for the proxy when running it? Did you have to change the mapping in Okta for properties at all? I tried a few different different flags but all the defaults are already set to true. I'll try it again and get some more info around what flags I use and how the app is configured in Okta. |
@rothgar Nothing special. I use the config flag only, so mostly defaults. Only options I have set in my config file are No changes in Okta either. I just set up a custom OpenID Connect app, set the right redirect URI, and grabbed the client ID/secret. Super simple. It's the bare minimum, but it confirmed that I was at least getting the right e-mail and username back from Okta. |
I tested again and still am not getting HTTP_X_FORWARDED_USER set to the correct preferred_username variable. Here's how I'm testing so maybe someone can replicate. I compiled the proxy (pulled these recent changes) and ran it with the following flags
Then I run a simple container with index.php to print the headers passed
Then run
In okta I made the app with http://$hostname.$domain.com:4180/oauth2/callback for the callback Now browsing to http://$hostname.$domain.com:4180 I log in to okta and am passed the headers
However, if I add the
And I see from there the actual preferred_username is I tried checking the application mappings in okta to see if they were set to something different but I couldn't find a field for preferred_username. I deleted the app and created a new one and get the same results. |
@reedloden Okta has support for OpenID Connect. An OIDC priovider was added #389 Therefore, a separate Okta provider may not be necessary (unless okta requires additional API overhead beyond the OIDC spec). However, if you opt to use that instead, I would be cautious; the OIDC provider may have an issue with refreshing the session #523 |
One reason that a specific Okta provider may be required: for OIDC applications using the Authorization Code flow, Okta does not return groups in the ID token, even when the |
Follow-up to #406 to rebase and add missing
ValidateSessionState
method.