Mysql
 sql >> Datenbank >  >> RDS >> Mysql

Aktuelle protokollierte Benutzerdetails für die Tabelle jhi_persistenet_audit_event abrufen

    @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();
}

Details 1 Details 2