passport-headerapikey
Advanced tools
Comparing version 1.0.5 to 1.1.0
@@ -0,1 +1,2 @@ | ||
"use strict"; | ||
/** | ||
@@ -8,7 +9,7 @@ * Creator: Christian Hotz | ||
*/ | ||
"use strict"; | ||
exports.__esModule = true; | ||
/** | ||
* Imports | ||
*/ | ||
var BadRequestError = (function () { | ||
var BadRequestError = /** @class */ (function () { | ||
function BadRequestError(message) { | ||
@@ -15,0 +16,0 @@ this.name = 'BadRequestError'; |
@@ -0,1 +1,2 @@ | ||
"use strict"; | ||
/** | ||
@@ -8,9 +9,9 @@ * Creator: Christian Hotz | ||
*/ | ||
"use strict"; | ||
function __export(m) { | ||
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; | ||
} | ||
var Strategy_1 = require('./Strategy'); | ||
exports.default = Strategy_1.Strategy; | ||
exports.__esModule = true; | ||
var Strategy_1 = require("./Strategy"); | ||
exports["default"] = Strategy_1.Strategy; | ||
exports.HeaderAPIKeyStrategy = Strategy_1.Strategy; | ||
__export(require('./errors/BadRequestError')); | ||
__export(require("./errors/BadRequestError")); |
@@ -0,1 +1,8 @@ | ||
/** | ||
* Creator: Christian Hotz | ||
* Company: hydra newmedia GmbH | ||
* Date: 27.06.16 | ||
* | ||
* Copyright hydra newmedia GmbH | ||
*/ | ||
import { Request } from 'express'; | ||
@@ -9,3 +16,3 @@ import { Strategy as PassportStrategy } from 'passport-strategy'; | ||
name: string; | ||
verify: (apiKey: string, verified: (err: Error, user?: Object, info?: Object) => void, req?: Request) => void; | ||
verify: (apiKey: string, verified: (err: Error | null, user?: Object, info?: Object) => void, req?: Request) => void; | ||
passReqToCallback: boolean; | ||
@@ -15,4 +22,4 @@ constructor(header: { | ||
prefix: string; | ||
}, passReqToCallback: boolean, verify: (apiKey: string, verified: (err: Error, user?: Object, info?: Object) => void, req?: Request) => void); | ||
}, passReqToCallback: boolean, verify: (apiKey: string, verified: (err: Error | null, user?: Object, info?: Object) => void, req?: Request) => void); | ||
authenticate(req: Request, options?: Object): void; | ||
} |
@@ -0,1 +1,2 @@ | ||
"use strict"; | ||
/** | ||
@@ -8,23 +9,32 @@ * Creator: Christian Hotz | ||
*/ | ||
"use strict"; | ||
var __extends = (this && this.__extends) || function (d, b) { | ||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; | ||
function __() { this.constructor = d; } | ||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
}; | ||
var __extends = (this && this.__extends) || (function () { | ||
var extendStatics = function (d, b) { | ||
extendStatics = Object.setPrototypeOf || | ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; | ||
return extendStatics(d, b); | ||
} | ||
return function (d, b) { | ||
extendStatics(d, b); | ||
function __() { this.constructor = d; } | ||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
}; | ||
})(); | ||
exports.__esModule = true; | ||
/** | ||
* Imports | ||
*/ | ||
var _ = require('lodash'); | ||
var passport_strategy_1 = require('passport-strategy'); | ||
var BadRequestError_1 = require('./errors/BadRequestError'); | ||
var Strategy = (function (_super) { | ||
var _ = require("lodash"); | ||
var passport_strategy_1 = require("passport-strategy"); | ||
var BadRequestError_1 = require("./errors/BadRequestError"); | ||
var Strategy = /** @class */ (function (_super) { | ||
__extends(Strategy, _super); | ||
function Strategy(header, passReqToCallback, verify) { | ||
_super.call(this); | ||
this.apiKeyHeader = header || { header: 'X-Api-Key', prefix: '' }; | ||
this.apiKeyHeader.header = this.apiKeyHeader.header.toLowerCase(); | ||
this.name = 'headerapikey'; | ||
this.verify = verify; | ||
this.passReqToCallback = passReqToCallback || false; | ||
var _this = _super.call(this) || this; | ||
_this.apiKeyHeader = header || { header: 'X-Api-Key', prefix: '' }; | ||
_this.apiKeyHeader.header = _this.apiKeyHeader.header.toLowerCase(); | ||
_this.name = 'headerapikey'; | ||
_this.verify = verify; | ||
_this.passReqToCallback = passReqToCallback || false; | ||
return _this; | ||
} | ||
@@ -52,3 +62,3 @@ Strategy.prototype.authenticate = function (req, options) { | ||
}; | ||
this.verify(apiKey, verified, this.passReqToCallback ? req : null); | ||
this.verify(apiKey, verified, this.passReqToCallback ? req : undefined); | ||
}; | ||
@@ -55,0 +65,0 @@ return Strategy; |
@@ -10,3 +10,3 @@ { | ||
"author": "Christian Hotz <hotz@hydra-newmedia.com> ", | ||
"version": "1.0.5", | ||
"version": "1.1.0", | ||
"repository": { | ||
@@ -23,2 +23,3 @@ "type": "git", | ||
"scripts": { | ||
"prepublishOnly": "tsc", | ||
"install-typings": "typings install", | ||
@@ -38,5 +39,5 @@ "pretest": "tsc && rm -rf testDist/ && tsc --rootDir test --outDir testDist test/**/*.ts typings/index.d.ts", | ||
"sinon": "^1.17.4", | ||
"typescript": "^1.8.10", | ||
"typings": "^1.3.0" | ||
"typescript": "^3.0.1", | ||
"typings": "^2.1.1" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
9345
148