Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Autowired
- private AuthHandler authHandler;
- @GetMapping("/userLogin")
- @ResponseBody
- public String userLogin() {
- if(authHandler.isLogged()) {
- return "User is already logged in";
- } else {
- authHandler.setLogged(true);
- return "User has been logged in";
- }
- }
- @GetMapping("/userLogOut")
- @ResponseBody
- public String userLogOut() {
- if(authHandler.isLogged()) {
- authHandler.setLogged(false);
- return "You have been logged out";
- } else {
- return "You are not logged in, we can't logg you out";
- }
- }
- @GetMapping("/userCheckAuth")
- @ResponseBody
- public String userCheckAuth() {
- if(authHandler.isLogged()) {
- return "You have access to the page";
- } else {
- return "You don't have access to this site";
- }
- }
Add Comment
Please, Sign In to add comment