How to use the @loopback/authentication.AuthenticationBindings.CURRENT_USER 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 strongloop / loopback4-example-shopping / packages / shopping / src / providers / custom.authentication.provider.ts View on Github external
constructor(
    // The provider is instantiated for Sequence constructor,
    // at which time we don't have information about the current
    // route yet. This information is needed to determine
    // what auth strategy should be used.
    // To solve this, we are injecting a getter function that will
    // defer resolution of the strategy until authenticate() action
    // is executed.
    @inject.getter(AuthenticationBindings.STRATEGY)
    readonly getStrategy: Getter,
    @inject.setter(AuthenticationBindings.CURRENT_USER)
    readonly setCurrentUser: Setter,
  ) {}
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 / 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 gobackhuoxing / first-web-game-lb4 / firstgame / src / controllers / character.controller.ts View on Github external
constructor(
    @repository(CharacterRepository)
    public characterRepository: CharacterRepository,
    @inject(MyAuthBindings.TOKEN_SERVICE)
    public jwtService: JWTService,
    @inject.getter(AuthenticationBindings.CURRENT_USER)
    public getCurrentUser: Getter,
  ) {}
github gobackhuoxing / first-web-game-lb4 / firstgame / src / controllers / update-character.controller.ts View on Github external
constructor(
    @repository(CharacterRepository)
    public characterRepository: CharacterRepository,
    @repository(WeaponRepository)
    public weaponRepository: WeaponRepository,
    @repository(ArmorRepository)
    public armorRepository: ArmorRepository,
    @repository(SkillRepository)
    public skillRepository: SkillRepository,
    //
    @inject.getter(AuthenticationBindings.CURRENT_USER)
    public getCurrentUser: Getter,
  ) {}