10 lines
644 B
Java
10 lines
644 B
Java
|
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
|
||
|
if(authentication == null) {
|
||
|
throw new IllegalStateException("authentication cannot be null. Make sure you are logged in.");
|
||
|
}
|
||
|
Object principal = userDetailsService.loadUserByUsername(authentication.getName());
|
||
|
model.addAttribute("user", principal);
|
||
|
model.addAttribute("isLdapUserDetails", principal instanceof LdapUserDetails);
|
||
|
model.addAttribute("isLdapPerson", principal instanceof Person);
|
||
|
model.addAttribute("isLdapInetOrgPerson", principal instanceof InetOrgPerson);
|