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

Bug: OpenAPI Security Scheme Override #3774

Open
1 of 4 tasks
Forceres opened this issue Oct 1, 2024 · 0 comments
Open
1 of 4 tasks

Bug: OpenAPI Security Scheme Override #3774

Forceres opened this issue Oct 1, 2024 · 0 comments
Labels
Bug 🐛 This is something that is not working as expected

Comments

@Forceres
Copy link

Forceres commented Oct 1, 2024

Description

Is it possible to override Bearer Security Scheme header in specific route?

URL to code causing the issue

No response

MCVE

async def check_access_token(
            self,
            request: Request,
            access_token: Annotated[str, Parameter(header="Authorization")],
            async_client: Annotated[AsyncClient, Depends(Component.HTTP)],
            settings: Annotated[Settings, Depends(Component.SHARED)],
    ) -> Response[AuthStatusDto]:
    pass

something like that doesn't work, swagger doesn't send specific header, but when I use global security option - everything is ok.
That's a Litestar code with some DI features, I'm looking to override how the security works for a route (I have access_token variable from Authorization header at the route level, and I have global Security Schema that works with Authorization header, but the route level Authorization header doesn't override global)

Steps to reproduce

1. Go to Swagger docs
2. Try to pass Authorization header via endpoint header form
3. Send a request
4. See error

Screenshots

"![SCREENSHOT_DESCRIPTION](SCREENSHOT_LINK.png)"

Logs

No response

Litestar Version

2.12.1

Platform

  • Linux
  • Mac
  • Windows
  • Other (Please specify in the description above)

Note

While we are open for sponsoring on GitHub Sponsors and
OpenCollective, we also utilize Polar.sh to engage in pledge-based sponsorship.

Check out all issues funded or available for funding on our Polar.sh dashboard

  • If you would like to see an issue prioritized, make a pledge towards it!
  • We receive the pledge once the issue is completed & verified
  • This, along with engagement in the community, helps us know which features are a priority to our users.
Fund with Polar
@Forceres Forceres added the Bug 🐛 This is something that is not working as expected label Oct 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug 🐛 This is something that is not working as expected
Projects
None yet
Development

No branches or pull requests

1 participant