New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

hapi-auth-jwt2

Package Overview
Dependencies
Maintainers
1
Versions
94
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hapi-auth-jwt2 - npm Package Compare versions

Comparing version 4.3.2 to 4.3.3

22

package.json
{
"name": "hapi-auth-jwt2",
"version": "4.3.2",
"version": "4.3.3",
"description": "Hapi.js Authentication Plugin/Scheme using JSON Web Tokens (JWT)",

@@ -8,3 +8,3 @@ "main": "lib/index.js",

"type": "git",
"url": "https://github.com/ideaq/hapi-auth-jwt.git"
"url": "https://github.com/dwyl/hapi-auth-jwt.git"
},

@@ -25,8 +25,8 @@ "keywords": [

"bugs": {
"url": "https://github.com/ideaq/hapi-auth-jwt/issues"
"url": "https://github.com/dwyl/hapi-auth-jwt/issues"
},
"homepage": "https://github.com/ideaq/hapi-auth-jwt",
"homepage": "https://github.com/dwyl/hapi-auth-jwt",
"dependencies": {
"boom": "^2.7.0",
"hoek": "^2.12.0",
"hoek": "^2.13.0",
"jsonwebtoken": "^5.0.0"

@@ -39,7 +39,7 @@ },

"aguid": "^1.0.3",
"hapi": "^8.4.0",
"hapi": "^8.5.0",
"codeclimate-test-reporter": "0.0.4",
"istanbul": "^0.3.13",
"jshint": "^2.6.3",
"pre-commit": "^1.0.6",
"istanbul": "^0.3.14",
"jshint": "^2.7.0",
"pre-commit": "^1.0.7",
"redis": "^0.12.1",

@@ -55,5 +55,5 @@ "tap-spec": "^3.0.0",

"test": "istanbul cover ./node_modules/tape/bin/tape ./test/*.js | node_modules/tap-spec/bin/cmd.js",
"coverage": "istanbul cover ./node_modules/tape/bin/tape ./test/*.js && ./node_modules/.bin/istanbul check-coverage --statements 100 --functions 100 --lines 100 --branches 100",
"coverage": "istanbul cover ./node_modules/tape/bin/tape ./test/*.js && istanbul check-coverage --statements 100 --functions 100 --lines 100 --branches 100",
"jshint": "./node_modules/jshint/bin/jshint -c .jshintrc --exclude-path .gitignore .",
"codeclimate": "CODECLIMATE_REPO_TOKEN=1f00e2891b3e24ed11bb9b22a8a4793c55c5470d60e859389a0c3dd24220df46 ./node_modules/codeclimate-test-reporter/bin/codeclimate.js < ./coverage/lcov.info",
"codeclimate": "CODECLIMATE_REPO_TOKEN=6c47340a2888b54541779bd8bffcaad5577095a7ae888b72b4736fc68eb094f8 ./node_modules/codeclimate-test-reporter/bin/codeclimate.js < ./coverage/lcov.info",
"start": "node example/server.js",

@@ -60,0 +60,0 @@ "report":"open coverage/lcov-report/index.html"

@@ -6,10 +6,10 @@ # Hapi Auth with JSON Web Tokens (JWT)

[![Build Status](https://travis-ci.org/ideaq/hapi-auth-jwt2.svg "Build Status = Tests Passing")](https://travis-ci.org/ideaq/hapi-auth-jwt2)
[![Test Coverage](https://codeclimate.com/github/ideaq/hapi-auth-jwt2/badges/coverage.svg "All Lines Tested")](https://codeclimate.com/github/ideaq/hapi-auth-jwt2)
[![Code Climate](https://codeclimate.com/github/ideaq/hapi-auth-jwt2/badges/gpa.svg "No Nasty Code")](https://codeclimate.com/github/ideaq/hapi-auth-jwt2)
[![bitHound Score](https://www.bithound.io/github/ideaq/hapi-auth-jwt2/badges/score.svg)](https://www.bithound.io/github/ideaq/hapi-auth-jwt2)
[![Dependency Status](https://david-dm.org/ideaq/hapi-auth-jwt2.svg "Dependencies Checked & Updated Regularly (Security is Important!)")](https://david-dm.org/ideaq/hapi-auth-jwt2)
[![Build Status](https://travis-ci.org/dwyl/hapi-auth-jwt2.svg "Build Status = Tests Passing")](https://travis-ci.org/dwyl/hapi-auth-jwt2)
[![Test Coverage](https://codeclimate.com/github/dwyl/hapi-auth-jwt2/badges/coverage.svg "All Lines Tested")](https://codeclimate.com/github/dwyl/hapi-auth-jwt2)
[![Code Climate](https://codeclimate.com/github/dwyl/hapi-auth-jwt2/badges/gpa.svg "No Nasty Code")](https://codeclimate.com/github/dwyl/hapi-auth-jwt2)
[![bitHound Score](https://www.bithound.io/github/dwyl/hapi-auth-jwt2/badges/score.svg)](https://www.bithound.io/github/dwyl/hapi-auth-jwt2)
[![Dependency Status](https://david-dm.org/dwyl/hapi-auth-jwt2.svg "Dependencies Checked & Updated Regularly (Security is Important!)")](https://david-dm.org/dwyl/hapi-auth-jwt2)
[![Node.js Version](https://img.shields.io/node/v/hapi-auth-jwt2.svg?style=flat "Node.js 10 & 12 and io.js latest both supported")](http://nodejs.org/download/)
[![NPM Version](https://badge.fury.io/js/hapi-auth-jwt2.svg?style=flat)](https://npmjs.org/package/hapi-auth-jwt2)
[![HAPI 8.4](http://img.shields.io/badge/hapi-8.4-brightgreen.svg "Latest Hapi.js")](http://hapijs.com)
[![HAPI 8.5](http://img.shields.io/badge/hapi-8.4-brightgreen.svg "Latest Hapi.js")](http://hapijs.com)

@@ -32,3 +32,3 @@

please submit any questions as issues on GitHub:
https://github.com/ideaq/hapi-auth-jwt2/issues
https://github.com/dwyl/hapi-auth-jwt2/issues

@@ -138,17 +138,17 @@ ### Install from NPM

in a ***production*** web app (API)
please see: https://github.com/ideaq/time/tree/master/api/lib
please see: https://github.com/dwyl/time/tree/master/api/lib
+ **app.js** ***registering*** the **hapi-auth-jw2 plugin**:
[app.js#L13](https://github.com/ideaq/time/blob/0a5ec8711840528a4960c388825fb883fabddd76/app.js#L13)
[app.js#L13](https://github.com/dwyl/time/blob/0a5ec8711840528a4960c388825fb883fabddd76/app.js#L13)
+ telling app.js where to find our **validateFunc**tion:
[app.js#L21](https://github.com/ideaq/time/blob/0a5ec8711840528a4960c388825fb883fabddd76/app.js#L21)
[app.js#L21](https://github.com/dwyl/time/blob/0a5ec8711840528a4960c388825fb883fabddd76/app.js#L21)
+ **validateFunc**tion (how we check the JWT is still valid):
[api/lib/auth_jwt_validate.js](https://github.com/ideaq/time/blob/0a5ec8711840528a4960c388825fb883fabddd76/api/lib/auth_jwt_validate.js) looks up the person's session in our ElasticSearch Database
if the [session record is ***found*** (valid) and ***not ended***](https://github.com/ideaq/time/blob/0a5ec8711840528a4960c388825fb883fabddd76/api/lib/auth_jwt_validate.js#L12) we allow the person to see the restricted content.
[api/lib/auth_jwt_validate.js](https://github.com/dwyl/time/blob/0a5ec8711840528a4960c388825fb883fabddd76/api/lib/auth_jwt_validate.js) looks up the person's session in our ElasticSearch Database
if the [session record is ***found*** (valid) and ***not ended***](https://github.com/dwyl/time/blob/0a5ec8711840528a4960c388825fb883fabddd76/api/lib/auth_jwt_validate.js#L12) we allow the person to see the restricted content.
+ **Signing your JWTs**: in your app you need a method to *sign* the JWTs (and put them in a database
if that's how you are *verifying* your sessions) ours is:
[api/lib/auth_jwt_sign.js](https://github.com/ideaq/time/blob/0a5ec8711840528a4960c388825fb883fabddd76/api/lib/auth_jwt_sign.js#L18)
[api/lib/auth_jwt_sign.js](https://github.com/dwyl/time/blob/0a5ec8711840528a4960c388825fb883fabddd76/api/lib/auth_jwt_sign.js#L18)
If you have ***any questions*** on this please post an issue/question on GitHub:
https://github.com/ideaq/hapi-auth-jwt2/issues
https://github.com/dwyl/hapi-auth-jwt2/issues
(*we are here to help get you started on your journey to **hapi**ness!*)

@@ -170,3 +170,3 @@

Having a more real-world example was *seconded* by [@manonthemat](https://github.com/manonthemat) see:
[hapi-auth-jwt2/issues/9](https://github.com/ideaq/hapi-auth-jwt2/issues/9)
[hapi-auth-jwt2/issues/9](https://github.com/dwyl/hapi-auth-jwt2/issues/9)

@@ -209,3 +209,3 @@

This feature was requested in: [issues/29](https://github.com/ideaq/hapi-auth-jwt2/issues/29)
This feature was requested in: [issues/29](https://github.com/dwyl/hapi-auth-jwt2/issues/29)

@@ -217,3 +217,3 @@

1. Do I need to include **jsonwebtoken** in my project? asked in [hapi-auth-jwt2/issues/32](https://github.com/ideaq/hapi-auth-jwt2/issues/32)
1. Do I need to include **jsonwebtoken** in my project? asked in [hapi-auth-jwt2/issues/32](https://github.com/dwyl/hapi-auth-jwt2/issues/32)
**Q**: Must I include the **jsonwebtoken** package in my project

@@ -230,9 +230,29 @@ [given that **hapi-auth-jwt2** plugin already includes it] ?

> *If you have a question, **please post an issue**/question on **GitHub***:
https://github.com/ideaq/hapi-auth-jwt2/issues
https://github.com/dwyl/hapi-auth-jwt2/issues
- - -
## Contributing ## Contributing [![contributions welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat)](https://github.com/dwyl/hapi-auth-jwt2/issues)
If you spot an area for improvement, please raise an issue: https://github.com/dwyl/hapi-auth-jwt2/issues
Someone on the dwyl team is *always* online so
### Running the tests
The "*real world example*" expects to have two environment variables:
**JWT_SECRET** and **REDISCLOUD_URL**.
```sh
export JWT_SECRET='ItsNoSecretBecauseYouToldEverybody'
export REDISCLOUD_URL='redis://rediscloud:OhEJjWvSgna@pub-redis-1046.eu-west-1-2.1.ec2.garantiadata.com:10689'
```
> Ask [@nelsonic](https://github.com/nelsonic) for a valid Dev **Redis url** (*we cannot publish the* ***real*** *one on GitHub...*)
# tl;dr
## Motivation
While making [***Time***](https://github.com/ideaq/time) we want to ensure
While making [***Time***](https://github.com/dwyl/time) we want to ensure
our app (and API) is as ***simple*** as *possible* to use.

@@ -262,3 +282,2 @@ This lead us to using JSON Web Tokens for ***Stateless*** Authentication.

## Why hapi-auth-jwt2 ?

@@ -269,2 +288,7 @@

## Useful Links

@@ -271,0 +295,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc