[pbs-devel] [PATCH proxmox-openid-rs v2 5/6] allow to configure acr values

Dietmar Maurer dietmar at proxmox.com
Fri Aug 6 13:57:43 CEST 2021


---
 src/lib.rs | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/src/lib.rs b/src/lib.rs
index 555e5ad..53b08c8 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -36,6 +36,7 @@ use openidconnect::{
     Scope,
     UserInfoClaims,
     AdditionalClaims,
+    AuthenticationContextClass,
 };
 
 /// Stores Additional Claims into a serde_json::Value;
@@ -55,6 +56,8 @@ pub struct OpenIdConfig {
     pub scopes: Option<Vec<String>>,
     #[serde(skip_serializing_if="Option::is_none")]
     pub prompt: Option<String>,
+    #[serde(skip_serializing_if="Option::is_none")]
+    pub acr_values: Option<Vec<String>>,
 }
 
 pub struct OpenIdAuthenticator {
@@ -175,6 +178,12 @@ impl OpenIdAuthenticator {
             }
         }
 
+        if let Some(ref acr_values) = self.config.acr_values {
+            for acr in acr_values.clone() {
+                request = request.add_auth_context_value(AuthenticationContextClass::new(acr));
+            }
+        }
+
         let (authorize_url, _csrf_state, _nonce) = request.url();
 
         Ok(authorize_url.to_string())
-- 
2.30.2






More information about the pbs-devel mailing list