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

Restricting routes by scope example #285

Open
slawekadamek opened this issue Jul 13, 2021 · 1 comment
Open

Restricting routes by scope example #285

slawekadamek opened this issue Jul 13, 2021 · 1 comment

Comments

@slawekadamek
Copy link

Hello
I have a problem with Restricting routes by scope described in:
https://github.com/trikoder/oauth2-bundle/blob/v3.x/docs/basic-setup.md#restricting-routes-by-scope
there is an example which doesn't work for me:

oauth2_restricted:
path: /api/restricted
controller: 'App\Controller\FooController::barAction'
defaults:
oauth2_scopes: ['foo', 'bar']

Where - in which file should it be defined ?
in 'security.yaml' or 'trikoder_oauth2.yaml' or some other - in which section ?

Thank you :)

@maciekstary
Copy link

maciekstary commented Apr 7, 2022

Yeah, trikoder could have done better with docs...
You should set it in your controller. If you use annotations in symfony it would be something like this:

/**
 * @Route("/api/restricted", defaults={"oauth2_scopes"={"foo","bar"}})
 */
public function barAction(Request $request) 
{...

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