mirror of
https://github.com/lennart-k/rustical.git
synced 2025-12-14 08:12:24 +00:00
Refactoring of frontend and OIDC
I want to make some code reusable for other projects
This commit is contained in:
@@ -1,35 +1,10 @@
|
||||
use openidconnect::{ClientId, ClientSecret, IssuerUrl, Scope};
|
||||
pub use crate::oidc::OidcConfig;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
fn default_true() -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Serialize, Clone, Default)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum UserIdClaim {
|
||||
// The correct option
|
||||
Sub,
|
||||
// The more ergonomic option if you know what you're doing
|
||||
#[default]
|
||||
PreferredUsername,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Serialize, Clone)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
pub struct OidcConfig {
|
||||
pub name: String,
|
||||
pub issuer: IssuerUrl,
|
||||
pub client_id: ClientId,
|
||||
pub client_secret: Option<ClientSecret>,
|
||||
pub scopes: Vec<Scope>,
|
||||
#[serde(default)]
|
||||
pub allow_sign_up: bool,
|
||||
pub require_group: Option<String>,
|
||||
#[serde(default)]
|
||||
pub claim_userid: UserIdClaim,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Serialize, Clone)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
pub struct FrontendConfig {
|
||||
|
||||
Reference in New Issue
Block a user