Skip to content

Commit 7b815f0

Browse files
committed
Fix review remarks + show configurable application name inside auth-error
1 parent e364ef4 commit 7b815f0

File tree

4 files changed

+13
-5
lines changed

4 files changed

+13
-5
lines changed

src/main/java/eu/openanalytics/containerproxy/ContainerProxyApplication.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,8 @@ private static void setDefaultProperties(SpringApplication app ) {
155155

156156
// disable logging of requests, since this reads part of the requests and therefore undertow is unable to correctly handle those requests
157157
properties.put("logging.level.org.springframework.web.servlet.DispatcherServlet", "INFO");
158+
159+
properties.put("spring.application.name", "ContainerProxy");
158160
app.setDefaultProperties(properties);
159161
}
160162

src/main/java/eu/openanalytics/containerproxy/auth/impl/OpenIDAuthenticationBackend.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ public void configureHttpSecurity(HttpSecurity http, AuthorizedUrl anyRequestCon
114114
@Override
115115
public void onAuthenticationFailure(HttpServletRequest request, HttpServletResponse response,
116116
AuthenticationException exception) throws IOException, ServletException {
117-
exception.printStackTrace();
117+
log.error(exception);
118118
response.sendRedirect("/auth-error");
119119
}
120120

src/main/java/eu/openanalytics/containerproxy/ui/AuthErrorController.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,10 @@
2020
*/
2121
package eu.openanalytics.containerproxy.ui;
2222

23+
import javax.inject.Inject;
2324
import javax.servlet.http.HttpServletRequest;
2425

26+
import org.springframework.core.env.Environment;
2527
import org.springframework.stereotype.Controller;
2628
import org.springframework.ui.ModelMap;
2729
import org.springframework.web.bind.annotation.RequestMapping;
@@ -32,9 +34,13 @@
3234
@Controller
3335
public class AuthErrorController extends BaseController {
3436

37+
@Inject
38+
private Environment environment;
39+
3540
@RequestMapping(value = "/auth-error", method = RequestMethod.GET)
36-
public String getLoginPage(ModelMap map, HttpServletRequest request) {
41+
public String getAuthErrorPage(ModelMap map, HttpServletRequest request) {
42+
map.put("application_name", environment.getProperty("spring.application.name"));
3743
return "auth-error";
38-
}
44+
}
3945

4046
}

src/main/resources/templates/auth-error.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@
3939
<body>
4040
<div class="container">
4141
<h2>An error occurred during the authentication procedure.</h2>
42-
<p><b>If you are a user of ShinyProxy:</b> please report this issue to your administrator.</p>
43-
<p><b>If you are an administrator of ShinyProxy:</b> this error page is typically shown because of an configuration error in the OpenID setup. See the ShinyProxy logs for more information.</p>
42+
<p><b>If you are a user of <span th:text="${application_name}"></span>:</b> please report this issue to your administrator.</p>
43+
<p><b>If you are an administrator of <span th:text="${application_name}"></span>:</b> this error page is typically shown because of an configuration error in the OpenID setup. See the ShinyProxy logs for more information.</p>
4444
</div>
4545

4646
<style>

0 commit comments

Comments
 (0)