From 9a1560ba020c724df7ab0d8e5b392a3140df30c4 Mon Sep 17 00:00:00 2001 From: Adam Cattermole Date: Fri, 16 Aug 2024 16:00:29 +0100 Subject: [PATCH] Pass in the host to set in context_extensions Signed-off-by: Adam Cattermole --- src/service/auth.rs | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/service/auth.rs b/src/service/auth.rs index a623bc8e..35a82cd9 100644 --- a/src/service/auth.rs +++ b/src/service/auth.rs @@ -30,11 +30,11 @@ impl AuthService { } } - pub fn message() -> CheckRequest { - AuthService::build_check_req() + pub fn message(ce_host: String) -> CheckRequest { + AuthService::build_check_req(ce_host) } - fn build_check_req() -> CheckRequest { + fn build_check_req(ce_host: String) -> CheckRequest { let mut auth_req = CheckRequest::default(); let mut attr = AttributeContext::default(); attr.set_request(AuthService::build_request()); @@ -46,12 +46,8 @@ impl AuthService { get_attribute::("source.address").unwrap_or_default(), get_attribute::("source.port").unwrap_or_default() as u32, )); - // todo(adam-cattermole): for now we set the context_extensions to the request host - // but this should take other info into account - let context_extensions = HashMap::from([( - "host".to_string(), - attr.get_request().get_http().host.to_owned(), - )]); + // the ce_host is the identifier for authorino to determine which authconfig to use + let context_extensions = HashMap::from([("host".to_string(), ce_host)]); attr.set_context_extensions(context_extensions); attr.set_metadata_context(Metadata::default()); auth_req.set_attributes(attr);