about summary refs log tree commit diff
path: root/kittybox-rs/indieauth/src
diff options
context:
space:
mode:
authorVika <vika@fireburn.ru>2022-07-15 00:33:49 +0300
committerVika <vika@fireburn.ru>2022-07-15 00:33:49 +0300
commit36535deba96b19cf0af3fe56763f982fc6ae3fc0 (patch)
treede32fe15d7d2edcbdc377d885e63c5727144e59c /kittybox-rs/indieauth/src
parent0b47da2af8c02da35e310981919ad097e6897d16 (diff)
downloadkittybox-36535deba96b19cf0af3fe56763f982fc6ae3fc0.tar.zst
Add enum for requests that the authorization endpoint may encounter
Really, it should be `Either<AuthorizationRequest, GrantRequest>` but
either serde or axum got iffy about me deserializing it from a
form. Not sure which one.
Diffstat (limited to 'kittybox-rs/indieauth/src')
-rw-r--r--kittybox-rs/indieauth/src/lib.rs9
1 files changed, 8 insertions, 1 deletions
diff --git a/kittybox-rs/indieauth/src/lib.rs b/kittybox-rs/indieauth/src/lib.rs
index 3575132..9408eb6 100644
--- a/kittybox-rs/indieauth/src/lib.rs
+++ b/kittybox-rs/indieauth/src/lib.rs
@@ -156,6 +156,13 @@ pub enum GrantResponse {
     }
 }
 
+#[derive(Debug, Clone, Serialize, Deserialize)]
+#[serde(untagged)]
+pub enum RequestMaybeAuthorizationEndpoint {
+    Authorization(AuthorizationRequest),
+    Grant(GrantRequest)
+}
+
 #[derive(Debug, Serialize, Deserialize)]
 pub struct TokenIntrospectionRequest {
     pub token: String
@@ -250,7 +257,7 @@ pub struct TokenRevocationRequest {
     pub token: String
 }
 
-#[derive(Debug, Serialize, Deserialize)]
+#[derive(Debug, Clone, Copy, Serialize, Deserialize)]
 #[serde(rename_all = "snake_case")]
 #[serde(tag = "error")]
 pub enum IndieAuthError {