hwi / HWIOAuthBundle

OAuth client integration for Symfony. Supports both OAuth1.0a and OAuth2.
MIT License
2.27k stars 797 forks source link

Fix access control suggestions #1991

Closed Jean85 closed 7 months ago

Jean85 commented 7 months ago

I am trying to reconfigure an app during a Symfony 5.4 -> 6.4 upgrade. During this, I took the time to realign my use of this bundle to the standard and the recipe.

I'm not using the connect feature, and I was unable to make it work until I added the suggested line to my access control, because without that the redirect route (/connect/{service}) is hidden behind the default rule (^/ roles: ROLE_USER) and hence triggering a loop that pushes me back to the login page.

stloyd commented 7 months ago

Good catch, but I think this should be now put in step 4 dedicated to connect functionality as well we should add it to the recipe for flex.

Jean85 commented 7 months ago

I don't think that putting it in step 4 is correct since, as I said, this has been needed for me even without the connect functionality, since the redirect URLS have the /connect prefix anyway.

stloyd commented 7 months ago

Could you point out more details? What version did you use of the bundle, the config & the best routes from the bundle & "check" routes? I'm quite confused that you needed that route without connect functionality.

Jean85 commented 7 months ago

If you use the recipe, the redirect routes have a /connect prefix: https://github.com/symfony/recipes-contrib/blob/bb846a62aecce3622965ad34d979f5f783d65c05/hwi/oauth-bundle/2.0/config/routes/hwi_oauth_routing.yaml#L3

So, when you suggest to add a button in the login page: https://github.com/symfony/recipes-contrib/blob/bb846a62aecce3622965ad34d979f5f783d65c05/hwi/oauth-bundle/2.0/config/routes/hwi_oauth_routing.yaml#L3

That generates a /connect/{service} path, hence the need of this PR.

stloyd commented 7 months ago

Thanks, make sense, I think I got you wrong at first.

I will make PR to the recipes repository.