How to Get the Current Logged-In Username or id in Spring Security
CustomUserDetail vasitesile
Object principal = SecurityContextHolder .getContext() .getAuthentication() .getPrincipal(); if(principal instanceof CustomUserDetail){ //some code } else { //some code }
Comments
Post a Comment