diff options
author | Vika <vika@fireburn.ru> | 2024-08-24 21:45:15 +0300 |
---|---|---|
committer | Vika <vika@fireburn.ru> | 2024-08-24 21:45:15 +0300 |
commit | d4fb528c14689263635b006e332cbca8d59d196a (patch) | |
tree | da023d062aff012830bbd477fb06272acbff9af7 /indieauth | |
parent | e6d5276d1bfec1f277453914f8984a13398ed961 (diff) | |
download | kittybox-d4fb528c14689263635b006e332cbca8d59d196a.tar.zst |
kittybox-indieauth: nicer Debug impl for Metadata
Now the URLs are shown in their serialized form.
Diffstat (limited to 'indieauth')
-rw-r--r-- | indieauth/src/lib.rs | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/indieauth/src/lib.rs b/indieauth/src/lib.rs index c393b3d..b3ec098 100644 --- a/indieauth/src/lib.rs +++ b/indieauth/src/lib.rs @@ -141,7 +141,7 @@ pub enum GrantType { /// client_id_metadata_document_supported: true, /// }; /// ``` -#[derive(Debug, Clone, Serialize, Deserialize)] +#[derive(Clone, Serialize, Deserialize)] pub struct Metadata { /// The server's issuer identifier. The issuer identifier is a URL /// that uses the "https" scheme and has no query or fragment @@ -225,6 +225,28 @@ pub struct Metadata { pub client_id_metadata_document_supported: bool } +impl std::fmt::Debug for Metadata { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.debug_struct("Metadata") + .field("issuer", &self.issuer.as_str()) + .field("authorization_endpoint", &self.issuer.as_str()) + .field("token_endpoint", &self.issuer.as_str()) + .field("introspection_endpoint", &self.issuer.as_str()) + .field("introspection_endpoint_auth_methods_supported", &self.introspection_endpoint_auth_methods_supported) + .field("revocation_endpoint", &self.revocation_endpoint.as_ref().map(Url::as_str)) + .field("revocation_endpoint_auth_methods_supported", &self.revocation_endpoint_auth_methods_supported) + .field("scopes_supported", &self.scopes_supported) + .field("response_types_supported", &self.response_types_supported) + .field("grant_types_supported", &self.grant_types_supported) + .field("service_documentation", &self.service_documentation.as_ref().map(Url::as_str)) + .field("code_challenge_methods_supported", &self.code_challenge_methods_supported) + .field("authorization_response_iss_parameter_supported", &self.authorization_response_iss_parameter_supported) + .field("userinfo_endpoint", &self.userinfo_endpoint.as_ref().map(Url::as_str)) + .field("client_id_metadata_document_supported", &self.client_id_metadata_document_supported) + .finish() + } +} + fn ref_identity(v: &bool) -> bool { *v } #[cfg(feature = "axum")] |