code review feedback

This commit is contained in:
Jason Roberts 2021-09-17 14:17:33 -04:00
parent cb374042f5
commit 4051fe0849
2 changed files with 14 additions and 3 deletions

View File

@ -343,7 +343,7 @@ public class OpenApiInterceptor {
String page = extractPageName(theRequestDetails, PAGE_SYSTEM);
context.setVariable("PAGE", page);
populateOIDCVariables(context);
populateOIDCVariables(theRequestDetails, context);
String outcome = myTemplateEngine.process("index.html", context);
@ -351,8 +351,8 @@ public class OpenApiInterceptor {
theResponse.getWriter().close();
}
protected void populateOIDCVariables(WebContext context) {
context.setVariable("OAUTH2_REDIRECT_URL_PROPERTY", "");
protected void populateOIDCVariables(ServletRequestDetails theRequestDetails, WebContext theContext) {
theContext.setVariable("OAUTH2_REDIRECT_URL_PROPERTY", "");
}
private String extractPageName(ServletRequestDetails theRequestDetails, String theDefault) {

View File

@ -213,6 +213,17 @@ public class OpenApiInterceptorTest {
assertEquals(null, url);
}
@Test
public void testStandardRedirectScriptIsAccessible() throws IOException {
myServer.getRestfulServer().registerInterceptor(new AddResourceCountsInterceptor());
myServer.getRestfulServer().registerInterceptor(new OpenApiInterceptor());
HttpGet get = new HttpGet("http://localhost:" + myServer.getPort() + "/fhir/swagger-ui/oauth2-redirect.html");
try (CloseableHttpResponse response = myClient.execute(get)) {
assertEquals(200, response.getStatusLine().getStatusCode());
}
}
private String fetchSwaggerUi(String url) throws IOException {
String resp;
HttpGet get = new HttpGet(url);