2
2
3
3
// Imports.
4
4
// eslint-disable-next-line node/no-unpublished-require
5
- const passport = require ( ' passport' ) ;
6
- const util = require ( ' util' ) ;
5
+ const passport = require ( " passport" ) ;
6
+ const util = require ( " util" ) ;
7
7
8
8
// Define strategy.
9
9
function HttpStrategy ( auth ) {
10
- this . name = ' http' ;
11
- this . authentication = auth ;
10
+ this . name = " http" ;
11
+ this . authentication = auth ;
12
12
13
- passport . Strategy . call ( this ) ;
13
+ passport . Strategy . call ( this ) ;
14
14
}
15
15
16
16
// Inherit basic strategy.
17
17
util . inherits ( HttpStrategy , passport . Strategy ) ;
18
18
19
19
// Define auth method.
20
- HttpStrategy . prototype . authenticate = function ( req ) {
21
- let self = this ;
20
+ HttpStrategy . prototype . authenticate = function ( req ) {
21
+ let self = this ;
22
22
23
- // Is auth.
24
- this . authentication . isAuthenticated ( req , ( result ) => {
25
- if ( result instanceof Error ) {
26
- self . error ( result ) ;
27
- } else if ( ! result . pass ) {
28
- let header = self . authentication . generateHeader ( result ) ;
29
- self . fail ( header ) ;
30
- } else {
31
- self . success ( result . user ) ;
32
- }
33
- } ) ;
23
+ // Is auth.
24
+ this . authentication . isAuthenticated ( req , result => {
25
+ if ( result instanceof Error ) {
26
+ self . error ( result ) ;
27
+ } else if ( ! result . pass ) {
28
+ let header = self . authentication . generateHeader ( result ) ;
29
+ self . fail ( header ) ;
30
+ } else {
31
+ self . success ( result . user ) ;
32
+ }
33
+ } ) ;
34
34
} ;
35
35
36
36
// Export.
37
- module . exports = ( auth ) => {
38
- return new HttpStrategy ( auth ) ;
39
- } ;
37
+ module . exports = auth => {
38
+ return new HttpStrategy ( auth ) ;
39
+ } ;
0 commit comments