From 7bb71aa7fe2732b70b7a4c60184a0953f3730717 Mon Sep 17 00:00:00 2001 From: Matthew Scheirer Date: Wed, 15 Nov 2017 22:52:50 -0500 Subject: [PATCH] Add serialize support to userinfo (ex to write it to a database) --- src/discovery.rs | 2 +- src/lib.rs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/discovery.rs b/src/discovery.rs index f6fedff..a515f0e 100644 --- a/src/discovery.rs +++ b/src/discovery.rs @@ -17,7 +17,7 @@ pub(crate) fn secure(url: &Url) -> Result<(), Error> { } // TODO I wish we could impl default for this, but you cannot have a config without issuer etc -#[derive(Debug, Deserialize, Serialize)] +#[derive(Debug, Serialize, Deserialize)] pub struct Config { #[serde(with = "url_serde")] pub issuer: Url, #[serde(with = "url_serde")] pub authorization_endpoint: Url, diff --git a/src/lib.rs b/src/lib.rs index 94319f4..b499462 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -439,7 +439,7 @@ pub struct Options { /// The userinfo struct contains all possible userinfo fields regardless of scope. [See spec.](https://openid.net/specs/openid-connect-basic-1_0.html#StandardClaims) // TODO is there a way to use claims_supported in config to simplify this struct? -#[derive(Deserialize, Validate)] +#[derive(Serialize, Deserialize, Validate)] pub struct Userinfo { pub sub: String, #[serde(default)] pub name: Option, @@ -510,7 +510,7 @@ impl Prompt { } /// Address Claim struct. Can be only formatted, only the rest, or both. -#[derive(Deserialize)] +#[derive(Serialize, Deserialize)] pub struct Address { #[serde(default)] pub formatted: Option, #[serde(default)] pub street_address: Option,