Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

Retrieve User information in Spring Security

@Controller
public class SecurityController {

    @RequestMapping(value = "/username", method = RequestMethod.GET)
    @ResponseBody
    public String currentUserName(Principal principal) {
        return principal.getName();
    }
}
Source by www.baeldung.com #
 
PREVIOUS NEXT
Tagged: #Retrieve #User #information #Spring #Security
ADD COMMENT
Topic
Name
8+5 =