Created
May 1, 2020 04:32
-
-
Save rajeevshukla/7ad8c90bb69952e2017d7b295931cb72 to your computer and use it in GitHub Desktop.
Form-Based Login success mapping
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
@RequestMapping("/formLoginSuccess") | |
public String getFormLoginInfo(Model model, @AuthenticationPrincipal Authentication authentication) { | |
// In form-based login flow you get UserDetails as principal while in Oauth based flow you get Oauth2User | |
UserDetails userDetails = (UserDetails) authentication.getPrincipal(); | |
model.addAttribute("name", userDetails.getUsername()); | |
return "home"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment