-
-
Notifications
You must be signed in to change notification settings - Fork 84
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
Support OpenID and 3rd party IdTokens with cookie-less authentication #101
Comments
I have not spent quality time thinking about this yet, but from a quick view, I have some questions and concerns about how this flow is supposed to work:
|
Thanks for feedback. See my comments below.
That's a valid concern. My view is to have separate middleware for OpenID only. The main reason is using different JWT validation mechanisms -
There is a way. OpenID providers usually use asymmetric encryption and publish public keys (using JWKS) to validate the JWT tokens they issue. These keys will be loaded when a provider is added via
That's a good reason. In my case, I'd like to make it not-so-transparent for the client, but consistent for API / client access by using
But not via
Not exactly, I don't have plans to support new authentication flows and keep using current |
ah, I see. Asymmetric encryption answers the majority of my concerns, however, it adds some others ;) We will be able to validate/verify the token, however, we won't be able to alter it. For the basic usage, it should be fine but for anything more advanced we will have to use some state on the server-side associating users to tokens. For example, any sort of rbac currently can be done with the modified JWT with ClaimsUpdater, however as you mentioned it won't work with opened tokens. Even not such advanced flow won't be supported directly, but the current avatar's support will need it. You mentioned, "Probably OpenID should have its own configuration options?" and I have no clue what options (if any) it has. Likely we are looking for a way to send a custom payload/claim as a part of the auth flow. |
I would like to avoid having server state by all means. Or at least make it optional, i.e. instead of relying on
I guess the same true for the avatar support, maybe configuration param I'm quite happy with these limitations for all my use cases, the question is how useful do you think OpenID support would be with all of that in mind. For me the main drivers to integrate OpenID support are: 1. No need to manage / share secrets between services 2. Using Regarding configuration options - I'm not quite sure which options should be there, but a lot of params are irrelevant for OpenID setup, e.g. token duration, since there are no tokens are issued by us anymore. I can only think of |
I'm not sure what this part For avatar support, if we follow the same logic we won't have a place to put the avatar URL into the token and will need something similar to retrieve it. Probably it won't be much of a problem and we could have a separate request to do it and the client-side will have to deal with storing this info somewhere.
I'm not sure yet. So far it sounds like this path can lead to very different functionality and a very different user experience. I'm not saying it is worse or better, but different to the level it can be fundamentally incompatible with the current implementations. However, it is hard to predict what we will get after some/all the ideas around openid are implemented. I do see a value in supporting this just not sure if it fits well. Probably making some POV PR may help to get a better feeling of what the final implementation going to look like. |
I meant things that are app-specific rather the low-level concerns. For instance one of the consumer's sets "blocked" flag allowing to deal with rejections on the consumer level, another consumer sets details like "email" even for providers what doesn't have this info but supplied by the user later on. All the RBAC deal is just another set of custom claims and so on. We can consider all of those details as something requiring a lookup but again, this will limit the autonomy of the tokens and will make them just another kind of session. |
@alek-sys, I maybe not completely understood root point of your discussion, but I can assume regarding one moment:
The same mechanisms use in the |
There are probably quite a few parts in this issue, I totally see those as separate small PRs / issues.
Context
Currently,
auth
package supports various OAuth2 providers and acts as a OAuth2 Authorization Server / proxy (without strongly committing to RFC) by issuing self-signed ID tokens based on info provided by/userinfo
response, which are passed via a cookie, with extra XSRF protection.Proposal
Support OpenID providers and ID tokens issued by an external identity provider as authentication tokens. In this scenario, the server won't have private keys and won't issue ID tokens itself. Potentially support OpenID Connect Discovery protocol. Unlike general OAuth2 spec, OpenID supports issuing signed ID tokens bound to a particular user, so these tokens can be used for authentication.
How I see the potential configuration:
With
OpenIDAuth
authentication middleware, the server should act as a OAuth2 Resource Server, i.e. to expectAuthorization: Bearer <jwt>
header and use that for authentication.Having this would allow:
Authorization
header)Considerations:
auth
is only acting as a authentication proxy basically. Likeopts.ClaimsUpdater
won't work - since we don't have private keys, we can't modify claims. Probably OpenID should have own configuration options?Authorization
header should be checked, which is set from the cookie. This kind of gives XSRF protection for free.The text was updated successfully, but these errors were encountered: