@jayfong/x-server 2.108.1 → 2.108.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/_cjs/services/jwt.js +1 -4
- package/lib/services/jwt.d.ts +3 -1
- package/lib/services/jwt.js +1 -4
- package/package.json +1 -1
package/lib/_cjs/services/jwt.js
CHANGED
|
@@ -58,10 +58,7 @@ class JwtService {
|
|
|
58
58
|
if (!authorization) {
|
|
59
59
|
throw new _http_error.HttpError.Unauthorized('header');
|
|
60
60
|
}
|
|
61
|
-
const [scheme, token] = authorization.split(' ');
|
|
62
|
-
if (scheme.toLowerCase() !== 'bearer') {
|
|
63
|
-
throw new _http_error.HttpError.Unauthorized('bearer');
|
|
64
|
-
}
|
|
61
|
+
const [scheme, token = scheme] = authorization.split(' ');
|
|
65
62
|
return this.verify(token);
|
|
66
63
|
}
|
|
67
64
|
}
|
package/lib/services/jwt.d.ts
CHANGED
|
@@ -23,7 +23,9 @@ export declare class JwtService implements BaseService {
|
|
|
23
23
|
verify<T extends JwtServiceJwtPayload>(token: string): Promise<T & {
|
|
24
24
|
token: string;
|
|
25
25
|
}>;
|
|
26
|
-
verifyFromHttpHeaders<T extends JwtServiceJwtPayload>(headers: IncomingHttpHeaders): Promise<T
|
|
26
|
+
verifyFromHttpHeaders<T extends JwtServiceJwtPayload>(headers: IncomingHttpHeaders): Promise<T & {
|
|
27
|
+
token: string;
|
|
28
|
+
}>;
|
|
27
29
|
}
|
|
28
30
|
declare module '../x' {
|
|
29
31
|
interface X {
|
package/lib/services/jwt.js
CHANGED
|
@@ -53,10 +53,7 @@ export class JwtService {
|
|
|
53
53
|
if (!authorization) {
|
|
54
54
|
throw new HttpError.Unauthorized('header');
|
|
55
55
|
}
|
|
56
|
-
const [scheme, token] = authorization.split(' ');
|
|
57
|
-
if (scheme.toLowerCase() !== 'bearer') {
|
|
58
|
-
throw new HttpError.Unauthorized('bearer');
|
|
59
|
-
}
|
|
56
|
+
const [scheme, token = scheme] = authorization.split(' ');
|
|
60
57
|
return this.verify(token);
|
|
61
58
|
}
|
|
62
59
|
}
|