From 6b3e27177504bb54b28208a14245603b5e95a890 Mon Sep 17 00:00:00 2001 From: Ian Date: Mon, 11 Mar 2024 10:02:22 -0400 Subject: [PATCH] FM2-616: Fix authentication --- .../module/fhir2/web/filter/AuthenticationFilter.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/omod/src/main/java/org/openmrs/module/fhir2/web/filter/AuthenticationFilter.java b/omod/src/main/java/org/openmrs/module/fhir2/web/filter/AuthenticationFilter.java index a8ed773d1..cc3987b5e 100644 --- a/omod/src/main/java/org/openmrs/module/fhir2/web/filter/AuthenticationFilter.java +++ b/omod/src/main/java/org/openmrs/module/fhir2/web/filter/AuthenticationFilter.java @@ -52,9 +52,8 @@ public void doFilter(ServletRequest request, ServletResponse response, FilterCha basicAuth = basicAuth.substring(6); // remove the leading "Basic " String decoded = new String(Base64.decodeBase64(basicAuth), StandardCharsets.UTF_8); String[] userAndPass = decoded.split(":"); - UsernamePasswordAuthenticationScheme usernamePasswordAuthenticationScheme = new UsernamePasswordAuthenticationScheme(); - usernamePasswordAuthenticationScheme - .authenticate(new UsernamePasswordCredentials(userAndPass[0], userAndPass[1])); + UsernamePasswordCredentials credentials = new UsernamePasswordCredentials(userAndPass[0], userAndPass[1]); + Context.authenticate(credentials); } catch (Exception e) { HttpServletResponse httpResponse = (HttpServletResponse) response;