public static @ Nullable @ CheckForNull String getCurrentUsername ( ) { Authentication authentication = SecurityContextHolder . getContext ( ) . getAuthentication ( ) ; if ( authentication == null ) { return null ; } return getUsername ( authentication ) ; }
Returns the username of the current authentication .