|
1 | | -import { inject, named } from 'inversify'; |
| 1 | +import {inject, named} from 'inversify'; |
2 | 2 | import * as Request from 'request'; |
3 | | -import { Logger as LoggerType } from '../../core/Logger'; |
4 | | -import { Types, Core } from '../../constants'; |
5 | | -import { events } from '../../core/api/events'; |
6 | | -import { UserAuthenticatedListener } from '../listeners/user/UserAuthenticatedListener'; |
| 3 | +import {Logger as LoggerType} from '../../core/Logger'; |
| 4 | +import {Types, Core} from '../../constants'; |
| 5 | +import {events} from '../../core/api/events'; |
| 6 | +import {UserAuthenticatedListener} from '../listeners/user/UserAuthenticatedListener'; |
7 | 7 |
|
8 | 8 |
|
9 | 9 | export class AuthenticateMiddleware implements interfaces.Middleware { |
10 | 10 |
|
11 | 11 | public log: LoggerType; |
12 | 12 |
|
13 | | - constructor( |
14 | | - @inject(Types.Core) @named(Core.Logger) Logger: typeof LoggerType, |
15 | | - @inject(Types.Lib) @named('request') private request: typeof Request |
16 | | - ) { |
| 13 | + constructor(@inject(Types.Core) @named(Core.Logger) Logger: typeof LoggerType, |
| 14 | + @inject(Types.Lib) @named('request') private request: typeof Request) { |
17 | 15 | this.log = new Logger(__filename); |
18 | 16 | } |
19 | 17 |
|
@@ -57,7 +55,7 @@ export class AuthenticateMiddleware implements interfaces.Middleware { |
57 | 55 | } |
58 | 56 |
|
59 | 57 | private getToken(req: myExpress.Request): string | null { |
60 | | - const authorization = req.headers.authorization; |
| 58 | + const authorization: string = req.headers.authorization as string; |
61 | 59 |
|
62 | 60 | // Retrieve the token form the Authorization header |
63 | 61 | if (authorization && authorization.split(' ')[0] === 'Bearer') { |
|
0 commit comments