Skip to content
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

Add OpenID Response Type #1316

Open
wants to merge 57 commits into
base: master
Choose a base branch
from

Conversation

marcriemer
Copy link

No description provided.

@marcriemer marcriemer changed the title Added OpenID Responce Type Add OpenID Response Type Nov 30, 2022
@doobry-systemli
Copy link

I'm glad to see some progress here! @marcriemer do you intend to continue working on it? Did you get stuck somewhere particularly?

@marcriemer
Copy link
Author

@doobry-systemli So far my implementation works very well. I will continue my work on in this feature. Please let me know If you have any successions for improvements.

@Sephster
Copy link
Member

Version 9 bringing in the device code is being worked on just now. Then I will start to look at other features. V9 RC1 should be tagged today all being well

@marcriemer
Copy link
Author

@pat0s Thanks for bringing this up. You are right, the method should return a ClaimSetEntryInterface.

The ClaimSetEntryInterface extends ClaimSetInterface.

@SimLibaud
Copy link

Hi @marcriemer,

Thanks for the initiative and your work. It's a very interesting feature.

@Sephster Have you any news about this PR ?

$builder = $this->idTokenRepository->getBuilder($accessToken);

if ($claimSet instanceof ClaimSetEntryInterface) {
foreach ($this->extractor->extract($accessToken->getScopes(), $claimSet->getClaims()) as $claimName => $claimValue) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getClaims is documented as returning string[] while the extractor expects array<string, string>. This looks inconsistent to me.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To me, this looks like we need 2 separate interface: one returning the map of claim names to claim values (used by the ClaimRepository when getting the claims for an access token) and one listing a set of claim names associated with a scope.

Even if both interfaces have a method named getClaims, the would still be separate interface due to different signatures.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

btw, rebasing this PR would probably make the CI red because phpstan should be complaining about that.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, the ClaimExtractor needs to be fixed. It extracts ClaimSetEntryInterface, therefore most vars and properties are completely off.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Implementation of a ClaimSetInterface used by the ClaimExtractor could look like this:

    /**
     * Get users claims
     * 
     * @return array<string, string>
     */
    public function getClaims(): array
    {
        return [
            'preferred_username' => $this->getUsername(),
            'email' => $this->getEmail(),
        ];
    }

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but ClaimSetEntryInterface currently extends ClaimSet. this is what looks wrong to me as it seems like a separate concern (on one side, we associate a scope with a set of claim names, and on the other side, we have a map of claim names to claim values, which is not a set at all but a map)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ClaimExtractor was confusing: marcriemer@b1400a1

@stof
Copy link

stof commented Sep 24, 2024

@marcriemer @Sephster what is the status of this work ?

->expiresAt($accessToken->getExpiryDateTime())
->relatedTo($accessToken->getUserIdentifier());

if ($this->nonce) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't the nonce come from the authorization request ? Configuring as a constructor argument of the repository is probably not usable. It would be great to have an actual example of the openid setup.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree, the example is far from being perfect. The nonce must be part of the AuthCodeEntityInterface and used by ClaimSetRepositoryInterface to create ClaimSetInterface with the nonce claim.

@marcriemer
Copy link
Author

@stof I would love to contribute more, but some commits are sitting on the sideline right now. My complete OIDC implementation is nearly finished, including ImplicitOpenidGrant, AuthCodeOpenidGrant, and AbstractAuthorizeGrant along with all the related response types. However, it will require significant changes to this project.

@Sephster It may make sense to create a LTS branch and move faster forward for those who require new features. Authentication is changing fast right now. We need to keep up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants