-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Security] OAuth2 Introspection Endpoint (RFC7662) #50027
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
Conversation
Thanks for yet another security feature proposal! I want to discuss a general remark that I don't think I've shared publicly yet. (disclaimer: I know literally nothing about OAuth 2.0 and OIDC, except that it consists of a ton of different standards, so I can't determine if this applies to this PR) My vision for Symfony Security is to provide a minimal implementation following industry best practices based on standards and let community libraries/bundle add all "bonus features". We don't have the man power nor knowledge to maintain let's say all OAuth, SAML, Webauthn and MFA standards. When adding new features, I think we must always test it to those 3 conditions:
cc @chalasr |
I agree with Wouter. |
Many thanks for your feedback and advices. Hereafter my thoughts on this
No problem. I based it on the branch 6.3, but it does not matter to rebase to another branch.
Even if the community is large enough, I understand there is a risk to include specific authentication means that could be a problem in the future.
I was not aware of those, but seem to be fair enough.
Noted. Thanks. In this case, there is no need to go further here. I will continue that work in a side project. 👍 |
src/Symfony/Component/Security/Http/AccessToken/OAuth2/Oauth2TokenHandler.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/Security/Http/AccessToken/OAuth2/Oauth2TokenHandler.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/Security/Http/AccessToken/OAuth2/Oauth2TokenHandler.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/Security/Http/AccessToken/OAuth2/Oauth2TokenHandler.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/Security/Http/AccessToken/OAuth2/Oauth2TokenHandler.php
Outdated
Show resolved
Hide resolved
src/Symfony/Bundle/SecurityBundle/Resources/config/security_authenticator_access_token.php
Outdated
Show resolved
Hide resolved
...Bundle/SecurityBundle/DependencyInjection/Security/AccessToken/OAuth2TokenHandlerFactory.php
Outdated
Show resolved
Hide resolved
Hi, I revised my mind and I would like to reopen this PR. I think this should be challenged a bit more. sequenceDiagram
participant Client
participant Authorization Server
participant Resource Server
Authorization Server->>Client: IDToken+Access Token (after consent+authentication)
loop PR 48272 acts here
Client->>Client: IDToken
Client->>Authorization Server: Access Token (UserInfo Endpoint)
end
Client->>Resource Server: Access Token
loop This PR acts here
Resource Server->>Resource Server: Access Token (e.g. JWT, PASETO...)
Resource Server->>Authorization Server: Access Token (Introspection Endpoint)
end
As you can see, the features introduced with #48272 allow a Client application to authenticate end-users (by end-user, the OAuth spec means a person). The Client app can either use the IDToken (JWT) or the Access Token+UserInfo Endpoint to retreive the end-user details. sequenceDiagram
participant Client
participant Authorization Server
loop PR 48272 acts here
Client->>Client: IDToken
Client->>Authorization Server: Access Token (UserInfo Endpoint)
end
This PR acts in a very similar way. The main differences are as follows:
sequenceDiagram
participant Resource Server
participant Authorization Server
loop This PR acts here
Resource Server->>Resource Server: Access Token (e.g. JWT, PASETO...)
Resource Server->>Authorization Server: Access Token (Introspection Endpoint)
end
The reason why I think this PR deserves more attention is that is cover the missing piece for covering most of the OAuth2 use cases. I understand the point of view you say we could rely community on community works. And that's true that several solutions exist. But here, no third party library with exotic dependencies is needed1. We can directly use it with few configuration lines on e.g. ApiPlatform-based resource servers. Also, I understand that Symfony does not aim at implementing all industry/web standards (even if all the Notifier channels make me think the opposite). However, OAuth2 is so widely used by the industry that it would be a shame not to support it, in particular after the works on the previous PRs. It is not a trendy technology, but a standard widely used for more than 10 years (and in continuous evolution). At last but not least, the item Support for third-party authentication services (e.g. Auth0: https://auth0.com/) in [RFC] Symfony Security rework tracking issue proposed by @curry684 could be marked as checked as this feature will allow communication with auth0/Okta, OneLogin and many more. 1: this does not mean community works are useless. They all have great features, but having too much external dependencies is something we all try to avoid. |
...Bundle/SecurityBundle/DependencyInjection/Security/AccessToken/OAuth2TokenHandlerFactory.php
Outdated
Show resolved
Hide resolved
33af1e0
to
398830c
Compare
013329c
to
9fdb2ed
Compare
f5938f4
to
432fdf1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed my mind, given we have OAuth/OIDC support let's do it right + as complete as possible. 👍 once the small comments addressed & PR rebased
src/Symfony/Component/Security/Http/AccessToken/OAuth2/Exception/MissingClaimException.php
Outdated
Show resolved
Hide resolved
432fdf1
to
2ec3b0a
Compare
That's good news! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here are some CS suggestions, please rebase also.
...Bundle/SecurityBundle/DependencyInjection/Security/AccessToken/OAuth2TokenHandlerFactory.php
Outdated
Show resolved
Hide resolved
src/Symfony/Bundle/SecurityBundle/Resources/config/security_authenticator_access_token.php
Outdated
Show resolved
Hide resolved
...Bundle/SecurityBundle/DependencyInjection/Security/AccessToken/OAuth2TokenHandlerFactory.php
Outdated
Show resolved
Hide resolved
...Bundle/SecurityBundle/DependencyInjection/Security/AccessToken/OAuth2TokenHandlerFactory.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/Security/Http/AccessToken/OAuth2/Oauth2TokenHandler.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/Security/Http/AccessToken/Oidc/OidcTokenHandler.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/Security/Http/Tests/AccessToken/OAuth2/OAuth2TokenHandlerTest.php
Outdated
Show resolved
Hide resolved
737ece5
to
c086a13
Compare
4ee96eb
to
dc56f23
Compare
dc56f23
to
ec41507
Compare
9681e6b
to
8d3eef1
Compare
In addition to the excellent work of @vincentchalamon symfony#48272, this PR allows getting the data from the OAuth2 Introspection Endpoint. This endpoint is defined in the [RFC7662](https://datatracker.ietf.org/doc/html/rfc7662). It returns the following information that is used to retrieve the user: * If the access token is active * A set of claims that are similar to the OIDC one, including the `sub` or the `username`.
8d3eef1
to
e68726f
Compare
Thank you @Spomky. |
In addition to the excellent work of @vincentchalamon #48272, this PR allows getting the data from the OAuth2 Introspection Endpoint. This endpoint is defined in the RFC7662. It returns the following information that is used to retrieve the user:
sub
or theusername
.Example of configuration: