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

@loopback/authentication

Package Overview
Dependencies
Maintainers
20
Versions
218
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@loopback/authentication - npm Package Compare versions

Comparing version 4.0.0-alpha.2 to 4.0.0-alpha.3

lib/keys.d.ts

15

lib/decorator.d.ts

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

export interface IMetadata {
import { Constructor } from '@loopback/context';
export interface AuthenticationMetadata {
strategy: string;
options: Object;
options?: Object;
}
export declare class AuthenticationMetadata {
private strategy;
private optionValues;
strategyName: string;
options: Object;
constructor(strategy: string, optionValues?: Object);
getMetadata(): IMetadata;
}
/**

@@ -24,2 +17,2 @@ * decorator to add authentication metadata to controller methods

*/
export declare function getAuthenticateMetadata(controllerObj: Object, methodName: string): IMetadata;
export declare function getAuthenticateMetadata(controllerClass: Constructor<{}>, methodName: string): AuthenticationMetadata | undefined;

@@ -8,16 +8,3 @@ "use strict";

const context_1 = require("@loopback/context");
/* class to hold authentication metadata
*/
class AuthenticationMetadata {
constructor(strategy, optionValues) {
this.strategy = strategy;
this.optionValues = optionValues;
this.strategyName = strategy;
this.options = optionValues || {};
}
getMetadata() {
return { strategy: this.strategyName, options: this.options };
}
}
exports.AuthenticationMetadata = AuthenticationMetadata;
const keys_1 = require("./keys");
/**

@@ -30,4 +17,7 @@ * decorator to add authentication metadata to controller methods

return function (controllerClass, methodName) {
const metadataObj = new AuthenticationMetadata(strategyName, options || {});
context_1.Reflector.defineMetadata('loopback:authenticate', metadataObj, controllerClass, methodName);
const metadataObj = {
strategy: strategyName,
options: options || {},
};
context_1.Reflector.defineMetadata(keys_1.BindingKeys.Authentication.METADATA, metadataObj, controllerClass, methodName);
};

@@ -41,7 +31,6 @@ }

*/
function getAuthenticateMetadata(controllerObj, methodName) {
const metadataObj = context_1.Reflector.getMetadata('loopback:authenticate', controllerObj, methodName);
return metadataObj.getMetadata();
function getAuthenticateMetadata(controllerClass, methodName) {
return context_1.Reflector.getMetadata(keys_1.BindingKeys.Authentication.METADATA, controllerClass.prototype, methodName);
}
exports.getAuthenticateMetadata = getAuthenticateMetadata;
//# sourceMappingURL=decorator.js.map
export * from './decorator';
export * from './strategy-adapter';
export * from './metadata-provider';
export * from './provider';
export * from './keys';

@@ -12,2 +12,5 @@ "use strict";

__export(require("./strategy-adapter"));
__export(require("./metadata-provider"));
__export(require("./provider"));
__export(require("./keys"));
//# sourceMappingURL=index.js.map
/// <reference types="passport" />
import { ParsedRequest } from '@loopback/core';
import { Strategy } from 'passport';
import { UserProfile } from './provider';
/**

@@ -13,3 +14,3 @@ * Shimmed Request to satisfy express requirements of passport strategies.

method: string;
constructor(request?: ParsedRequest);
constructor(request: ParsedRequest);
}

@@ -25,7 +26,8 @@ /**

export declare class StrategyAdapter {
private strategyClass;
private readonly strategy;
/**
* @param strategyClass class which implements a passport-strategy;see: http://passportjs.org/
* @param strategy instance of a class which implements a passport-strategy;
* @description http://passportjs.org/
*/
constructor(strategyClass: Strategy);
constructor(strategy: Strategy);
/**

@@ -38,3 +40,3 @@ * The function to invoke the contained passport strategy.

*/
authenticate(req: ParsedRequest): Promise<Object>;
authenticate(req: ParsedRequest): Promise<UserProfile>;
}

@@ -9,4 +9,2 @@ "use strict";

constructor(request) {
if (!request)
return;
this.headers = request.headers;

@@ -30,6 +28,7 @@ this.query = request.query;

/**
* @param strategyClass class which implements a passport-strategy;see: http://passportjs.org/
* @param strategy instance of a class which implements a passport-strategy;
* @description http://passportjs.org/
*/
constructor(strategyClass) {
this.strategyClass = strategyClass;
constructor(strategy) {
this.strategy = strategy;
}

@@ -46,5 +45,4 @@ /**

return new Promise((resolve, reject) => {
// create an instance of the strategy
const strategy = Object.create(this.strategyClass);
const self = this;
// create a prototype chain of an instance of a passport strategy
const strategy = Object.create(this.strategy);
// add success state handler to strategy instance

@@ -51,0 +49,0 @@ strategy.success = function (user) {

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

export interface IMetadata {
import { Constructor } from '@loopback/context';
export interface AuthenticationMetadata {
strategy: string;
options: Object;
options?: Object;
}
export declare class AuthenticationMetadata {
private strategy;
private optionValues;
strategyName: string;
options: Object;
constructor(strategy: string, optionValues?: Object);
getMetadata(): IMetadata;
}
/**

@@ -24,2 +17,2 @@ * decorator to add authentication metadata to controller methods

*/
export declare function getAuthenticateMetadata(controllerObj: Object, methodName: string): IMetadata;
export declare function getAuthenticateMetadata(controllerClass: Constructor<{}>, methodName: string): AuthenticationMetadata | undefined;

@@ -8,16 +8,3 @@ "use strict";

const context_1 = require("@loopback/context");
/* class to hold authentication metadata
*/
class AuthenticationMetadata {
constructor(strategy, optionValues) {
this.strategy = strategy;
this.optionValues = optionValues;
this.strategyName = strategy;
this.options = optionValues || {};
}
getMetadata() {
return { strategy: this.strategyName, options: this.options };
}
}
exports.AuthenticationMetadata = AuthenticationMetadata;
const keys_1 = require("./keys");
/**

@@ -30,4 +17,7 @@ * decorator to add authentication metadata to controller methods

return function (controllerClass, methodName) {
const metadataObj = new AuthenticationMetadata(strategyName, options || {});
context_1.Reflector.defineMetadata('loopback:authenticate', metadataObj, controllerClass, methodName);
const metadataObj = {
strategy: strategyName,
options: options || {},
};
context_1.Reflector.defineMetadata(keys_1.BindingKeys.Authentication.METADATA, metadataObj, controllerClass, methodName);
};

@@ -41,7 +31,6 @@ }

*/
function getAuthenticateMetadata(controllerObj, methodName) {
const metadataObj = context_1.Reflector.getMetadata('loopback:authenticate', controllerObj, methodName);
return metadataObj.getMetadata();
function getAuthenticateMetadata(controllerClass, methodName) {
return context_1.Reflector.getMetadata(keys_1.BindingKeys.Authentication.METADATA, controllerClass.prototype, methodName);
}
exports.getAuthenticateMetadata = getAuthenticateMetadata;
//# sourceMappingURL=decorator.js.map
export * from './decorator';
export * from './strategy-adapter';
export * from './metadata-provider';
export * from './provider';
export * from './keys';

@@ -12,2 +12,5 @@ "use strict";

__export(require("./strategy-adapter"));
__export(require("./metadata-provider"));
__export(require("./provider"));
__export(require("./keys"));
//# sourceMappingURL=index.js.map
/// <reference types="passport" />
import { ParsedRequest } from '@loopback/core';
import { Strategy } from 'passport';
import { UserProfile } from './provider';
/**

@@ -13,3 +14,3 @@ * Shimmed Request to satisfy express requirements of passport strategies.

method: string;
constructor(request?: ParsedRequest);
constructor(request: ParsedRequest);
}

@@ -25,7 +26,8 @@ /**

export declare class StrategyAdapter {
private strategyClass;
private readonly strategy;
/**
* @param strategyClass class which implements a passport-strategy;see: http://passportjs.org/
* @param strategy instance of a class which implements a passport-strategy;
* @description http://passportjs.org/
*/
constructor(strategyClass: Strategy);
constructor(strategy: Strategy);
/**

@@ -38,3 +40,3 @@ * The function to invoke the contained passport strategy.

*/
authenticate(req: ParsedRequest): Promise<Object>;
authenticate(req: ParsedRequest): Promise<UserProfile>;
}

@@ -9,4 +9,2 @@ "use strict";

constructor(request) {
if (!request)
return;
this.headers = request.headers;

@@ -30,6 +28,7 @@ this.query = request.query;

/**
* @param strategyClass class which implements a passport-strategy;see: http://passportjs.org/
* @param strategy instance of a class which implements a passport-strategy;
* @description http://passportjs.org/
*/
constructor(strategyClass) {
this.strategyClass = strategyClass;
constructor(strategy) {
this.strategy = strategy;
}

@@ -46,5 +45,4 @@ /**

return new Promise((resolve, reject) => {
// create an instance of the strategy
const strategy = Object.create(this.strategyClass);
const self = this;
// create a prototype chain of an instance of a passport strategy
const strategy = Object.create(this.strategy);
// add success state handler to strategy instance

@@ -51,0 +49,0 @@ strategy.success = function (user) {

{
"name": "@loopback/authentication",
"version": "4.0.0-alpha.2",
"version": "4.0.0-alpha.3",
"description": "A LoopBack component for authentication support.",

@@ -21,4 +21,4 @@ "scripts": {

"dependencies": {
"@loopback/context": "^4.0.0-alpha.7",
"@loopback/core": "^4.0.0-alpha.6",
"@loopback/context": "^4.0.0-alpha.9",
"@loopback/core": "^4.0.0-alpha.9",
"@types/passport": "^0.3.3",

@@ -29,4 +29,4 @@ "passport": "^0.3.2",

"devDependencies": {
"@loopback/openapi-spec-builder": "^4.0.0-alpha.3",
"@loopback/testlab": "^4.0.0-alpha.4",
"@loopback/openapi-spec-builder": "^4.0.0-alpha.4",
"@loopback/testlab": "^4.0.0-alpha.5",
"mocha": "^3.2.0"

@@ -33,0 +33,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

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