wgu-jwt

0.1.5 • Public • Published

wgu-jwt

JWT extraction and verification module for the WGU Service layer

Install

npm install wgu-jwt

Usage

var restify = require('restify');
var wguJwt = require('wgu-jwt');

module.exports = function( server )
{
	server.use(function(req, res, next)
	{
		var jwt = req.header('X-Jwt-Assertion', '');
		
		if( ! wguJwt.verify(jwt))
		{
			return next(new restify.InvalidCredentialsError('JWT Not Verified'));
		}
		
		return next();
	});
}

Exports

verify( jwt, logger )

Attempts to verify jwt passed in with optional logger

extractHeader( jwt )

Extracts and returns the header

extractPayload( jwt )

Extracts and returns the payload

extractSignature( jwt )

Extracts and returns the signature

extractSignedData( jwt )

Extracts and returns the signed data

Package Sidebar

Install

npm i wgu-jwt

Weekly Downloads

4

Version

0.1.5

License

WGU

Last publish

Collaborators

  • steele