/** * Returns the current NiFiUser or null if the current user is not a NiFiUser. * * @return user */ public static NiFiUser getNiFiUser() { NiFiUser user = null; // obtain the principal in the current authentication final SecurityContext context = SecurityContextHolder.getContext(); final Authentication authentication = context.getAuthentication(); if (authentication != null) { Object principal = authentication.getPrincipal(); if (principal instanceof NiFiUserDetails) { user = ((NiFiUserDetails) principal).getNiFiUser(); } } return user; }
final NiFiUser nifiUser = ((NiFiUserDetails) authenticationResponse.getDetails()).getNiFiUser(); final NiFiUser nifiUser = ((NiFiUserDetails) authenticationResponse.getDetails()).getNiFiUser();