dwyl / hapi-auth-jwt2

:lock: Secure Hapi.js authentication plugin using JSON Web Tokens (JWT) in Headers, URL or Cookies
ISC License
798 stars 126 forks source link

Support custom error messages from validate function #304

Closed BenMansley closed 5 years ago

BenMansley commented 5 years ago

Issue: #303

Motivation:

Our usage of hapi-auth-jwt2 includes a validate function with multiple invalid cases (the user is deleted, the user is using an old token etc). We'd like to distinguish between these cases when an error is raised, so we need a custom error, rather than just Invalid credentials for all cases.

In this PR:

codecov[bot] commented 5 years ago

Codecov Report

Merging #304 into master will not change coverage. The diff coverage is 100%.

Impacted file tree graph

@@          Coverage Diff          @@
##           master   #304   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files           2      2           
  Lines         106    106           
=====================================
  Hits          106    106
Impacted Files Coverage Δ
lib/index.js 100% <100%> (ø) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 1f96cd7...37ba54d. Read the comment docs.