Comparing version 1.1.4 to 1.2.0
{ | ||
"name": "darklord", | ||
"version": "1.1.4", | ||
"version": "1.2.0", | ||
"author": "Gregory Pratt <gregory.pratt@me.com> (http://grumpywizards.com)", | ||
@@ -5,0 +5,0 @@ "description": "Stateless JWT based authentication", |
@@ -207,2 +207,10 @@ var Cookies = require('cookies'); | ||
function logout(req, res) { | ||
if (activateCookie) { | ||
// Remove the cookie | ||
var cookies = new Cookies(req, res, cookiekKeys); | ||
cookies.set('darklord', null, { signed: true }); | ||
} | ||
} | ||
function generateToken(req, res, user) { | ||
@@ -227,4 +235,3 @@ // When to force a new manual login | ||
expires: expiryDate, | ||
signed: true, | ||
httpOnly: false | ||
signed: true | ||
}); | ||
@@ -248,4 +255,5 @@ } | ||
verifyEmail: verifyEmail, | ||
extendToken: extendToken | ||
extendToken: extendToken, | ||
logout: logout | ||
}; | ||
}; |
@@ -31,12 +31,19 @@ var responses = require('./utils/responses'); | ||
function hasAccess(req, res) { | ||
authSvc | ||
.hasAccess(req, res) | ||
.then(function () { | ||
res.status(200).end(); | ||
}, function () { | ||
res.status(401).end(); | ||
}); | ||
} | ||
function logout(req, res) { | ||
authSvc.logout(req, res); | ||
res.status(200).end(); | ||
} | ||
if (opts.router) { | ||
opts.router.get('/access', function (req, res) { | ||
authSvc | ||
.hasAccess(req, res) | ||
.then(function () { | ||
res.status(200).end(); | ||
}, function () { | ||
res.status(401).end(); | ||
}); | ||
}); | ||
opts.router.get('/access', hasAccess); | ||
opts.router.post('/register', authSvc.register); | ||
@@ -49,2 +56,3 @@ opts.router.post('/forgot', forgotPassword); | ||
opts.router.put('/change', authSvc.isAuthenticated, changePassword); | ||
opts.router.post('/logout', logout); | ||
} | ||
@@ -61,4 +69,5 @@ | ||
verifyEmail: authSvc.verifyEmail, | ||
extendToken: authSvc.extendToken | ||
extendToken: authSvc.extendToken, | ||
logout: authSvc.logout | ||
}; | ||
}; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
18070
403