node package manager

wgu-jwt

wgu-jwt

wgu-jwt

JWT extraction and verification module for the WGU Service layer

npm install wgu-jwt
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();
	});
}

Attempts to verify jwt passed in with optional logger

Extracts and returns the header

Extracts and returns the payload

Extracts and returns the signature

Extracts and returns the signed data