Signed-off-by: kjuulh <contact@kjuulh.io>
This commit is contained in:
parent
e6084a7f4e
commit
57d30f2129
@ -1,27 +1,27 @@
|
|||||||
use std::borrow::Cow;
|
|
||||||
use std::fmt::Display;
|
use std::fmt::Display;
|
||||||
|
|
||||||
use crate::router::AppState;
|
use crate::router::AppState;
|
||||||
|
|
||||||
use async_sqlx_session::PostgresSessionStore;
|
|
||||||
use axum::extract::{FromRef, FromRequestParts, Query, State};
|
use axum::extract::{FromRef, FromRequestParts, Query, State};
|
||||||
use axum::headers::authorization::Basic;
|
|
||||||
use axum::headers::{Authorization, Cookie};
|
use axum::headers::{Cookie};
|
||||||
use axum::http::request::Parts;
|
use axum::http::request::Parts;
|
||||||
use axum::http::StatusCode;
|
use axum::http::StatusCode;
|
||||||
use axum::http::{header::SET_COOKIE, HeaderMap};
|
|
||||||
use axum::response::{ErrorResponse, IntoResponse, Redirect};
|
use axum::response::{ErrorResponse, IntoResponse, Redirect};
|
||||||
use axum::routing::get;
|
use axum::routing::get;
|
||||||
use axum::{async_trait, Json, RequestPartsExt, Router, TypedHeader};
|
use axum::{async_trait, Json, RequestPartsExt, Router, TypedHeader};
|
||||||
use axum_sessions::async_session::{Session, SessionStore};
|
|
||||||
use como_domain::users::User;
|
use como_domain::users::User;
|
||||||
use como_infrastructure::register::ServiceRegister;
|
use como_infrastructure::register::ServiceRegister;
|
||||||
use oauth2::basic::BasicClient;
|
|
||||||
use oauth2::{reqwest::async_http_client, AuthorizationCode, CsrfToken, Scope, TokenResponse};
|
|
||||||
use oauth2::{RedirectUrl, TokenIntrospectionResponse};
|
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
use serde_json::json;
|
use serde_json::json;
|
||||||
use zitadel::oidc::introspection::introspect;
|
|
||||||
|
|
||||||
#[derive(Debug, Deserialize)]
|
#[derive(Debug, Deserialize)]
|
||||||
pub struct ZitadelAuthParams {
|
pub struct ZitadelAuthParams {
|
||||||
|
@ -101,7 +101,7 @@ impl Auth for NoopAuthService {
|
|||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn get_user_from_session(&self, cookie: &str) -> anyhow::Result<User> {
|
async fn get_user_from_session(&self, _cookie: &str) -> anyhow::Result<User> {
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -52,7 +52,7 @@ impl OAuthClient for NoopOAuthClient {
|
|||||||
Ok(Url::parse("http://localhost:3000/auth/zitadel").unwrap())
|
Ok(Url::parse("http://localhost:3000/auth/zitadel").unwrap())
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn exchange(&self, code: &str) -> anyhow::Result<String> {
|
async fn exchange(&self, _code: &str) -> anyhow::Result<String> {
|
||||||
Ok(String::new())
|
Ok(String::new())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -56,7 +56,7 @@ pub struct User {
|
|||||||
|
|
||||||
#[async_trait]
|
#[async_trait]
|
||||||
impl Session for PostgresSessionService {
|
impl Session for PostgresSessionService {
|
||||||
async fn insert_user(&self, id: &str, user_id: &str) -> anyhow::Result<String> {
|
async fn insert_user(&self, _id: &str, user_id: &str) -> anyhow::Result<String> {
|
||||||
let mut session = AxumSession::new();
|
let mut session = AxumSession::new();
|
||||||
session.insert(
|
session.insert(
|
||||||
"user",
|
"user",
|
||||||
@ -98,11 +98,11 @@ pub struct InMemorySessionService {}
|
|||||||
|
|
||||||
#[async_trait]
|
#[async_trait]
|
||||||
impl Session for InMemorySessionService {
|
impl Session for InMemorySessionService {
|
||||||
async fn insert_user(&self, id: &str, user_id: &str) -> anyhow::Result<String> {
|
async fn insert_user(&self, _id: &str, _user_id: &str) -> anyhow::Result<String> {
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn get_user(&self, cookie: &str) -> anyhow::Result<Option<String>> {
|
async fn get_user(&self, _cookie: &str) -> anyhow::Result<Option<String>> {
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user