Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@loopback/authorization

Package Overview
Dependencies
Maintainers
7
Versions
82
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@loopback/authorization - npm Package Compare versions

Comparing version 0.4.10 to 0.5.0

27

CHANGELOG.md

@@ -6,2 +6,29 @@ # Change Log

# [0.5.0](https://github.com/strongloop/loopback-next/compare/@loopback/authorization@0.4.10...@loopback/authorization@0.5.0) (2020-03-05)
### Bug Fixes
* **authorization:** fix sample code in README ([d2f1662](https://github.com/strongloop/loopback-next/commit/d2f1662a1d372f435794985310985177387974a2))
### chore
* remove support for Node.js v8.x ([4281d9d](https://github.com/strongloop/loopback-next/commit/4281d9df50f0715d32879e1442a90b643ec8f542))
### Features
* add `tslib` as dependency ([a6e0b4c](https://github.com/strongloop/loopback-next/commit/a6e0b4ce7b862764167cefedee14c1115b25e0a4)), closes [#4676](https://github.com/strongloop/loopback-next/issues/4676)
### BREAKING CHANGES
* Node.js v8.x is now end of life. Please upgrade to version
10 and above. See https://nodejs.org/en/about/releases.
## [0.4.10](https://github.com/strongloop/loopback-next/compare/@loopback/authorization@0.4.9...@loopback/authorization@0.4.10) (2020-02-06)

@@ -8,0 +35,0 @@

11

dist/authorization-component.js
"use strict";
// Copyright IBM Corp. 2018. All Rights Reserved.
// Copyright IBM Corp. 2018,2019. All Rights Reserved.
// Node module: @loopback/authorization
// This file is licensed under the MIT License.
// License text available at https://opensource.org/licenses/MIT
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const core_1 = require("@loopback/core");

@@ -21,3 +16,3 @@ const authorize_interceptor_1 = require("./authorize-interceptor");

};
AuthorizationComponent = __decorate([
AuthorizationComponent = tslib_1.__decorate([
core_1.bind({ tags: { [core_1.ContextTags.KEY]: keys_1.AuthorizationBindings.COMPONENT.key } })

@@ -24,0 +19,0 @@ ], AuthorizationComponent);

"use strict";
// Copyright IBM Corp. 2019. All Rights Reserved.
// Copyright IBM Corp. 2018,2020. All Rights Reserved.
// Node module: @loopback/authorization
// This file is licensed under the MIT License.
// License text available at https://opensource.org/licenses/MIT
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
return function (target, key) { decorator(target, key, paramIndex); }
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const context_1 = require("@loopback/context");
const security_1 = require("@loopback/security");
const debug_1 = __importDefault(require("debug"));
const debug_1 = tslib_1.__importDefault(require("debug"));
const authorize_1 = require("./decorators/authorize");

@@ -39,3 +25,3 @@ const keys_1 = require("./keys");

async intercept(invocationCtx, next) {
var _a, _b;
var _a;
const description = debug.enabled ? invocationCtx.description : '';

@@ -46,4 +32,4 @@ let metadata = authorize_1.getAuthorizationMetadata(invocationCtx.target, invocationCtx.methodName);

}
metadata = (metadata !== null && metadata !== void 0 ? metadata : this.options.defaultMetadata);
if (!metadata || ((_a = metadata) === null || _a === void 0 ? void 0 : _a.skip)) {
metadata = metadata !== null && metadata !== void 0 ? metadata : this.options.defaultMetadata;
if (!metadata || (metadata === null || metadata === void 0 ? void 0 : metadata.skip)) {
debug('Authorization is skipped for %s', description);

@@ -67,3 +53,3 @@ const result = await next();

debug('Security context for %s', description, authorizationCtx);
const authorizers = await loadAuthorizers(invocationCtx, (_b = metadata.voters, (_b !== null && _b !== void 0 ? _b : [])));
const authorizers = await loadAuthorizers(invocationCtx, (_a = metadata.voters) !== null && _a !== void 0 ? _a : []);
let finalDecision = this.options.defaultDecision;

@@ -101,6 +87,6 @@ for (const fn of authorizers) {

};
AuthorizationInterceptor = __decorate([
AuthorizationInterceptor = tslib_1.__decorate([
context_1.bind(context_1.asGlobalInterceptor('authorization')),
__param(0, context_1.config({ fromBinding: keys_1.AuthorizationBindings.COMPONENT })),
__metadata("design:paramtypes", [Object])
tslib_1.__param(0, context_1.config({ fromBinding: keys_1.AuthorizationBindings.COMPONENT })),
tslib_1.__metadata("design:paramtypes", [Object])
], AuthorizationInterceptor);

@@ -107,0 +93,0 @@ exports.AuthorizationInterceptor = AuthorizationInterceptor;

"use strict";
// Copyright IBM Corp. 2019. All Rights Reserved.
// Copyright IBM Corp. 2018,2019. All Rights Reserved.
// Node module: @loopback/authorization

@@ -42,3 +42,3 @@ // This file is licensed under the MIT License.

const list = [];
const set = new Set((src !== null && src !== void 0 ? src : []));
const set = new Set(src !== null && src !== void 0 ? src : []);
if (target) {

@@ -45,0 +45,0 @@ for (const i of target) {

@@ -6,11 +6,9 @@ "use strict";

// License text available at https://opensource.org/licenses/MIT
function __export(m) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
Object.defineProperty(exports, "__esModule", { value: true });
__export(require("./authorization-component"));
__export(require("./authorize-interceptor"));
__export(require("./decorators/authorize"));
__export(require("./keys"));
__export(require("./types"));
const tslib_1 = require("tslib");
tslib_1.__exportStar(require("./authorization-component"), exports);
tslib_1.__exportStar(require("./authorize-interceptor"), exports);
tslib_1.__exportStar(require("./decorators/authorize"), exports);
tslib_1.__exportStar(require("./keys"), exports);
tslib_1.__exportStar(require("./types"), exports);
//# sourceMappingURL=index.js.map
"use strict";
// Copyright IBM Corp. 2018. All Rights Reserved.
// Copyright IBM Corp. 2018,2019. All Rights Reserved.
// Node module: @loopback/authorization

@@ -4,0 +4,0 @@ // This file is licensed under the MIT License.

"use strict";
// Copyright IBM Corp. 2018. All Rights Reserved.
// Copyright IBM Corp. 2018,2020. All Rights Reserved.
// Node module: @loopback/authorization

@@ -4,0 +4,0 @@ // This file is licensed under the MIT License.

"use strict";
// Copyright IBM Corp. 2019. All Rights Reserved.
// Node module: @loopback/authorization
// This file is licensed under the MIT License.
// License text available at https://opensource.org/licenses/MIT
Object.defineProperty(exports, "__esModule", { value: true });

@@ -20,5 +24,5 @@ const security_1 = require("@loopback/security");

var _a;
return Object.assign(Object.assign({}, user), { name: (_a = user.name, (_a !== null && _a !== void 0 ? _a : user[security_1.securityId])), type: 'USER' });
return Object.assign(Object.assign({}, user), { name: (_a = user.name) !== null && _a !== void 0 ? _a : user[security_1.securityId], type: 'USER' });
}
exports.createPrincipalFromUserProfile = createPrincipalFromUserProfile;
//# sourceMappingURL=util.js.map

@@ -1,2 +0,2 @@

// Copyright IBM Corp. 2017,2018. All Rights Reserved.
// Copyright IBM Corp. 2018,2019. All Rights Reserved.
// Node module: @loopback/authorization

@@ -3,0 +3,0 @@ // This file is licensed under the MIT License.

@@ -1,2 +0,2 @@

// Copyright IBM Corp. 2017,2018. All Rights Reserved.
// Copyright IBM Corp. 2018. All Rights Reserved.
// Node module: @loopback/authorization

@@ -3,0 +3,0 @@ // This file is licensed under the MIT License.

{
"name": "@loopback/authorization",
"version": "0.4.10",
"version": "0.5.0",
"description": "A LoopBack component for authorization support.",
"engines": {
"node": ">=8.9"
"node": ">=10"
},

@@ -25,13 +25,14 @@ "publishConfig": {

"dependencies": {
"@loopback/context": "^2.1.1",
"@loopback/core": "^1.12.4",
"@loopback/security": "^0.1.13",
"debug": "^4.1.1"
"@loopback/context": "^3.0.0",
"@loopback/core": "^2.0.0",
"@loopback/security": "^0.2.0",
"debug": "^4.1.1",
"tslib": "^1.11.1"
},
"devDependencies": {
"@loopback/build": "^3.1.1",
"@loopback/testlab": "^1.10.3",
"@loopback/build": "^4.0.0",
"@loopback/testlab": "^2.0.0",
"@types/debug": "^4.1.4",
"@types/node": "10.17.14",
"casbin": "^3.1.0"
"@types/node": "10.17.17",
"casbin": "^4.1.1"
},

@@ -55,3 +56,3 @@ "keywords": [

},
"gitHead": "6eea5e428b145cafb84a998bd53979da8c8fba07"
"gitHead": "baf9c89decba06b826204cd43e58a11be05408f8"
}

@@ -101,5 +101,5 @@ # @loopback/authorization

const options: AuthorizationOptions = {
precedence: AuthorizationDecisions.DENY;
defaultDecision: AuthorizationDecisions.DENY;
}
precedence: AuthorizationDecisions.DENY,
defaultDecision: AuthorizationDecisions.DENY,
};

@@ -109,6 +109,6 @@ const binding = app.component(AuthorizationComponent);

app.bind('authorizationProviders.my-authorizer-provider')
.toProvider(MyAuthorizationProvider)
.tag(AuthorizationTags.AUTHORIZER);
app
.bind('authorizationProviders.my-authorizer-provider')
.toProvider(MyAuthorizationProvider)
.tag(AuthorizationTags.AUTHORIZER);
```

@@ -115,0 +115,0 @@

@@ -1,2 +0,2 @@

// Copyright IBM Corp. 2018. All Rights Reserved.
// Copyright IBM Corp. 2018,2019. All Rights Reserved.
// Node module: @loopback/authorization

@@ -3,0 +3,0 @@ // This file is licensed under the MIT License.

@@ -1,2 +0,2 @@

// Copyright IBM Corp. 2019. All Rights Reserved.
// Copyright IBM Corp. 2018,2020. All Rights Reserved.
// Node module: @loopback/authorization

@@ -3,0 +3,0 @@ // This file is licensed under the MIT License.

@@ -1,2 +0,2 @@

// Copyright IBM Corp. 2019. All Rights Reserved.
// Copyright IBM Corp. 2018,2019. All Rights Reserved.
// Node module: @loopback/authorization

@@ -3,0 +3,0 @@ // This file is licensed under the MIT License.

@@ -1,2 +0,2 @@

// Copyright IBM Corp. 2018. All Rights Reserved.
// Copyright IBM Corp. 2018,2019. All Rights Reserved.
// Node module: @loopback/authorization

@@ -3,0 +3,0 @@ // This file is licensed under the MIT License.

@@ -1,2 +0,2 @@

// Copyright IBM Corp. 2018. All Rights Reserved.
// Copyright IBM Corp. 2018,2020. All Rights Reserved.
// Node module: @loopback/authorization

@@ -3,0 +3,0 @@ // This file is licensed under the MIT License.

@@ -0,1 +1,6 @@

// Copyright IBM Corp. 2019. All Rights Reserved.
// Node module: @loopback/authorization
// This file is licensed under the MIT License.
// License text available at https://opensource.org/licenses/MIT
import {Principal, securityId, UserProfile} from '@loopback/security';

@@ -2,0 +7,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc