9 lines
602 B
Java
9 lines
602 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 = authentication.getPrincipal();
|
|
model.addAttribute("user", principal);
|
|
model.addAttribute("isLdapUserDetails", principal instanceof LdapUserDetails);
|
|
model.addAttribute("isLdapPerson", principal instanceof Person);
|
|
model.addAttribute("isLdapInetOrgPerson", principal instanceof InetOrgPerson); |