From 4f4abbf42176d174ca084a4a142f18ac88142bf4 Mon Sep 17 00:00:00 2001 From: bstewartlg <114590619+bstewartlg@users.noreply.github.com> Date: Fri, 28 Jun 2024 18:45:18 -0400 Subject: [PATCH] Auth url base change --- .../java/org/hl7/davinci/priorauth/endpoint/Metadata.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/hl7/davinci/priorauth/endpoint/Metadata.java b/src/main/java/org/hl7/davinci/priorauth/endpoint/Metadata.java index e897fc4d..5eebd9e6 100644 --- a/src/main/java/org/hl7/davinci/priorauth/endpoint/Metadata.java +++ b/src/main/java/org/hl7/davinci/priorauth/endpoint/Metadata.java @@ -171,7 +171,11 @@ private CapabilityStatementRestSecurityComponent getSecurity(HttpServletRequest CapabilityStatementRestSecurityComponent security = new CapabilityStatementRestSecurityComponent(); security.setCors(true); Extension oauthUris = new Extension("http://fhir-registry.smarthealthit.org/StructureDefinition/oauth-uris"); - String uriBase = request.getRequestURL().toString().replace(request.getRequestURI(), ""); + String uriBase = request.getScheme() + "://" + request.getServerName() + + ("http".equals(request.getScheme()) && request.getServerPort() == 80 + || "https".equals(request.getScheme()) && request.getServerPort() == 443 ? "" + : ":" + request.getServerPort()); + if (System.getenv("TOKEN_BASE_URI") != null && !System.getenv("TOKEN_BASE_URI").isBlank()) { uriBase = System.getenv("TOKEN_BASE_URI"); }