Fixes #3235 — Missing Authorization header returned 400 (Bad Request) instead of a meaningful auth failure response. /claim #3235
Changes:
.unauthorizedStatus(Status) builder method on Endpoint for customization:
endpoint.auth(AuthType.Bearer).unauthorizedStatus(Status.Unauthorized) // RFC-compliant 401
WWW-Authenticate header is automatically included per RFC 7235MissingHeader("authorization") errors are now correctly routed to the auth failure handler (previously fell through to generic 400)AuthType.scala — Added unauthorizedStatus, withUnauthorizedStatus, WithStatus case classEndpoint.scala — Added builder method, configurable auth failure response, MissingHeader catchOpenAPIGen.scala — Added authResponse helper, WithStatus handling in security schemesMimaSettings.scala — Binary compatibility filters for new trait methodsAuthSpec.scala — Updated existing test + 3 new tests for configurable statusOpenAPIGenSpec.scala — Updated 7 existing auth tests + 1 new test for custom 401 statusNabil Abdel-Hafeez
@987Nabil
ZIO
@ZIO