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

[11.x] Fix getting/setting client scopes and grant types #1717

Merged
merged 1 commit into from
Feb 9, 2024
Merged

[11.x] Fix getting/setting client scopes and grant types #1717

merged 1 commit into from
Feb 9, 2024

Conversation

axlon
Copy link
Contributor

@axlon axlon commented Feb 9, 2024

This PR fixes #1716:

As of version 11.10.2 it is no longer possible to get or set $scopes or $grant_types on the client model, due to changes made to it in #1709 and #1705.

I think this is because the added getters and setters do not respect the casts for these attributes that were already on the model.

Additionally, this PR introduces a new hasGrantType method on the client model, similar to the hasScope method it already has.

If this is merged I plan to create a second PR against master to have both of these methods return true by default, and remove the relevant casts.
This then gives developers full control over how they want to implement these methods by simply extending the client model. The skipsAuthorization() method already works this way and (IMO) this is great way to do things.

@axlon axlon marked this pull request as draft February 9, 2024 16:12
@axlon axlon marked this pull request as ready for review February 9, 2024 16:17
@taylorotwell taylorotwell merged commit 4d81207 into laravel:11.x Feb 9, 2024
8 checks passed
@axlon
Copy link
Contributor Author

axlon commented Feb 9, 2024

If this is merged I plan to create a second PR against master to have both of these methods return true by default, and remove the relevant casts.
This then gives developers full control over how they want to implement these methods by simply extending the client model. The skipsAuthorization() method already works this way and (IMO) this is great way to do things.

I've decided against trying this because the logic for hasScope() is a little bit more complex (currently) and would be annoying to maintain from outside Passport

@axlon axlon deleted the fix-1716 branch February 9, 2024 16:37
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.

[11.x] No longer able to get or set scopes on a client
2 participants