public static App getAuthenticatedApp ( ) { App app = null ; if ( SecurityContextHolder . getContext ( ) . getAuthentication ( ) != null ) { Authentication auth = SecurityContextHolder . getContext ( ) . getAuthentication ( ) ; if ( auth . isAuthenticated ( ) && auth . getPrincipal ( ) instanceof App ) { app = ( App ) auth . getPrincipal ( ) ; } } return app ; }
Extracts a App object from the security context .