Skip to content

Commit

Permalink
Merge pull request #42 from talis/plat_1729_ignore_cache_errors_and_c…
Browse files Browse the repository at this point in the history
…all_person

90% ignore cache errors and call persona
  • Loading branch information
ShaunParsons authored Feb 25, 2019
2 parents cbb27e4 + 0fa24aa commit ff7edd1
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
5 changes: 0 additions & 5 deletions client/lib/public-key-store.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,6 @@ function obtainToken(client, opts, callback) {

// try cache first
client.tokenCache.get(cacheKey, function (err, reply) {
if (err) {
callback(err);
return;
}

if (reply) {
var data;
if (_.isObject(reply)) {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "persona_client",
"version": "4.1.5",
"version": "4.1.6",
"private": true,
"main": "./index.js",
"description": "Node Client for Persona, repsonsible for retrieving, generating, caching and validating OAuth Tokens.",
Expand Down
8 changes: 5 additions & 3 deletions test/unit/public-key-store.js
Original file line number Diff line number Diff line change
Expand Up @@ -590,15 +590,17 @@ describe('public-key-store', function() {
});
});

publicKeyStore.obtainToken(personaClient, testOpts, (err) => {
publicKeyStore.obtainToken(personaClient, testOpts, (err, publicKey) => {
personaClient.tokenCache.get.calledOnce.should.equal(true);

personaClient.tokenCache.get.calledWith(testObtainTokenCacheKey).should.equal(true);

generateTokenStub.called.should.equal(false);
generateTokenStub.calledOnce.should.equal(true);

err.should.equal(error);
generateTokenStub.calledWith(personaClient, testObtainTokenCacheKey, testXRequestId, testOpts.id, testOpts.secret).should.equal(true);

publicKey.access_token.should.equal(testPublicKeyObject.access_token);
publicKey.expires_at.should.equal(testUnexpiredTimestamp);
done();
});
});
Expand Down

0 comments on commit ff7edd1

Please sign in to comment.