All files / platform/packages/auth/providers AuthProvider.js

100% Statements 11/11
100% Branches 0/0
100% Functions 6/6
100% Lines 11/11

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42    1x       1x 1x                   1x 119x   119x 119x     1x                   1x 1x         1x  
'use strict';
 
const { ServiceProvider } = require('@adonisjs/fold');
 
class AuthProvider extends ServiceProvider {
  async register() {
    this._registerAuth();
    this._registerVowTrait();
  }
 
  /**
   * Register the vow trait
   * @method _registerVowTrait
   *
   * @return {void}
   */
  _registerVowTrait() {
    this.app.bind('C2C/Traits/Auth', (app) => {
      const Config = app.use('Adonis/Src/Config');
 
      return ({ Request }) => {
        require('../src/VowBindings/Request')(Request, Config);
      };
    });
    this.app.alias('C2C/Traits/Auth', 'Auth/Client');
  }
 
  /**
   * Register the auth lib
   * @method _registerAuth
   *
   * @return {void}
   */
  _registerAuth() {
    this.app.singleton('C2C/Addons/Auth', () => {
      return new (require('../src/Auth'))();
    });
  }
}
 
module.exports = AuthProvider;