Skip to content

Commit e364ef4

Browse files
committed
add proper auth-error page
1 parent b257d83 commit e364ef4

File tree

4 files changed

+95
-4
lines changed

4 files changed

+95
-4
lines changed

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,7 @@
5050
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
5151
import org.springframework.context.ApplicationContext;
5252
import org.springframework.context.annotation.Bean;
53-
import org.springframework.context.annotation.Import;
5453
import org.springframework.core.env.Environment;
55-
import org.springframework.security.authentication.AuthenticationManager;
5654
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
5755
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
5856
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,10 +114,8 @@ public void configureHttpSecurity(HttpSecurity http, AuthorizedUrl anyRequestCon
114114
@Override
115115
public void onAuthenticationFailure(HttpServletRequest request, HttpServletResponse response,
116116
AuthenticationException exception) throws IOException, ServletException {
117-
118117
exception.printStackTrace();
119118
response.sendRedirect("/auth-error");
120-
121119
}
122120

123121
})
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/**
2+
* ContainerProxy
3+
*
4+
* Copyright (C) 2016-2020 Open Analytics
5+
*
6+
* ===========================================================================
7+
*
8+
* This program is free software: you can redistribute it and/or modify
9+
* it under the terms of the Apache License as published by
10+
* The Apache Software Foundation, either version 2 of the License, or
11+
* (at your option) any later version.
12+
*
13+
* This program is distributed in the hope that it will be useful,
14+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16+
* Apache License for more details.
17+
*
18+
* You should have received a copy of the Apache License
19+
* along with this program. If not, see <http://www.apache.org/licenses/>
20+
*/
21+
package eu.openanalytics.containerproxy.ui;
22+
23+
import javax.servlet.http.HttpServletRequest;
24+
25+
import org.springframework.stereotype.Controller;
26+
import org.springframework.ui.ModelMap;
27+
import org.springframework.web.bind.annotation.RequestMapping;
28+
import org.springframework.web.bind.annotation.RequestMethod;
29+
30+
import eu.openanalytics.containerproxy.api.BaseController;
31+
32+
@Controller
33+
public class AuthErrorController extends BaseController {
34+
35+
@RequestMapping(value = "/auth-error", method = RequestMethod.GET)
36+
public String getLoginPage(ModelMap map, HttpServletRequest request) {
37+
return "auth-error";
38+
}
39+
40+
}
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
<!--
2+
3+
ContainerProxy
4+
5+
Copyright (C) 2016-2020 Open Analytics
6+
7+
===========================================================================
8+
9+
This program is free software: you can redistribute it and/or modify
10+
it under the terms of the Apache License as published by
11+
The Apache Software Foundation, either version 2 of the License, or
12+
(at your option) any later version.
13+
14+
This program is distributed in the hope that it will be useful,
15+
but WITHOUT ANY WARRANTY; without even the implied warranty of
16+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17+
Apache License for more details.
18+
19+
You should have received a copy of the Apache License
20+
along with this program. If not, see <http://www.apache.org/licenses/>
21+
22+
-->
23+
<!DOCTYPE html>
24+
<html
25+
xmlns:th="http://www.thymeleaf.org"
26+
xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity4">
27+
28+
<head lang="en">
29+
<title th:text="${title}"></title>
30+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
31+
<link rel="stylesheet" media="screen" th:href="@{/webjars/bootstrap/3.4.1/css/bootstrap.min.css}"/>
32+
<link rel="stylesheet" media="screen" th:href="@{/css/login.css}"/>
33+
<link rel="stylesheet" media="screen" type="text/css" href="https://cdn.jsdelivr.net/bootstrap-social/5.1.1/bootstrap-social.css"/>
34+
<link rel="stylesheet" media="screen" type="text/css" href="https://cdn.jsdelivr.net/fontawesome/4.7.0/css/font-awesome.min.css"/>
35+
<script th:src="@{/webjars/jquery/3.5.0/jquery.min.js}"></script>
36+
<script th:src="@{/webjars/bootstrap/3.4.1/js/bootstrap.min.js}"></script>
37+
</head>
38+
39+
<body>
40+
<div class="container">
41+
<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>
44+
</div>
45+
46+
<style>
47+
h2 {
48+
margin-bottom: 20px;
49+
margin-top: 20px;
50+
}
51+
</style>
52+
53+
</body>
54+
55+
</html>

0 commit comments

Comments
 (0)