Add authentication from upstream providers (#107)
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
Let BasicOIDC delegate authentication to upstream providers (Google, GitHub, GitLab, Keycloak...) Reviewed-on: #107
This commit is contained in:
@@ -11,8 +11,10 @@ use base64::Engine as _;
|
||||
use crate::utils::err::Res;
|
||||
use crate::utils::string_utils::rand_str;
|
||||
|
||||
const JWK_USE_SIGN: &str = "sig";
|
||||
|
||||
/// Json Web Key <https://datatracker.ietf.org/doc/html/rfc7517>
|
||||
#[derive(serde::Serialize, serde::Deserialize)]
|
||||
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
|
||||
pub struct JsonWebKey {
|
||||
#[serde(rename = "alg")]
|
||||
algorithm: String,
|
||||
@@ -24,6 +26,8 @@ pub struct JsonWebKey {
|
||||
modulus: String,
|
||||
#[serde(rename = "e")]
|
||||
public_exponent: String,
|
||||
#[serde(rename = "use", skip_serializing_if = "Option::is_none")]
|
||||
usage: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
@@ -44,6 +48,7 @@ impl JWTSigner {
|
||||
key_id: self.0.key_id().as_ref().unwrap().to_string(),
|
||||
public_exponent: BASE64_URL_URL_SAFE.encode(components.e),
|
||||
modulus: BASE64_URL_SAFE_NO_PAD.encode(components.n),
|
||||
usage: Some(JWK_USE_SIGN.to_string()),
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user