@fastify/bearer-auth
Advanced tools
Comparing version 9.2.0 to 9.2.1
'use strict' | ||
const fp = require('fastify-plugin') | ||
const verifyBearerAuthFactory = require('./lib/verifyBearerAuthFactory') | ||
const verifyBearerAuthFactory = require('./lib/verify-bearer-auth-factory') | ||
@@ -6,0 +6,0 @@ function fastifyBearerAuth (fastify, options, done) { |
{ | ||
"name": "@fastify/bearer-auth", | ||
"version": "9.2.0", | ||
"version": "9.2.1", | ||
"description": "An authentication plugin for Fastify", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -46,2 +46,18 @@ 'use strict' | ||
test('missing space between bearerType and key fails correctly', (t) => { | ||
t.plan(2) | ||
fastify.inject({ | ||
method: 'GET', | ||
url: '/test', | ||
headers: { | ||
authorization: 'Bearer123456' | ||
} | ||
}).then(response => { | ||
t.equal(response.statusCode, 401) | ||
t.match(JSON.parse(response.body).error, /invalid authorization header/) | ||
}).catch(err => { | ||
t.error(err) | ||
}) | ||
}) | ||
test('missing header route fails correctly', (t) => { | ||
@@ -62,3 +78,3 @@ t.plan(2) | ||
await fastify.register(plugin, { addHook: false, keys: new Set(['123456']) }) | ||
await fastify.decorate('allowAnonymous', function (request, _, done) { | ||
fastify.decorate('allowAnonymous', function (request, _, done) { | ||
if (!request.headers.authorization) { | ||
@@ -124,3 +140,3 @@ return done() | ||
await fastify.register(plugin, { addHook: false, keys: new Set(['123456']) }) | ||
await fastify.decorate('alwaysValidAuth', function (request, _, done) { | ||
fastify.decorate('alwaysValidAuth', function (request, _, done) { | ||
return done() | ||
@@ -127,0 +143,0 @@ }) |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
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
39136
19
1069
1