diff options
Diffstat (limited to 'src/auth.rs')
-rw-r--r-- | src/auth.rs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/auth.rs b/src/auth.rs index 1f4518a..74008b5 100644 --- a/src/auth.rs +++ b/src/auth.rs | |||
@@ -23,11 +23,13 @@ pub async fn auth( | |||
23 | match auth.method { | 23 | match auth.method { |
24 | Methods::Key => { | 24 | Methods::Key => { |
25 | if let Some(secret) = headers.get("authorization") { | 25 | if let Some(secret) = headers.get("authorization") { |
26 | if !(auth.secret.as_str() == secret) { return Err(StatusCode::UNAUTHORIZED); }; | 26 | if auth.secret.as_str() != secret { |
27 | return Err(StatusCode::UNAUTHORIZED); | ||
28 | }; | ||
27 | let response = next.run(request).await; | 29 | let response = next.run(request).await; |
28 | Ok(response) | 30 | Ok(response) |
29 | } else { | 31 | } else { |
30 | return Err(StatusCode::UNAUTHORIZED); | 32 | Err(StatusCode::UNAUTHORIZED) |
31 | } | 33 | } |
32 | } | 34 | } |
33 | Methods::None => Ok(next.run(request).await), | 35 | Methods::None => Ok(next.run(request).await), |