about summary refs log tree commit diff
path: root/kittybox-rs/indieauth/src/lib.rs
diff options
context:
space:
mode:
authorVika <vika@fireburn.ru>2022-09-28 03:55:48 +0300
committerVika <vika@fireburn.ru>2022-09-28 03:55:48 +0300
commit6e20a3c51756c2e84290da6ec53b89a5fc58c0fc (patch)
treea360c40dce27b7804001038babd4631476232001 /kittybox-rs/indieauth/src/lib.rs
parent2f02bf76a40c971b9404aa0913bc8baa7dfde24c (diff)
downloadkittybox-6e20a3c51756c2e84290da6ec53b89a5fc58c0fc.tar.zst
Use tokens from the auth backend to authenticate for Micropub
Diffstat (limited to 'kittybox-rs/indieauth/src/lib.rs')
-rw-r--r--kittybox-rs/indieauth/src/lib.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/kittybox-rs/indieauth/src/lib.rs b/kittybox-rs/indieauth/src/lib.rs
index 22dcdbd..a60cc42 100644
--- a/kittybox-rs/indieauth/src/lib.rs
+++ b/kittybox-rs/indieauth/src/lib.rs
@@ -538,6 +538,11 @@ impl TokenData {
             std::time::UNIX_EPOCH + std::time::Duration::from_secs(time)
         })
     }
+
+    /// Check if a certain scope is allowed for this token.
+    pub fn check_scope(&self, scope: &Scope) -> bool {
+        self.scope.has(scope)
+    }
 }
 
 // I don't like this type, because it could've been represented