Exemple #1
0
 describe('with cache', function() {
   var Cache = require('volos-cache-memory');
   var cache = Cache.create('OAuth cache');
   config.oauth.useCache(cache);
   expressTest.verifyOauth(config);
   extensionsTest.verifyOauth(config);
 });
Exemple #2
0
        oauth.verifyToken(header, function(err) {
          should.not.exist(err);
          should.exist(token);

          // now, add a cache
          if (!config.oauth.isCached) {
            var addedCache = true;
            var cache = MemCache.create('OAuth cache');
            config.oauth.useCache(cache);
          }

          oauth.verifyToken(header, 'badscope', function(err) {
            should.exist(err);

            oauth.verifyToken(header, 'scope1', function(err) {
              should.not.exist(err);

              oauth.verifyToken(header, 'scope2', function(err) {
                should.not.exist(err);

                if (addedCache) { config.oauth.removeCache(); }

                done();
              });
            });
          });
        });
Exemple #3
0
 it('attempting to use a cache with encoding should fail', function(done) {
   var cache = MemCache.create('OAuth cache', { encoding: 'utf8' });
   (function() {
     config.oauth.useCache(cache);
   }
   ).should.throw();
   done();
 });
Exemple #4
0
 before(function(done) {
   var Cache = require('volos-cache-memory');
   var cache = Cache.create('OAuth cache');
   config.oauth.useCache(cache);
   done();
 });