-
-
Notifications
You must be signed in to change notification settings - Fork 212
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
"Basic" authentication doesn't return WWW-Authenticate header on failure #471
Comments
@geogeim good point. the challenge here is where to find the realm. OpenAPI doesn't define a property in the schema for an api devto provide it. Potentially, we can provide the response object to the security handler and let the dev set the |
@cdimascio What about just using MDN says:
I verified this behaviour in Chromium and Firefox working like intended, i.e. showing a login popup. I tested it with this demo project (although it lacks documentation). I never came across a use case for using realms, never mind multiple realms, so I cannot say what the implications would be. But it would allow to cover the basic and common use case without needing to add any attribute to the OpenAPI spec. If you agree, I could take a stab at this sometime. |
That will be great. Please do. It makes for a good launching point. |
Add WWW-Authenticate header on 401 when using basic auth. Resolves cdimascio#471
I registered a basic security schema with my own validateSecurity.handlers for basic auth. When the user enters the URL in the browser he doesn't get the login prompt because the authentication doesn't return the "WWW-Authenticate" header in the response and just fails with "Authorization header required"
That means i have to work around it by adding this in the global error handler
Which kinda defeats the purpose of the security handler in the first place :(
The text was updated successfully, but these errors were encountered: