summaryrefslogtreecommitdiffstats
path: root/crates/auth-service/src/server.rs
diff options
context:
space:
mode:
authorrtkay123 <dev@kanjala.com>2025-07-26 19:24:38 +0200
committerrtkay123 <dev@kanjala.com>2025-07-26 19:24:38 +0200
commite26d87f4fa18999c6bcfbcf32cfa85adab11acdd (patch)
tree603c6dacb6c448984bdcc5fa2b4a9314f1a23960 /crates/auth-service/src/server.rs
parent236876f1d0539ac22a3977fd8599933725ad0f90 (diff)
downloadsellershut-e26d87f4fa18999c6bcfbcf32cfa85adab11acdd.tar.bz2
sellershut-e26d87f4fa18999c6bcfbcf32cfa85adab11acdd.zip
feat(auth): create user call
Diffstat (limited to 'crates/auth-service/src/server.rs')
-rw-r--r--crates/auth-service/src/server.rs37
1 files changed, 37 insertions, 0 deletions
diff --git a/crates/auth-service/src/server.rs b/crates/auth-service/src/server.rs
new file mode 100644
index 0000000..7b66c42
--- /dev/null
+++ b/crates/auth-service/src/server.rs
@@ -0,0 +1,37 @@
+use axum::{Router, routing::get};
+use tower_http::trace::TraceLayer;
+
+use crate::{
+ server::routes::{authorised::login_authorised, health_check},
+ state::AppHandle,
+};
+
+pub mod csrf_token_validation;
+pub mod grpc;
+pub mod routes;
+
+const CSRF_TOKEN: &str = "csrf_token";
+const OAUTH_CSRF_COOKIE: &str = "SESSION";
+
+pub fn router(state: AppHandle) -> Router {
+ Router::new()
+ .route("/auth/authorised", get(login_authorised))
+ .route("/", get(health_check))
+ .with_state(state.clone())
+ .merge(routes::discord::discord_router(state))
+ .layer(TraceLayer::new_for_http())
+}
+
+#[cfg(test)]
+pub(crate) fn test_config() -> stack_up::Configuration {
+ use stack_up::Configuration;
+
+ let config_path = "auth.toml";
+
+ let config = config::Config::builder()
+ .add_source(config::File::new(config_path, config::FileFormat::Toml))
+ .build()
+ .unwrap();
+
+ config.try_deserialize::<Configuration>().unwrap()
+}