Start to build init openid login
This commit is contained in:
@ -112,9 +112,9 @@ pub struct AppConfig {
|
||||
#[arg(long, env, default_value = "bar")]
|
||||
pub oidc_client_secret: String,
|
||||
|
||||
/// OpenID login callback URL
|
||||
/// OpenID login redirect URL
|
||||
#[arg(long, env, default_value = "http://localhost:3000/oidc_cb")]
|
||||
pub oidc_callback_url: String,
|
||||
pub oidc_redirect_url: String,
|
||||
}
|
||||
|
||||
lazy_static::lazy_static! {
|
||||
@ -155,29 +155,29 @@ impl AppConfig {
|
||||
}
|
||||
|
||||
/// Get OpenID providers configuration
|
||||
pub fn openid_providers(&self) -> Vec<OIDCProvider> {
|
||||
pub fn openid_providers(&self) -> Vec<OIDCProvider<'_>> {
|
||||
if self.disable_oidc {
|
||||
return vec![];
|
||||
}
|
||||
|
||||
return vec![OIDCProvider {
|
||||
id: "first_prov".to_string(),
|
||||
client_id: self.oidc_client_id.to_string(),
|
||||
client_secret: self.oidc_client_secret.to_string(),
|
||||
configuration_url: self.oidc_configuration_url.to_string(),
|
||||
name: self.oidc_provider_name.to_string(),
|
||||
}];
|
||||
vec![OIDCProvider {
|
||||
id: "first_prov",
|
||||
client_id: self.oidc_client_id.as_str(),
|
||||
client_secret: self.oidc_client_secret.as_str(),
|
||||
configuration_url: self.oidc_configuration_url.as_str(),
|
||||
name: self.oidc_provider_name.as_str(),
|
||||
}]
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, serde::Serialize)]
|
||||
pub struct OIDCProvider {
|
||||
pub id: String,
|
||||
pub struct OIDCProvider<'a> {
|
||||
pub id: &'a str,
|
||||
#[serde(skip_serializing)]
|
||||
pub client_id: String,
|
||||
pub client_id: &'a str,
|
||||
#[serde(skip_serializing)]
|
||||
pub client_secret: String,
|
||||
pub client_secret: &'a str,
|
||||
#[serde(skip_serializing)]
|
||||
pub configuration_url: String,
|
||||
pub name: String,
|
||||
pub configuration_url: &'a str,
|
||||
pub name: &'a str,
|
||||
}
|
||||
|
Reference in New Issue
Block a user