From 2526ca5c90edced22eac4980bef5b9b6a5f1b156 Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Wed, 5 Aug 2015 13:28:26 -0400 Subject: [PATCH] feat(server:auth): add role to signToken add role as second parameter, and attach to jwt closes #382 --- app/templates/server/auth(auth)/auth.service.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/templates/server/auth(auth)/auth.service.js b/app/templates/server/auth(auth)/auth.service.js index 86f781f84..faa2684cf 100644 --- a/app/templates/server/auth(auth)/auth.service.js +++ b/app/templates/server/auth(auth)/auth.service.js @@ -71,8 +71,8 @@ function hasRole(roleRequired) { /** * Returns a jwt token signed by the app secret */ -function signToken(id) { - return jwt.sign({ _id: id }, config.secrets.session, { +function signToken(id, role) { + return jwt.sign({ _id: id, role: role }, config.secrets.session, { expiresInMinutes: 60 * 5 }); }