import { KibanaRequest } from 'kibana/server' ; import { SecurityPluginStart } from '../../security/server' ; export interface GetUserOptions { security : SecurityPluginStart | null | undefined ; request : KibanaRequest ; } export const getUser = ( { security , request } ) : string => { if ( security != null ) { const authenticatedUser = security . authc . getCurrentUser ( request ) ; if ( authenticatedUser != null ) { return authenticatedUser . username ; } else { return 'elastic' ; } } else { return 'elastic' ; } } ;