import { config , Constructor , CoreBindings , inject , Provider , } from '@loopback/core' ; import { getAuthenticateMetadata } from '../decorators' ; import { AuthenticationBindings } from '../keys' ; import { AuthenticationMetadata , AuthenticationOptions } from '../types' ; example export class AuthMetadataProvider implements Provider < AuthenticationMetadata [ ] | undefined > { constructor ( @ inject ( CoreBindings . CONTROLLER_CLASS , { optional : true } ) private readonly controllerClass , @ inject ( CoreBindings . CONTROLLER_METHOD_NAME , { optional : true } ) private readonly methodName , @ config ( { fromBinding : AuthenticationBindings . COMPONENT } ) private readonly options = { } ) { } returns value ( ) { if ( ! this . controllerClass || ! this . methodName ) return ; const metadata = getAuthenticateMetadata ( this . controllerClass , this . methodName ) ; if ( metadata ?. [ 0 ] ?. skip ) return undefined ; if ( metadata ) return metadata ; return this . options . defaultMetadata ; } }