diff options
author | Vika <vika@fireburn.ru> | 2022-02-21 07:34:55 +0300 |
---|---|---|
committer | Vika <vika@fireburn.ru> | 2022-02-21 07:34:55 +0300 |
commit | 2e54681af0bc76ed22ce43f8126a029e600ece93 (patch) | |
tree | d00626394908e9e4ec1c6169757ccf0194ba10bd /src/lib.rs | |
parent | 9e4c4551a786830bf34d74c4ef111a8ed292fa9f (diff) | |
download | kittybox-2e54681af0bc76ed22ce43f8126a029e600ece93.tar.zst |
Add a module for IndieAuth bearer token auth
require_token() uses a token endpoint URI and an HTTP client to query the token endpoint and return a User object if the user was authorized, or rejecting with IndieAuthError if not. It is recommended to use recover() and catch the IndieAuthError at the application level to show a "not authorized" error message to the user. This function is more intended for API consumption, but is general enough to permit using in other scenarios. TODO: make a variant that returns Option<User> instead of rejecting
Diffstat (limited to 'src/lib.rs')
-rw-r--r-- | src/lib.rs | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/lib.rs b/src/lib.rs index 2585227..93e4593 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,14 +1,12 @@ -//use tide::{Request, Response}; +#[allow(unused_imports)] use warp::Filter; -/*pub mod database; -mod frontend; -mod indieauth; -mod micropub;*/ + pub mod metrics; /// Database abstraction layer for Kittybox, allowing the CMS to work with any kind of database. pub mod database; pub mod micropub; -//pub mod indieauth; +pub mod indieauth; +//pub mod frontend; /*use crate::indieauth::IndieAuthMiddleware; use crate::micropub::CORSMiddleware;*/ |