public static User getAuthenticatedUser ( Authentication auth ) { User user = null ; if ( auth != null && auth . isAuthenticated ( ) && auth . getPrincipal ( ) instanceof AuthenticatedUserDetails ) { user = ( ( AuthenticatedUserDetails ) auth . getPrincipal ( ) ) . getUser ( ) ; } return user ; }
Extracts a User object from the security context .