@dt-esa/authorizer
Advanced tools
Comparing version 1.3.0 to 1.4.0
@@ -1,2 +0,2 @@ | ||
export declare type AuthorizatonHandlerOptions = { | ||
export declare type AuthenticationOptions = { | ||
mode: 'azure' | 'saml' | 'client' | 'dynatrace'; | ||
@@ -34,10 +34,12 @@ authorizations?: Map<string, Array<string>>; | ||
* | ||
* @returns | ||
*/ | ||
export declare const authorize: (options: AuthorizatonHandlerOptions) => any; | ||
export declare const authentication: (options: AuthenticationOptions) => any; | ||
/** | ||
* Connect-style middleware that asserts all permissions are satisfied by the | ||
* authenticated user. If a permission is missing, it will reject the transaction. | ||
* @param permissions Permission ID strings. | ||
* @param permissions A list of required Permissions or Scopes an authorized part must have. | ||
* | ||
* - Invoking this method with an empty array or no permissions specified will simply ensure | ||
* that the user is authenticated. | ||
*/ | ||
export declare const authentication: (permissions?: Array<string>) => (req: any, res: any, next: any) => any; | ||
export declare const authorize: (permissions?: Array<string>) => (req: any, res: any, next: any) => any; |
@@ -25,3 +25,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.authentication = exports.authorize = void 0; | ||
exports.authorize = exports.authentication = void 0; | ||
const express_1 = __importDefault(require("express")); | ||
@@ -72,5 +72,4 @@ const axios_1 = __importDefault(require("axios")); | ||
* | ||
* @returns | ||
*/ | ||
const authorize = (options) => { | ||
const authentication = (options) => { | ||
const { mode, clientConnectionPort } = options; | ||
@@ -276,9 +275,12 @@ const router = express_1.default.Router(); | ||
}; | ||
exports.authorize = authorize; | ||
exports.authentication = authentication; | ||
/** | ||
* Connect-style middleware that asserts all permissions are satisfied by the | ||
* authenticated user. If a permission is missing, it will reject the transaction. | ||
* @param permissions Permission ID strings. | ||
* @param permissions A list of required Permissions or Scopes an authorized part must have. | ||
* | ||
* - Invoking this method with an empty array or no permissions specified will simply ensure | ||
* that the user is authenticated. | ||
*/ | ||
const authentication = (permissions = []) => { | ||
const authorize = (permissions = []) => { | ||
return (req, res, next) => { | ||
@@ -306,2 +308,2 @@ if (!req._authorizedScopes) { | ||
}; | ||
exports.authentication = authentication; | ||
exports.authorize = authorize; |
{ | ||
"name": "@dt-esa/authorizer", | ||
"version": "1.3.0", | ||
"version": "1.4.0", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "./dist/index.js", |
16755
349