From df524c7139184d465a1c243adcda3175bf0e33bc Mon Sep 17 00:00:00 2001 From: BlockListed <44610569+BlockListed@users.noreply.github.com> Date: Sat, 9 Sep 2023 14:31:38 +0200 Subject: [PATCH] make PublicToken support multi-domains --- src/api/core/public.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/api/core/public.rs b/src/api/core/public.rs index 74f79a3e..14f2ab78 100644 --- a/src/api/core/public.rs +++ b/src/api/core/public.rs @@ -217,11 +217,13 @@ impl<'r> FromRequest<'r> for PublicToken { err_handler!("Token expired"); } // Check if claims.iss is host|claims.scope[0] - let host = match auth::Host::from_request(request).await { - Outcome::Success(host) => host, + let host_info = match auth::HostInfo::from_request(request).await { + Outcome::Success(host_info) => host_info, _ => err_handler!("Error getting Host"), }; - let complete_host = format!("{}|{}", host.host, claims.scope[0]); + // TODO check if this is fine + // using origin, because that's what they're generated with in auth.rs + let complete_host = format!("{}|{}", host_info.origin, claims.scope[0]); if complete_host != claims.iss { err_handler!("Token not issued by this server"); }