import { KibanaRequest , KibanaResponseFactory , RequestHandler , RequestHandlerContext , } from 'kibana/server' ; import { RouteDependencies } from '../../types' ; export const licensePreRoutingFactory = ( { getLicenseStatus } , handler ) => { return function licenseCheck ( ctx , request , response ) { const licenseStatus = getLicenseStatus ( ) ; if ( ! licenseStatus . valid ) { return response . forbidden ( { body : { message : licenseStatus . message || '' , } , } ) ; } return handler ( ctx , request , response ) ; } ; } ;