August 2017
Beginner to intermediate
370 pages
8h 37m
English
When the user clicks on logout, the Angular app invokes a logout API which, primarily, invalidates the HTTP session and removes the authentication object from the SecurityContextHolder object. Recall the SecurityContextHolder object is used to store the SecurityContext object, which holds on to the Authentication object. The following represents the code in the Spring app which invokes the logout API on the SecurityContextLogoutHandler instance:
@GetMapping(value="/logout")public ExecutionStatus logout (HttpServletRequest request, HttpServletResponse response) { Authentication auth = SecurityContextHolder.getContext().getAuthentication(); if (auth != null){ new SecurityContextLogoutHandler().logout(request, response, ...
Read now
Unlock full access