Implement a functional logout for spring-boot-keycloak
This commit is contained in:
parent
53eedb7ad5
commit
37c6fe33d7
|
@ -8,6 +8,8 @@ import java.security.Principal;
|
|||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
@Controller
|
||||
public class WebController {
|
||||
|
||||
|
@ -19,6 +21,12 @@ public class WebController {
|
|||
return "external";
|
||||
}
|
||||
|
||||
@GetMapping("/logout")
|
||||
public String logout(HttpServletRequest request) throws Exception {
|
||||
request.logout();
|
||||
return "redirect:/";
|
||||
}
|
||||
|
||||
@GetMapping(path = "/customers")
|
||||
public String customers(Principal principal, Model model) {
|
||||
addCustomers();
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
</table>
|
||||
<div id="pagefoot" th:include="layout :: footerFragment">Footer
|
||||
</div>
|
||||
<a href="/logout">Logout</a>
|
||||
</div>
|
||||
<!-- container -->
|
||||
</body>
|
||||
|
|
Loading…
Reference in New Issue