From 39cbbebc2b38f76403efe370136cbfdcc0d0c3f6 Mon Sep 17 00:00:00 2001 From: lakmal silva Date: Tue, 8 Aug 2017 11:55:34 +0530 Subject: [PATCH] issue #4 - sql fix --- components/oauth/models.js | 10 ++++++---- config.js | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/components/oauth/models.js b/components/oauth/models.js index 89f252f..f30ee7a 100644 --- a/components/oauth/models.js +++ b/components/oauth/models.js @@ -67,7 +67,7 @@ function getUser(username, password) { attributes: ['id', 'username', 'password', 'scope'], }) .then(function (user) { - return user.password == password ? user.toJSON() : false; + return user.password === password ? user.toJSON() : false; }) .catch(function (err) { console.log("getUser - Err: ", err) @@ -237,11 +237,13 @@ function getRefreshToken(refreshToken) { }); } -function validateScope(token, client) { - return (user.scope === scope && client.scope === scope && scope !== null) ? scope : false +function validateScope(token, client, scope) { + console.log("validateScope", token, client, scope); + return (user.scope === client.scope) ? scope : false } function verifyScope(token, scope) { + console.log("verifyScope", token, scope); return token.scope === scope } @@ -260,7 +262,7 @@ module.exports = { revokeToken: revokeToken, saveToken: saveToken,//saveOAuthAccessToken, renamed to saveAuthorizationCode: saveAuthorizationCode, //renamed saveOAuthAuthorizationCode, - validateScope: validateScope, + // validateScope: validateScope, verifyScope: verifyScope, } diff --git a/config.js b/config.js index 015f44f..c500f52 100644 --- a/config.js +++ b/config.js @@ -17,5 +17,5 @@ module.exports = { seedDB:false, seedMongoDB:false, seedDBForce:true, - db:'mongo' // mongo,sql if you want to use any SQL change dialect above in sql config + db:'sql' // mongo,sql if you want to use any SQL change dialect above in sql config } \ No newline at end of file