From 6e20a3c51756c2e84290da6ec53b89a5fc58c0fc Mon Sep 17 00:00:00 2001 From: Vika Date: Wed, 28 Sep 2022 03:55:48 +0300 Subject: Use tokens from the auth backend to authenticate for Micropub --- kittybox-rs/indieauth/src/lib.rs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'kittybox-rs/indieauth/src') 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 -- cgit 1.4.1