diff options
| author | rtkay123 <dev@kanjala.com> | 2026-04-06 20:06:14 +0200 |
|---|---|---|
| committer | rtkay123 <dev@kanjala.com> | 2026-04-06 20:06:14 +0200 |
| commit | cf51cf6f7424a85795bc67b3cece29c806a6d7e0 (patch) | |
| tree | 115a76de126dabf2c912715ef898f482d1bb992b /crates/api-auth/src/lib.rs | |
| parent | d575e966a422ea87508ef5370b2904f4818c6773 (diff) | |
| download | sellershut-cf51cf6f7424a85795bc67b3cece29c806a6d7e0.tar.bz2 sellershut-cf51cf6f7424a85795bc67b3cece29c806a6d7e0.zip | |
feat(oauth): redirect
Diffstat (limited to 'crates/api-auth/src/lib.rs')
| -rw-r--r-- | crates/api-auth/src/lib.rs | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/crates/api-auth/src/lib.rs b/crates/api-auth/src/lib.rs index 367d395..85fdb01 100644 --- a/crates/api-auth/src/lib.rs +++ b/crates/api-auth/src/lib.rs @@ -23,17 +23,23 @@ pub struct BasicClient(C); pub trait OauthDriver: Send + Sync { async fn get_auth_token(&self) -> Result<String, AuthError>; async fn get_user(&self) -> Result<User, AuthError>; - async fn create_oauth_session(&self) -> Result<String, AuthError>; + async fn create_oauth_session(&self) -> Result<SessionResponse, AuthError>; async fn save_session(&self, user: &User) -> Result<(), AuthError>; } use oauth2::{AuthUrl, ClientId, ClientSecret, RedirectUrl, TokenUrl}; use std::{convert::TryFrom, ops::Deref}; +use url::Url; use crate::error::AuthError; static CSRF_TOKEN: &str = "csrf_token"; +pub struct SessionResponse { + pub cookie_value: String, + pub auth_url: Url, +} + impl Deref for BasicClient { type Target = C; |
