From 22eb8440c5d9bf3260fc06fecf3e99189f0e7508 Mon Sep 17 00:00:00 2001 From: Simon Bihel Date: Tue, 17 Oct 2023 09:14:04 +0100 Subject: [PATCH] Keep issuer url in client --- src/authorization.rs | 1 + src/client.rs | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/authorization.rs b/src/authorization.rs index 3e920c4..06b0f02 100644 --- a/src/authorization.rs +++ b/src/authorization.rs @@ -176,6 +176,7 @@ mod test { let client = crate::core::client::Client::new( ClientId::new("s6BhdRkqt3".to_string()), + IssuerUrl::new("https://server.example.com".into()).unwrap(), CredentialUrl::new("https://server.example.com/credential".into()).unwrap(), AuthUrl::new("https://server.example.com/authorize".into()).unwrap(), TokenUrl::new("https://server.example.com/token".into()).unwrap(), diff --git a/src/client.rs b/src/client.rs index 629cd55..ae293a9 100644 --- a/src/client.rs +++ b/src/client.rs @@ -13,7 +13,7 @@ use openidconnect::{ CoreSubjectIdentifierType, CoreTokenType, }, registration::ClientMetadata, - JsonWebKeyType, JweContentEncryptionAlgorithm, JweKeyManagementAlgorithm, + IssuerUrl, JsonWebKeyType, JweContentEncryptionAlgorithm, JweKeyManagementAlgorithm, }; use serde::{Deserialize, Serialize}; @@ -44,6 +44,7 @@ where StandardRevocableToken, BasicRevocationErrorResponse, >, + issuer: IssuerUrl, credential_endpoint: CredentialUrl, batch_credential_endpoint: Option, deferred_credential_endpoint: Option, @@ -64,6 +65,7 @@ where { pub fn new( client_id: ClientId, + issuer: IssuerUrl, credential_endpoint: CredentialUrl, auth_url: AuthUrl, token_url: TokenUrl, @@ -73,6 +75,7 @@ where .set_redirect_uri(redirect_uri); Self { inner, + issuer, credential_endpoint, batch_credential_endpoint: None, deferred_credential_endpoint: None, @@ -87,6 +90,7 @@ where field_getters_setters![ pub self [self] ["issuer metadata value"] { + set_issuer -> issuer[IssuerUrl], set_credential_endpoint -> credential_endpoint[CredentialUrl], set_batch_credential_endpoint -> batch_credential_endpoint[Option], set_deferred_credential_endpoint -> deferred_credential_endpoint[Option], @@ -106,6 +110,7 @@ where ) -> Self { Self::new( client_id, + issuer_metadata.credential_issuer().clone(), issuer_metadata.credential_endpoint().clone(), authorization_metadata.authorization_endpoint().clone(), authorization_metadata.token_endpoint().clone(),