implement configurable login options

This commit is contained in:
mbecker20
2022-12-30 05:05:45 +00:00
parent f74faaecf8
commit 80ced82131
11 changed files with 156 additions and 53 deletions

View File

@@ -84,7 +84,8 @@ impl GoogleOauthClient {
}
pub fn get_google_user(&self, id_token: &str) -> anyhow::Result<GoogleUser> {
let t: Token<Value, GoogleUser, jwt::Unverified> = Token::parse_unverified(id_token).context("failed to parse id_token")?;
let t: Token<Value, GoogleUser, jwt::Unverified> =
Token::parse_unverified(id_token).context("failed to parse id_token")?;
Ok(t.claims().to_owned())
}

View File

@@ -28,11 +28,16 @@ pub struct CoreConfig {
#[serde(default = "default_jwt_valid_for")]
pub jwt_valid_for: Timelength,
// used to verify validity from github webhooks
pub github_webhook_secret: String,
// integration with slack app
pub slack_url: Option<String>,
// enable login with local auth
pub local_auth: bool,
// github integration
pub github_webhook_secret: String,
pub github_oauth: OauthCredentials,
// google integration
@@ -52,7 +57,11 @@ fn default_jwt_valid_for() -> Timelength {
#[derive(Serialize, Deserialize, Debug, Clone, Default)]
pub struct OauthCredentials {
#[serde(default)]
pub enabled: bool,
#[serde(default)]
pub id: String,
#[serde(default)]
pub secret: String,
}