@companieshouse/web-security-node
Advanced tools
Comparing version 1.0.3 to 1.0.4
"use strict"; | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
}); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const tslib_1 = require("tslib"); | ||
const crypto_1 = require("crypto"); | ||
@@ -16,3 +24,3 @@ const node_jose_1 = require("node-jose"); | ||
jweEncodeWithNonce(returnUri, nonce) { | ||
return tslib_1.__awaiter(this, void 0, void 0, function* () { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const payloadObject = { | ||
@@ -19,0 +27,0 @@ nonce, |
"use strict"; | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
}); | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.companyAuthMiddleware = exports.authMiddleware = void 0; | ||
const tslib_1 = require("tslib"); | ||
require("@companieshouse/node-session-handler"); | ||
@@ -9,3 +20,3 @@ const SessionKey_1 = require("@companieshouse/node-session-handler/lib/session/keys/SessionKey"); | ||
const structured_logging_node_1 = require("@companieshouse/structured-logging-node"); | ||
const jwt_encryption_service_1 = tslib_1.__importDefault(require("app/encryption/jwt.encryption.service")); | ||
const jwt_encryption_service_1 = __importDefault(require("./encryption/jwt.encryption.service")); | ||
const APP_NAME = 'web-security-node'; | ||
@@ -34,3 +45,3 @@ const logger = structured_logging_node_1.createLogger(APP_NAME); | ||
const SCOPE_COMPANY_WRITE_FULL_FORMAT = 'https://api.companieshouse.gov.uk/company/{COMPANY_NUMBER}/admin.write-full'; | ||
exports.companyAuthMiddleware = (config) => (req, res, next) => tslib_1.__awaiter(void 0, void 0, void 0, function* () { | ||
exports.companyAuthMiddleware = (config) => (req, res, next) => __awaiter(void 0, void 0, void 0, function* () { | ||
const appName = 'CH Web Security Node'; | ||
@@ -55,3 +66,3 @@ if (!req.session) { | ||
function getAuthRedirectUri(req, authConfig, encryptionService, scope) { | ||
return tslib_1.__awaiter(this, void 0, void 0, function* () { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const originalUrl = req.originalUrl; | ||
@@ -64,3 +75,3 @@ const nonce = encryptionService.generateNonce(); | ||
function createAuthUri(encodedNonce, authConfig, scope) { | ||
return tslib_1.__awaiter(this, void 0, void 0, function* () { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
let authUri = `${authConfig.authUri}`.concat('?', `client_id=${authConfig.accountClientId}`, `&redirect_uri=${authConfig.callbackUri}`, `&response_type=code`); | ||
@@ -67,0 +78,0 @@ if (scope) { |
{ | ||
"name": "@companieshouse/web-security-node", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"description": "Middleware for chs authentication", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
10328
165
0