swarm-authelia-bridge: authorize a request before parsing its body
The handler took `Json<BridgeRequest>`, which axum runs before the handler
body. A caller with no token and a malformed body got axum's rejection
(415/400/422), whose text is serde's ("unknown variant ..., expected one of
..."), and not the one generic 401 an unauthenticated caller is meant to see.
Take the body as bytes, authorize, then parse. A caller that is let in and
sends a body that doesn't parse gets a 400 with the parse error, as before in
substance. The request's content type is no longer checked.
This commit is contained in:
parent
4a7df3f804
commit
56cc8a86ec
1 changed files with 152 additions and 11 deletions
1
Cargo.lock
generated
1
Cargo.lock
generated
|
|
@ -5423,6 +5423,7 @@ dependencies = [
|
|||
"swarm-authelia-bridge-sock",
|
||||
"swarm-secret-client",
|
||||
"tokio",
|
||||
"tower",
|
||||
"tracing",
|
||||
]
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue