oxide_framework_core/auth/
config.rs1#[derive(Debug, Clone)]
5pub struct AuthConfig {
6 pub secret: Vec<u8>,
8 pub issuer: Option<String>,
10 pub audience: Option<String>,
12 pub bearer_token: bool,
14 pub session_cookie_name: Option<String>,
16}
17
18impl AuthConfig {
19 pub fn new(secret: impl Into<Vec<u8>>) -> Self {
21 Self {
22 secret: secret.into(),
23 issuer: None,
24 audience: None,
25 bearer_token: true,
26 session_cookie_name: None,
27 }
28 }
29
30 pub fn with_session_cookie(mut self, cookie_name: impl Into<String>) -> Self {
32 self.session_cookie_name = Some(cookie_name.into());
33 self
34 }
35
36 pub fn with_issuer(mut self, issuer: impl Into<String>) -> Self {
37 self.issuer = Some(issuer.into());
38 self
39 }
40
41 pub fn with_audience(mut self, audience: impl Into<String>) -> Self {
42 self.audience = Some(audience.into());
43 self
44 }
45
46 pub fn enable_bearer(mut self, yes: bool) -> Self {
48 self.bearer_token = yes;
49 self
50 }
51}
52