Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
fabpot merged 1 commit intosymfony:7.3fromSpomky:features/oauth-rfc7662
Feb 26, 2025

Conversation

Spomky
Copy link
Contributor

@SpomkySpomky commentedApr 15, 2023
edited
Loading

QA
Branch?7.3
Bug fix?no
New feature?yes
Deprecations?no
Ticketsnone
LicenseMIT
Doc PRsymfony/symfony-docs#[TODO]

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 theRFC7662. 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 thesub or theusername.

Example of configuration:

framework:http_client:scoped_clients:oauth2.client:base_uri:'https://authorization-server.example.com/introspection'scope:'https://authorization-server\.example\.com'headers:Authorization:'Basic Y2xpZW50OnBhc3N3b3Jk'# Introspection Endpoint usually requires client authenticationsecurity:firewalls:main:pattern:^/access_token:token_handler:oauth2:~token_extractors:'header'realm:'My API'

dunglas, Jibbarth, and welcoMattic reacted with thumbs up emojiahmedyakoubi and welcoMattic reacted with heart emojivincentchalamon reacted with eyes emoji
@carsonbotcarsonbot added this to the6.3 milestoneApr 15, 2023
@SpomkySpomky marked this pull request as draftApril 15, 2023 15:27
@SpomkySpomky changed the titleOAuth2 Introspection Endpoint (RFC7662)[Security] OAuth2 Introspection Endpoint (RFC7662)Apr 16, 2023
@wouterj
Copy link
Member

wouterj commentedApr 16, 2023
edited
Loading

Thanks for yet another security feature proposal!
First a practical thing: We're entering feature freeze very shortly, meaning that we don't merge newly opened feature PRs for 6.3 anymore (unless really needed or very small). So we have some more time to polish this PR for 6.4 :)

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:

  • Is the feature based on a standard? (which is clearly yes for this one)
  • Is this feature required to have a working authentication/authorization system, within reason (i.e. if 90% of the apps use it when using OIDC)? (this is what I'm a bit unsure about for this specific PR)
  • Is this feature following industry best practices? (e.g. this is why I pushed a bit to add a JWT implementation in the OIDC PR, given that the user info handler is generally not recommended for production)

cc@chalasr

@SpomkySpomky marked this pull request as ready for reviewApril 16, 2023 11:57
@chalasr
Copy link
Member

chalasr commentedApr 16, 2023
edited
Loading

I agree with Wouter.
Implementing all OAuth2/OIDC features in core is a non-goal for now. Better improve community packages that are already supporting them or are meant to do so.

@Spomky
Copy link
ContributorAuthor

Hi@wouterj and@chalasr,

Many thanks for your feedback and advices. Hereafter my thoughts on this

First a practical thing: We're entering feature freeze very shortly, meaning that we don't merge newly opened feature PRs for 6.3 anymore (unless really needed or very small). So we have some more time to polish this PR for 6.4 :)

No problem. I based it on the branch 6.3, but it does not matter to rebase to another branch.

We don't have the man power nor knowledge to maintain let's say all OAuth, SAML, Webauthn and MFA standards.

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.

When adding new features, I think we must always test it to those 3 conditions

I was not aware of those, but seem to be fair enough.

Implementing all OAuth2/OIDC features in core is a non-goal for now. Better improve community packages that are already supporting them or are meant to do so.

Noted. Thanks. In this case, there is no need to go further here. I will continue that work in a side project. 👍

@SpomkySpomky closed thisApr 17, 2023
@Spomky
Copy link
ContributorAuthor

Spomky commentedMay 15, 2023
edited
Loading

Hi,

I revised my mind and I would like to reopen this PR. I think this should be challenged a bit more.
Hereafter a (simplified) diagram showing where this new feature will be useful.

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
Loading

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
Loading

This PR acts in a very similar way. The main differences are as follows:

  • It is s not meant to be used by the Client, but the Resource Server
  • The Resource Server is not supposed to receive the ID Token (unless Client + Resource Server = the same application)
  • The Resource Server can directly use the Access Token if it can be verified (e.g. JWT)
  • The "user" (consumer of the Resource Server) can be a end-user or an application (e.g. API to API communication)
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
Loading

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 withauth0/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.

chalasr and welcoMattic reacted with rocket emoji

@SpomkySpomky marked this pull request as draftMay 15, 2023 17:14
@SpomkySpomky closed thisMay 15, 2023
@SpomkySpomkyforce-pushed thefeatures/oauth-rfc7662 branch from33af1e0 to398830cCompareMay 15, 2023 17:25
@SpomkySpomky reopened thisMay 15, 2023
@SpomkySpomkyforce-pushed thefeatures/oauth-rfc7662 branch 2 times, most recently from013329c to9fdb2edCompareMay 17, 2023 13:40
@xabbuhxabbuh added this to the7.2 milestoneMay 15, 2024
@SpomkySpomkyforce-pushed thefeatures/oauth-rfc7662 branch fromf5938f4 to432fdf1CompareJuly 13, 2024 13:59
Copy link
Member

@chalasrchalasr left a comment
edited
Loading

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

Spomky, vincentchalamon, and welcoMattic reacted with heart emoji
@Spomky
Copy link
ContributorAuthor

That's good news!
The PR is now rebased and I addressed the remarks raised earlier.

Copy link
Member

@nicolas-grekasnicolas-grekas left a 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.

@fabpotfabpot modified the milestones:7.2,7.3Nov 20, 2024
@SpomkySpomkyforce-pushed thefeatures/oauth-rfc7662 branch 7 times, most recently from737ece5 toc086a13CompareDecember 25, 2024 16:56
@SpomkySpomkyforce-pushed thefeatures/oauth-rfc7662 branch 2 times, most recently from4ee96eb todc56f23CompareJanuary 5, 2025 19:47
@SpomkySpomkyforce-pushed thefeatures/oauth-rfc7662 branch fromdc56f23 toec41507CompareJanuary 18, 2025 07:09
@SpomkySpomkyforce-pushed thefeatures/oauth-rfc7662 branch 2 times, most recently from9681e6b to8d3eef1CompareFebruary 13, 2025 08:06
In addition to the excellent work of@vincentchalamonsymfony#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`.
@fabpot
Copy link
Member

Thank you@Spomky.

@fabpotfabpot merged commit1f5ff48 intosymfony:7.3Feb 26, 2025
1 check was pending
@SpomkySpomky deleted the features/oauth-rfc7662 branchMarch 2, 2025 11:04
@fabpotfabpot mentioned this pull requestMay 2, 2025
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@nicolas-grekasnicolas-grekasnicolas-grekas left review comments

@vincentchalamonvincentchalamonvincentchalamon left review comments

@welcoMatticwelcoMatticwelcoMattic left review comments

@OskarStarkOskarStarkOskarStark left review comments

@fabpotfabpotfabpot approved these changes

@chalasrchalasrchalasr approved these changes

@wouterjwouterjAwaiting requested review from wouterj

@xabbuhxabbuhAwaiting requested review from xabbuh

@lyrixxlyrixxAwaiting requested review from lyrixx

@dunglasdunglasAwaiting requested review from dunglas

@ycerutoycerutoAwaiting requested review from yceruto

@kbondkbondAwaiting requested review from kbond

@jderussejderusseAwaiting requested review from jderusse

Assignees
No one assigned
Projects
None yet
Milestone
7.3
Development

Successfully merging this pull request may close these issues.

10 participants
@Spomky@wouterj@chalasr@carsonbot@fabpot@nicolas-grekas@vincentchalamon@welcoMattic@OskarStark@xabbuh

[8]ページ先頭

©2009-2025 Movatter.jp