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(Authentication authentication) {
        return authentication.getName();
    }
}
Source by www.baeldung.com #
 
PREVIOUS NEXT
Tagged: #Retrieve #User #information #Spring #Security
ADD COMMENT
Topic
Name
6+1 =