nestjs-jwt2
Advanced tools
Comparing version 1.1.0 to 1.1.1
@@ -28,7 +28,7 @@ "use strict"; | ||
if (!tokenHeader) { | ||
throw new common_1.UnauthorizedException(); | ||
throw new common_1.UnauthorizedException('No token provided'); | ||
} | ||
const tokens = tokenHeader.split(' '); | ||
if (tokens.length !== 2) { | ||
throw new common_1.UnauthorizedException(); | ||
throw new common_1.UnauthorizedException('No token found'); | ||
} | ||
@@ -35,0 +35,0 @@ try { |
export declare class JwtService { | ||
private readonly client; | ||
private readonly cert; | ||
private readonly audiences; | ||
private readonly audiences?; | ||
private readonly issuers; | ||
@@ -6,0 +6,0 @@ constructor(); |
@@ -23,5 +23,2 @@ "use strict"; | ||
} | ||
if (!process.env.JWT_AUDIENCES) { | ||
throw new Error('You must provide JWT_AUDIENCES environment variable'); | ||
} | ||
if (!process.env.JWT_ISSUER) { | ||
@@ -33,6 +30,3 @@ throw new Error('You must provide JWT_ISSUER environment variable'); | ||
try { | ||
if (certPath) { | ||
this.cert = fs.readFileSync(certPath); | ||
} | ||
else { | ||
if (jwksUri) { | ||
this.client = jwksClient({ | ||
@@ -45,2 +39,5 @@ jwksUri, | ||
} | ||
else { | ||
this.cert = fs.readFileSync(certPath); | ||
} | ||
} | ||
@@ -55,3 +52,3 @@ catch (e) { | ||
jwt.verify(token, certOrGetKey, { | ||
audience: this.audiences, | ||
audience: this.audiences || [], | ||
issuer: this.issuers, | ||
@@ -58,0 +55,0 @@ }, err => { |
{ | ||
"name": "nestjs-jwt2", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"description": "Jwt utils for nestjs", | ||
@@ -5,0 +5,0 @@ "author": "Julien Dufresne", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
7
11490
15
272