@ Bean public AuthorProvider authorProvider ( ) { return ( ) -> { final SecurityContext context = SecurityContextHolder . getContext ( ) ; if ( context != null && context . getAuthentication ( ) != null ) { return context . getAuthentication ( ) . getPrincipal ( ) . toString ( ) ; } else { return "system" ; } } ; }
Author provider .