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

security: Mechanism to get parameter name used within "apiKey" security schemes. #1280

Open
jmalloc opened this issue Jul 15, 2024 · 0 comments
Labels
enhancement New feature or request openapi-features OpenAPI features support issues

Comments

@jmalloc
Copy link
Contributor

jmalloc commented Jul 15, 2024

Description

I'd like to be able to access the parameter name (cookie name, for example) defined in security schemes in my OpenAPI specification.

For example, I have the following sections in my spec:

components:
  securitySchemes:
    AuthenticatedSession:
      type: apiKey
      in: cookie
      name: auth_token

I also have a /login endpoint that sets the auth_token cookie. As it stands, I have hardcoded the name of the cookie in my login implementation, but it would be preferable to use a constant generated by ogen so that the YAML file is the single source of truth. I've had a release fail due to a mismatch between my code and the spec which was not caught by tests because when using the generated SecurityHandler and SecuritySource interfaces because they both refer to the cookie name in the spec.

References

@jmalloc jmalloc added enhancement New feature or request openapi-features OpenAPI features support issues labels Jul 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request openapi-features OpenAPI features support issues
Projects
None yet
Development

No branches or pull requests

1 participant