wgu-jwt
v0.1.5
Published
wgu-jwt
Downloads
15
Maintainers
Readme
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