museum-openapi-example
museum-openapi-example copied to clipboard
Consider `oauth2` or `openIdConnect` authentication over HTTP `basic` auth
trafficstars
Thank you for offering a new example for OpenAPI!
It is widely understood that APIs should avoid HTTP Basic Auth, which is inherently insecure. I recommend revising the Museum OpenAPI example to use a more secure security scheme.
- use
oauth2security scheme (withauthorizationCodeflow and with specific read and write scopes -- scope names left to implementors) oropenIdConnectsecurity scheme - change the default security requirement to be a reference to that security scheme (not basic auth) and use a read scope
- operations that require write access should not use the default security, but use an explicit operation-level
securityrequirement with write or other scope.
It would be nice if we mocked this too.