diff --git a/siopv2/README.md b/siopv2/README.md index 66ff50a5..755def0e 100644 --- a/siopv2/README.md +++ b/siopv2/README.md @@ -40,7 +40,6 @@ use wiremock::{ matchers::{method, path}, Mock, MockServer, ResponseTemplate, }; -use std::str::FromStr; lazy_static! { pub static ref MOCK_KEYPAIR: Keypair = Keypair::generate(&mut OsRng); diff --git a/siopv2/src/relying_party.rs b/siopv2/src/relying_party.rs index a812a4c0..78aa7223 100644 --- a/siopv2/src/relying_party.rs +++ b/siopv2/src/relying_party.rs @@ -42,7 +42,7 @@ mod tests { request::ResponseType, scope::{Scope, ScopeValue}, test_utils::{MemoryStorage, MockSubject, Storage}, - ClaimRequests, Provider, Registration, RequestUrl, StandardClaimsRequests, StandardClaimsValues, + Provider, Registration, RequestUrl, StandardClaimsRequests, StandardClaimsValues, }; use chrono::{Duration, Utc}; use lazy_static::lazy_static; @@ -115,16 +115,6 @@ mod tests { } }"#, ) - .claims(ClaimRequests { - id_token: Some(StandardClaimsRequests { - name: Some(IndividualClaimRequest::Null), - email: Some(IndividualClaimRequest::object().essential(true)), - address: Some(IndividualClaimRequest::Null), - updated_at: Some(IndividualClaimRequest::Null), - ..Default::default() - }), - ..Default::default() - }) .exp((Utc::now() + Duration::minutes(10)).timestamp()) .nonce("n-0S6_WzA2Mj".to_string()) .build() diff --git a/src/storage.rs b/src/storage.rs deleted file mode 100644 index ca33bf79..00000000 --- a/src/storage.rs +++ /dev/null @@ -1,55 +0,0 @@ -use crate::{claims::Claim, StandardClaims}; - -pub trait Storage { - fn fetch_claims(&self, request_claims: &StandardClaims) -> StandardClaims; -} - -#[derive(Default, Debug)] -pub struct MemoryStorage { - data: StandardClaims, -} - -impl MemoryStorage { - pub fn new(data: StandardClaims) -> Self { - MemoryStorage { data } - } -} - -impl Storage for MemoryStorage { - fn fetch_claims(&self, request_claims: &StandardClaims) -> StandardClaims { - let mut present = StandardClaims::default(); - - macro_rules! present_if { - ($claim:ident) => { - if let Some(claim) = &request_claims.$claim { - match claim { - Claim::Request(_) | Claim::Default => present.$claim = self.data.$claim.clone(), - _ => {} - } - } - }; - } - - present_if!(name); - present_if!(family_name); - present_if!(given_name); - present_if!(middle_name); - present_if!(nickname); - present_if!(preferred_username); - present_if!(profile); - present_if!(picture); - present_if!(website); - present_if!(gender); - present_if!(birthdate); - present_if!(zoneinfo); - present_if!(locale); - present_if!(updated_at); - present_if!(email); - present_if!(email_verified); - present_if!(address); - present_if!(phone_number); - present_if!(phone_number_verified); - - present - } -}