How to use the hawk.uri function in hawk

To help you get started, we’ve selected a few hawk examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jfromaniello / passport-hawk / lib / strategy.js View on Github external
Strategy.prototype.authenticate = function(req) {
  //express change req.url when mounting with app.use
  //this creates a new request object with url = originalUrl
  req = xtend({}, req, { url: req.originalUrl || req.url });

  if(this.bewit){
    hawk.uri.authenticate(req, this.verify, {}, function (err, credentials, ext) {
      if (err && err.isMissing) return this.fail('Missing authentication tokens');
      if (err && err.message === 'Missing credentials') return this.fail('Invalid authentication tokens');
      if (err) return this.error(new Error(err.message)); // Return hawk error
      this.success(credentials.user, ext);
    }.bind(this));
  }else{
    hawk.server.authenticate(req, this.verify, {}, function (err, credentials, ext) {
      if (err && err.isMissing) return this.fail('Missing authentication tokens');
      if (err && err.message === 'Missing credentials') return this.fail('Invalid authentication tokens');
      if (err && err.message) return this.error(new Error(err.message)); // Return hawk error
      this.success(credentials.user, ext);
    }.bind(this));
  }
};
github jfromaniello / passport-hawk / test / bewit.tests.js View on Github external
it('should call done with false when the id doesnt exist', function(testDone) {
    var bewit = Hawk.uri.getBewit('http://example.com:8080/foobar', {
      credentials: {
        id: '321321',
        key: 'dsa',
        algorithm: 'sha256'
      },
      ttlSec: 60 * 5
    });

    var req = {
      headers: {
        host: 'example.com:8080'
      },
      method: 'GET',
      url: '/resource/4?filter=a&bewit=' + bewit
    };
github vightel / FloodMapsWorkshop / publisher / lib / query_l8.js View on Github external
function Bewit(url) {
		if( credentials ) {
			var bewit = Hawk.uri.getBewit(url, { credentials: credentials, ttlSec: duration, ext: user.email })
			url += "?bewit="+bewit
		}
		return url;
	}
	var source 		= req.gettext("sources.l8")
github vightel / FloodMapsWorkshop / publisher / lib / query_active_fires.js View on Github external
function Bewit(url) {
			if( credentials ) {
				var bewit = Hawk.uri.getBewit(url, { credentials: credentials, ttlSec: duration, ext: user.email })
				url += "?bewit="+bewit
			}
			return url;
		}
github vightel / FloodMapsWorkshop / publisher / lib / s3queries / query_s3.js View on Github external
function Bewit(url) {
			if( credentials ) {
				var bewit = Hawk.uri.getBewit(url, { credentials: credentials, ttlSec: duration, ext: user.email })
				url += "?bewit="+bewit
			} 
			return url;
		}
github vightel / FloodMapsWorkshop / publisher / app / controllers / products.js View on Github external
function Bewit(url) {
			var bewit = Hawk.uri.getBewit(url, { credentials: credentials, ttlSec: duration, ext: user.email })
			url += "?bewit="+bewit
			return url;
		}
github vightel / FloodMapsWorkshop / publisher / app / controllers / products.js View on Github external
function Bewit(url) {
			var bewit = Hawk.uri.getBewit(url, { credentials: credentials, ttlSec: duration, ext: user.email })
			url += "?bewit="+bewit
			return url;
		}
github vightel / FloodMapsWorkshop / publisher / lib / query_dfo.js View on Github external
function Bewit(url) {
		if( credentials ) {
			var bewit = Hawk.uri.getBewit(url, { credentials: credentials, ttlSec: duration, ext: user.email })
			url += "?bewit="+bewit
		}
		return url;
	}
	var source 		= req.gettext("sources.dfo")
github vightel / FloodMapsWorkshop / publisher / lib / query_modislst.js View on Github external
function Bewit(url) {
			if( credentials ) {
				var bewit = Hawk.uri.getBewit(url, { credentials: credentials, ttlSec: duration, ext: user.email })
				url += "?bewit="+bewit
			}
			return url;
		}
github vightel / FloodMapsWorkshop / publisher / lib / query_eo1.js View on Github external
function Bewit(url) {
		if( credentials ) {
			var bewit = Hawk.uri.getBewit(url, { credentials: credentials, ttlSec: duration, ext: user.email })
			url += "?bewit="+bewit
		}
		return url;
	}

hawk

HTTP Hawk Authentication Scheme

BSD-3-Clause
Latest version published 7 months ago

Package Health Score

43 / 100
Full package analysis