Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

Retrieve User information in Spring Security

Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
if (!(authentication instanceof AnonymousAuthenticationToken)) {
    String currentUserName = authentication.getName();
    return currentUserName;
}
Source by www.baeldung.com #
 
PREVIOUS NEXT
Tagged: #Retrieve #User #information #Spring #Security
ADD COMMENT
Topic
Name
1+8 =