summaryrefslogtreecommitdiff
path: root/src/indieauth.rs
diff options
context:
space:
mode:
authorJesse Morgan <jesse@jesterpm.net>2022-03-23 08:22:38 -0700
committerJesse Morgan <jesse@jesterpm.net>2022-03-23 08:22:38 -0700
commit3605650a90c0710aeee93930ba2622bf00a88b70 (patch)
tree80344b3717c3483cb1b07c9d1f7c8b6aa2a3199a /src/indieauth.rs
parent5ac0b170be23a2af4b93cb2287da1f7393db8165 (diff)
Add support for token extensionsv0.2.0
Diffstat (limited to 'src/indieauth.rs')
-rw-r--r--src/indieauth.rs21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/indieauth.rs b/src/indieauth.rs
new file mode 100644
index 0000000..0f04b84
--- /dev/null
+++ b/src/indieauth.rs
@@ -0,0 +1,21 @@
+//! Extras for working with IndieAuth endpoints.
+
+use oauth2::ExtraTokenFields;
+use serde::{Deserialize, Serialize};
+
+/// An IndieAuth access token and introspection reponse has an additional
+/// `me` field.
+///
+/// See https://indieauth.spec.indieweb.org/#access-token-verification
+#[derive(Debug, Serialize, Deserialize, Clone)]
+pub struct IndieAuthToken {
+ me: String,
+}
+
+impl IndieAuthToken {
+ pub fn me(&self) -> &str {
+ &self.me
+ }
+}
+
+impl ExtraTokenFields for IndieAuthToken {}