aboutsummaryrefslogtreecommitdiffstats
path: root/src/api/login.rs
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2026-11-16 20:52:59 +0000
committertv <tv@krebsco.de>2026-11-16 22:04:21 +0100
commitaf087a816f870ea943c61624d496b1d5e4d090b9 (patch)
treec6ccf79d6492c7721e169838f34a59ad524a4f1a /src/api/login.rs
parente92a712c1e1419c3d680396be827aa0a85748999 (diff)
api: in a swarm holding a store, a node takes no token another issued
At its API, a node of a swarm holding a store takes no token another node issued (`docs/store.md`, Members): whoever its operator lets in may use it, and its operator lets in nobody through another node. A token every node of a swarm takes would let whoever another operator let in in here too. `token::issued_here` refuses such a token (`ElsewhereIssued`), behind the `federation` feature.
Diffstat (limited to 'src/api/login.rs')
-rw-r--r--src/api/login.rs6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/api/login.rs b/src/api/login.rs
index c5cbe8d..0658a69 100644
--- a/src/api/login.rs
+++ b/src/api/login.rs
@@ -112,7 +112,11 @@ pub(crate) async fn bearer(
let now = state.clock.now_millis().as_u64();
let verified = {
let replica = state.doc.read().await;
- token::verify(&replica.doc, &text, &swarm, now)
+ let verified = token::verify(&replica.doc, &text, &swarm, now);
+ #[cfg(feature = "federation")]
+ let verified =
+ verified.and_then(|claims| token::issued_here(&replica.doc, state.local_id(), claims));
+ verified
}
.and_then(|claims| {
// Ended here where the document can't record it (no registry).