How to use the @loopback/authentication.AuthenticationBindings.METADATA function in @loopback/authentication

To help you get started, we’ve selected a few @loopback/authentication examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github iqbaldjulfri / lb4-jwt-role-based-auth-sample / src / application.ts View on Github external
super(options);

    // Set up the custom sequence
    this.sequence(MySequence);

    // Set up default home page
    this.static('/', path.join(__dirname, '../public'));

    // Customize @loopback/rest-explorer configuration here
    this.bind(RestExplorerBindings.CONFIG).to({
      path: '/explorer',
    });
    this.component(RestExplorerComponent);

    // this.component(AuthenticationComponent);
    this.bind(AuthenticationBindings.METADATA).toProvider(MyAuthMetadataProvider);
    this.bind(MyAuthBindings.STRATEGY).toProvider(MyAuthAuthenticationStrategyProvider);
    this.bind(AuthenticationBindings.AUTH_ACTION).toProvider(MyAuthActionProvider);

    this.projectRoot = __dirname;
    // Customize @loopback/boot Booter Conventions here
    this.bootOptions = {
      controllers: {
        // Customize ControllerBooter Conventions here
        dirs: ['controllers'],
        extensions: ['.controller.js'],
        nested: true,
      },
    };
  }
github iqbaldjulfri / lb4-jwt-role-based-auth-sample / src / auth.ts View on Github external
constructor(
    @inject(AuthenticationBindings.METADATA) private metadata: MyAuthenticationMetadata,
    @repository(UserRepository) private userRepository: UserRepository,
    @repository(UserRoleRepository) private userRoleRepository: UserRoleRepository,
  ) {}
github gobackhuoxing / first-web-game-lb4 / firstgame / src / interceptors / authorize.interceptor.ts View on Github external
constructor(
    @inject(AuthenticationBindings.METADATA)
    public metadata: AuthenticationMetadata,
    @inject(MyAuthBindings.USER_PERMISSIONS)
    protected checkPermissons: UserPermissionsFn,
    @inject.getter(AuthenticationBindings.CURRENT_USER)
    public getCurrentUser: Getter,
  ) {}
github strongloop / loopback4-example-shopping / packages / shopping / src / providers / strategy.resolver.provider.ts View on Github external
constructor(
    @inject(AuthenticationBindings.METADATA)
    private metadata: AuthenticationMetadata,
    @inject(JWTAuthenticationBindings.STRATEGY)
    private jwt_strategy: JWTStrategy,
  ) {}
  value(): ValueOrPromise {
github iqbaldjulfri / lb4-jwt-role-based-auth-sample / src / auth.ts View on Github external
constructor(
    @inject.getter(MyAuthBindings.STRATEGY) readonly getStrategy: Getter,
    @inject.setter(AuthenticationBindings.CURRENT_USER) readonly setCurrentUser: Setter,
    @inject.getter(AuthenticationBindings.METADATA) readonly getMetadata: Getter,
  ) {}
github gobackhuoxing / first-web-game-lb4 / firstgame / src / authorization / strategies / JWT.strategy.ts View on Github external
constructor(
    @inject(AuthenticationBindings.METADATA)
    public metadata: AuthenticationMetadata,
    @inject(MyAuthBindings.USER_PERMISSIONS)
    protected checkPermissons: UserPermissionsFn,
    @inject(MyAuthBindings.TOKEN_SERVICE)
    protected tokenService: TokenService,
  ) {}
  async authenticate(request: Request): Promise {