Remove whitespace in scope input

This commit is contained in:
Johannes Zellner
2016-06-07 16:15:45 +02:00
parent 25003bcf40
commit 02d2a7058e
+4
View File
@@ -98,12 +98,16 @@ function add(appId, type, redirectURI, scope, callback) {
assert.strictEqual(typeof scope, 'string');
assert.strictEqual(typeof callback, 'function');
// allow whitespace
scope = scope.split(',').map(function (s) { return s.trim(); }).join(',');
var error = validateScope(scope);
if (error) return callback(error);
var id = 'cid-' + uuid.v4();
var clientSecret = hat(256);
clientdb.add(id, appId, type, clientSecret, redirectURI, scope, function (error) {
if (error) return callback(error);