sql >> Base de Datos >  >> RDS >> Mysql

Obtención de los detalles del usuario registrado actual para la tabla jhi_persistenet_audit_event

    @RequestMapping(value = {"/", ""})
    public String start(Principal principal, Model model) {
           String currentUser = principal.getName();       
           return currentUser;
    }
@RequestMapping(value = {"/", ""})
public String currentUserName(Authentication authentication) {
        return authentication.getName();
}
Object principal = SecurityContextHolder.getContext().getAuthentication().getPrincipal();
if (principal instanceof UserDetails) {
  String username = ((UserDetails)principal).getUsername();
} else {
  String username = principal.toString();
}

Detalles 1 Detalles 2