feat: Implement magic link authentication
This commit introduces a new magic link authentication flow. The desktop client can now request a temporary, one-time-use token from the server. This token is then used to open a URL in the system browser, which redirects to the server. The server consumes the token, installs a regular web session, and redirects the user
This commit is contained in:
@@ -4,6 +4,7 @@ pub mod case_id;
|
||||
pub mod config;
|
||||
pub mod error;
|
||||
pub mod gazetteer;
|
||||
pub mod magic_link;
|
||||
pub mod models;
|
||||
pub mod paths;
|
||||
pub mod routes;
|
||||
@@ -18,6 +19,7 @@ use axum::extract::FromRef;
|
||||
|
||||
use analyze::AnalyzeSender;
|
||||
use config::Config;
|
||||
use magic_link::MagicLinkStore;
|
||||
use transcribe::TranscribeSender;
|
||||
use web_session::SessionStore;
|
||||
|
||||
@@ -73,6 +75,7 @@ pub struct AppState {
|
||||
pub transcribe_tx: TranscribeSender,
|
||||
pub analyze_tx: AnalyzeSender,
|
||||
pub session_store: SessionStore,
|
||||
pub magic_link_store: MagicLinkStore,
|
||||
pub analyze_busy: AnalyzeBusy,
|
||||
pub transcribe_busy: TranscribeBusy,
|
||||
}
|
||||
@@ -101,6 +104,12 @@ impl FromRef<AppState> for SessionStore {
|
||||
}
|
||||
}
|
||||
|
||||
impl FromRef<AppState> for MagicLinkStore {
|
||||
fn from_ref(state: &AppState) -> Self {
|
||||
state.magic_link_store.clone()
|
||||
}
|
||||
}
|
||||
|
||||
impl FromRef<AppState> for AnalyzeBusy {
|
||||
fn from_ref(state: &AppState) -> Self {
|
||||
state.analyze_busy.clone()
|
||||
@@ -135,6 +144,7 @@ pub fn create_router(config: Arc<Config>) -> Router {
|
||||
transcribe_tx,
|
||||
analyze_tx,
|
||||
session_store: web_session::new_store(),
|
||||
magic_link_store: magic_link::new_store(),
|
||||
analyze_busy: AnalyzeBusy(Arc::new(AtomicBool::new(false))),
|
||||
transcribe_busy: TranscribeBusy(Arc::new(AtomicBool::new(false))),
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user