-
Notifications
You must be signed in to change notification settings - Fork 94
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
How to use Security and SecurityRequirement #75
Comments
I have never used Security and SecurityRequirement definitions before, but according to this documentation (https://swagger.io/docs/specification/authentication/) it seems it needs to look like this in YAML: get:
security:
- BearerAuth: []
#...
summary: Gets the account billing info
responses:
'200':
description: OK So the correct way to create such a spec from PHP code would be: return new PathItem([
'get' => new Operation([
'security' => [new SecurityRequirement(['BearerAuth' => []])],
// ...
])
]); I have not tried it, but this should work as far as I see. |
How about improving the class API this way: 'paths' => [
'/test' => new PathItem([
'get' => new Operation([
'security' => new SecurityRequirements([ # plural
'BearerAuth' => new SecurityRequirement([]), # singular
]),
'responses' => new Responses([
200 => new Response(['description' => 'OK']),
])
])
])
] |
I am not sure how to use Security in combination with SecurityRequirements.
The Security Schema defined:
Now the security schema is created (
components
).How do i assign this security schema for an specific operation?
Thanks for the great library and maybe it clarifies this task also for others.
The text was updated successfully, but these errors were encountered: