diff options
author | FxQnLr <[email protected]> | 2024-04-08 15:44:31 +0200 |
---|---|---|
committer | FxQnLr <[email protected]> | 2024-04-08 15:44:31 +0200 |
commit | a91a2ca5c88403e905bf0f798393587fc4d900fa (patch) | |
tree | 12b141ac2a50ec02e87c8d02ba06d7bec3f4c0e4 /src/auth.rs | |
parent | 52851787329c48c1e70f98a3610ad52fe1fa4aa4 (diff) | |
download | webol-a91a2ca5c88403e905bf0f798393587fc4d900fa.tar webol-a91a2ca5c88403e905bf0f798393587fc4d900fa.tar.gz webol-a91a2ca5c88403e905bf0f798393587fc4d900fa.zip |
Closes #26. Addtional GET request for /start
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), |