mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-16 23:10:29 +00:00
Merge pull request #19162 from davidNHK/fix-types/passport-jwt
[passport-jwt] Add missing function
This commit is contained in:
Vendored
+4
-2
@@ -1,7 +1,8 @@
|
||||
// Type definitions for passport-jwt 2.0
|
||||
// Project: https://github.com/themikenicholson/passport-jwt
|
||||
// Definitions by: TANAKA Koichi <https://github.com/mugeso>
|
||||
// Alex Young <https://github.com/alsiola>
|
||||
// Definitions by: TANAKA Koichi <https://github.com/mugeso/>
|
||||
// Alex Young <https://github.com/alsiola/>
|
||||
// David Ng <https://github.com/davidNHK/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
import { Strategy as PassportStrategy } from 'passport-strategy';
|
||||
@@ -45,4 +46,5 @@ export declare namespace ExtractJwt {
|
||||
export function fromAuthHeaderWithScheme(auth_scheme: string): JwtFromRequestFunction;
|
||||
export function fromAuthHeader(): JwtFromRequestFunction;
|
||||
export function fromExtractors(extractors: JwtFromRequestFunction[]): JwtFromRequestFunction;
|
||||
export function fromAuthHeaderAsBearerToken(): JwtFromRequestFunction;
|
||||
}
|
||||
|
||||
@@ -32,6 +32,7 @@ opts.jwtFromRequest = ExtractJwt.fromBodyField('field_name');
|
||||
opts.jwtFromRequest = ExtractJwt.fromUrlQueryParameter('param_name');
|
||||
opts.jwtFromRequest = ExtractJwt.fromAuthHeaderWithScheme('param_name');
|
||||
opts.jwtFromRequest = ExtractJwt.fromExtractors([ExtractJwt.fromHeader('x-api-key'), ExtractJwt.fromBodyField('field_name'), ExtractJwt.fromUrlQueryParameter('param_name')]);
|
||||
opts.jwtFromRequest = ExtractJwt.fromAuthHeaderAsBearerToken();
|
||||
opts.jwtFromRequest = (req: Request) => { return req.query.token; };
|
||||
opts.secretOrKey = new Buffer('secret');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user