🗝
summary refs log tree commit diff
path: root/src/server/nginx_check.rs
diff options
context:
space:
mode:
authormia <mia@mia.jetzt>2024-04-23 18:40:20 -0700
committermia <mia@mia.jetzt>2024-04-23 18:40:20 -0700
commitb9c1ac1c070f19295c79ad21a7eddf20ea42a49b (patch)
tree82882bdbb9e43d8cce25ef45f7a2ece81f2fe432 /src/server/nginx_check.rs
parent796b2cafc798a7faa80a007002831a4c40635fe8 (diff)
downloaddissociate-0.2.0.tar.gz
dissociate-0.2.0.zip
falx integration v0.2.0
Diffstat (limited to 'src/server/nginx_check.rs')
-rw-r--r--src/server/nginx_check.rs41
1 files changed, 0 insertions, 41 deletions
diff --git a/src/server/nginx_check.rs b/src/server/nginx_check.rs
deleted file mode 100644
index 7b67f26..0000000
--- a/src/server/nginx_check.rs
+++ /dev/null
@@ -1,41 +0,0 @@
-// for ngx_http_auth_request_module authentication
-// make sure you have cookie_domain set properly
-// depends on https://git.mia.jetzt/sysconf/tree/patches/nginx_auth_redirect.patch
-
-use axum::{
-    extract::{Path, State},
-    http::StatusCode,
-    response::{IntoResponse, Redirect, Response},
-    routing::get,
-    Router,
-};
-use axum_extra::extract::CookieJar;
-
-use crate::server::{account_auth, store::Store};
-
-use super::{ApiState, WebBase};
-
-pub fn bind(app: Router<ApiState>) -> Router<ApiState> {
-    app.route("/nginx_check/:scope", get(nginx_check))
-}
-
-#[axum::debug_handler(state = ApiState)]
-async fn nginx_check(
-    jar: CookieJar,
-    Path(scope): Path<String>,
-    State(store): State<Store>,
-    State(WebBase(web_base)): State<WebBase>,
-) -> Response {
-    let nevermind = || Redirect::to(&format!("{web_base}/logout")).into_response();
-    let Some(name) = account_auth(&jar, &store).await else {
-        return nevermind();
-    };
-    let Some(account) = store.get_account(&name).await else {
-        return nevermind();
-    };
-    if account.scopes.contains(&scope) {
-        StatusCode::OK.into_response()
-    } else {
-        StatusCode::FORBIDDEN.into_response()
-    }
-}