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

User is not checked when requesting an access token via password grant #125

Open
theofidry opened this issue Feb 28, 2023 · 1 comment
Open

Comments

@theofidry
Copy link
Contributor

I noticed that when doing a request to get an access token via the password grant type, the PasswordGrant::validateUser() does not check if the user is a "valid" user.

Indeed, it tries to get a user with matching credentials, sure enough, but it does not check anything further where traditionally in a Symfony app you have some pre & post auth checks via the user checker.

Is this expected?

@RobertMe
Copy link
Contributor

Running into the same issue. As actually using the token does still generate an error (because the OAuth2Authenticator implements the authentication framework of Symfony which will always run the pre- & post- checks) I do believe that this is a bug (because while you can generate the token, it will always result in an error when using it). Futhermore in my case it's not using the password grant type (but a custom grant based on JWT Bearer tokens) so I believe it should be more generic and not just for the password grant. And it would for example also be a bit weird when making actual requests (at some point) start to fail but a client would still be able to invoke the refresh grant and generate a new access token for a user which is invalid (and the newly generated token thus also being denied).

Implementing such validation might be done using the RequestAccessTokenEvent event, which contains the generated access token which in turn contains the user identifier (from which the user can be found by the UserProvider in Symfony). But the bundle already doing this validation would be better.

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

No branches or pull requests

2 participants