Skip to content
This repository has been archived by the owner on Apr 3, 2019. It is now read-only.

Commit

Permalink
Merge pull request #282 from mozilla/issue_202
Browse files Browse the repository at this point in the history
Accept and ignore client_secret param in /destroy, fixes #202
  • Loading branch information
seanmonstar committed Jun 30, 2015
2 parents 0fc777e + 25a4d30 commit e70e564
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 2 deletions.
3 changes: 2 additions & 1 deletion lib/routes/destroy.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ module.exports = {
token: Joi.string()
.length(config.get('unique.token') * 2) // hex = bytes*2
.regex(validators.HEX_STRING)
.required()
.required(),
client_secret: Joi.string().allow('')
}
},
handler: function destroyToken(req, reply) {
Expand Down
27 changes: 26 additions & 1 deletion test/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -1442,6 +1442,31 @@ describe('/v1', function() {
});
});
});
it('should accept client_secret', function() {
return newToken().then(function(res) {
return Server.api.post({
url: '/destroy',
payload: {
token: res.result.access_token,
client_secret: 'foo'
}
});
}).then(function(res) {
assert.equal(res.statusCode, 200);
});
});
it('should accept empty client_secret', function() {
return newToken().then(function(res) {
return Server.api.post({
url: '/destroy',
payload: {
token: res.result.access_token,
client_secret: ''
}
});
}).then(function(res) {
assert.equal(res.statusCode, 200);
});
});
});

});

0 comments on commit e70e564

Please sign in to comment.