Browse Source

Reuse error handling

Issue gh-1189
pull/1210/head
Joe Grandja 3 years ago
parent
commit
043acf17b7
  1. 2
      samples/featured-authorizationserver/src/main/java/sample/web/DefaultErrorController.java
  2. 19
      samples/featured-authorizationserver/src/main/resources/templates/access-denied.html
  3. 19
      samples/featured-authorizationserver/src/main/resources/templates/error.html

2
samples/featured-authorizationserver/src/main/java/sample/web/DeviceErrorController.java → samples/featured-authorizationserver/src/main/java/sample/web/DefaultErrorController.java

@ -30,7 +30,7 @@ import org.springframework.web.servlet.ModelAndView;
* @since 1.1 * @since 1.1
*/ */
@Controller @Controller
public class DeviceErrorController implements ErrorController { public class DefaultErrorController implements ErrorController {
@RequestMapping("/error") @RequestMapping("/error")
public ModelAndView handleError(HttpServletRequest request) { public ModelAndView handleError(HttpServletRequest request) {

19
samples/featured-authorizationserver/src/main/resources/templates/access-denied.html

@ -3,23 +3,18 @@
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>Device Grant Example</title> <title>Spring Security Example</title>
<link rel="stylesheet" href="/webjars/bootstrap/css/bootstrap.css" th:href="@{/webjars/bootstrap/css/bootstrap.css}" /> <link rel="stylesheet" href="/webjars/bootstrap/css/bootstrap.css" th:href="@{/webjars/bootstrap/css/bootstrap.css}" />
<link rel="stylesheet" href="/assets/css/style.css" th:href="@{/assets/css/style.css}" /> <link rel="stylesheet" href="/assets/css/style.css" th:href="@{/assets/css/style.css}" />
</head> </head>
<body> <body>
<div class="jumbotron"> <div class="container">
<div class="container"> <div class="row">
<div class="row"> <div class="col-md-8">
<div class="col-md-8"> <h2>Access Denied</h2>
<h2>Access Denied</h2> <p>You have denied access.</p>
<p>You have denied access. Please return to your device to continue.</p>
</div>
<div class="col-md-4">
<img src="https://cdn.pixabay.com/photo/2017/07/03/15/20/technology-2468063_1280.png" class="img-responsive" alt="Devices">
</div>
</div> </div>
</div> </div>
</div> </div>
</body> </body>
</html> </html>

19
samples/featured-authorizationserver/src/main/resources/templates/error.html

@ -3,23 +3,18 @@
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>Device Grant Example</title> <title>Spring Security Example</title>
<link rel="stylesheet" href="/webjars/bootstrap/css/bootstrap.css" th:href="@{/webjars/bootstrap/css/bootstrap.css}" /> <link rel="stylesheet" href="/webjars/bootstrap/css/bootstrap.css" th:href="@{/webjars/bootstrap/css/bootstrap.css}" />
<link rel="stylesheet" href="/assets/css/style.css" th:href="@{/assets/css/style.css}" /> <link rel="stylesheet" href="/assets/css/style.css" th:href="@{/assets/css/style.css}" />
</head> </head>
<body> <body>
<div class="jumbotron"> <div class="container">
<div class="container"> <div class="row">
<div class="row"> <div class="col-md-8">
<div class="col-md-8"> <h2>Error</h2>
<h2>Error</h2> <p th:text="${message}"></p>
<p th:text="${message}"></p>
</div>
<div class="col-md-4">
<img src="https://cdn.pixabay.com/photo/2017/07/03/15/20/technology-2468063_1280.png" class="img-responsive" alt="Devices">
</div>
</div> </div>
</div> </div>
</div> </div>
</body> </body>
</html> </html>

Loading…
Cancel
Save