Last active
November 20, 2017 13:31
-
-
Save odedia/94f4d97d2ca22757d4af34be01479b3e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.odedia.springsession.rest; | |
| import javax.servlet.http.HttpServletRequest; | |
| import javax.servlet.http.HttpSession; | |
| import org.springframework.web.bind.annotation.GetMapping; | |
| import org.springframework.web.bind.annotation.RestController; | |
| @RestController | |
| public class LoginManagementResource { | |
| @GetMapping("/login") | |
| public String login(HttpServletRequest request, HttpSession session) { | |
| if (!session.isNew()) { | |
| session.invalidate(); | |
| } | |
| return "login"; | |
| } | |
| @GetMapping("/logout") | |
| public String logout() { | |
| return "redirect:/login"; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment