doido-auth 0.0.20

Unified authentication for Doido — AuthUser trait, extractors, strategies, and auth generators.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
//! Resolved auth subject identity before the full user model is loaded.

use serde::{Deserialize, Serialize};
use serde_json::Value;

/// A lightweight identity resolved by a strategy (session cookie, JWT, OAuth, …).
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub struct AuthIdentity {
    pub user_id: Value,
}

impl AuthIdentity {
    pub fn new(user_id: impl Into<Value>) -> Self {
        Self {
            user_id: user_id.into(),
        }
    }
}