Comparing version 0.2.2 to 0.2.3
@@ -30,3 +30,3 @@ module.exports = { | ||
addEmberAddons: [{}], | ||
addToConfig: [{}], | ||
addToConfig: {}, | ||
addBowerPackages: [{}], | ||
@@ -33,0 +33,0 @@ generates: [{ |
var jwt = require('jsonwebtoken'); | ||
var _ = require('lodash'); | ||
//change the scretes here as well as in policies/hasToken.js | ||
var secret = '**n0t-S0-s3cr3t-K3y!'; | ||
var refreshSecret = 'r3Fr3sh-K3y*!'; | ||
var bcrypt = require('bcrypt'); | ||
/** | ||
@@ -71,4 +69,4 @@ * AuthController | ||
bearerToken = jwt.verify(token, secret); | ||
refreshToken = jwt.verify(req.body.refresh_token, refreshSecret); | ||
bearerToken = jwt.verify(token, sails.config.jwt.secret); | ||
refreshToken = jwt.verify(req.body.refresh_token, sails.config.jwt.refresh_secret); | ||
@@ -95,9 +93,9 @@ if (_.isEqual(bearerToken, refreshToken)) { | ||
function issueTokens(user, res) { | ||
var expirationTimeInMinutes = 60 * 2; | ||
var expirationTimeInMinutes = sails.config.jwt.expiration_time_in_minutes; | ||
var token = jwt.sign(user, secret, { | ||
var token = jwt.sign(user, sails.config.jwt.secret, { | ||
expiresInMinutes: expirationTimeInMinutes | ||
}); | ||
var refreshToken = jwt.sign(user, refreshSecret, { | ||
var refreshToken = jwt.sign(user, sails.config.jwt.refresh_secret, { | ||
expiresInMinutes: expirationTimeInMinutes | ||
@@ -104,0 +102,0 @@ }); |
@@ -1,5 +0,1 @@ | ||
var expressJwt = require('express-jwt'); | ||
//Create a new secret key here | ||
var secret = '**n0t-S0-s3cr3t-K3y!'; | ||
module.exports = expressJwt({secret: secret}); | ||
module.exports = require('express-jwt')({secret: sails.config.jwt.secret}); |
{ | ||
"name": "sane-auth", | ||
"version": "0.2.2", | ||
"version": "0.2.3", | ||
"description": "A Sane Stack Addon giving you basic OAauth2-JWT authentication for the full stack", | ||
@@ -5,0 +5,0 @@ "scripts": { |
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
17925
17
395