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

oidc-provider

Package Overview
Dependencies
Maintainers
1
Versions
339
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

oidc-provider - npm Package Compare versions

Comparing version 7.11.3 to 7.11.4

lib/helpers/type_validators.js

13

lib/helpers/initialize_adapter.js

@@ -0,1 +1,3 @@

const util = require('util');
const MemoryAdapter = require('../adapters/memory_adapter');

@@ -5,2 +7,3 @@

const attention = require('./attention');
const { isConstructable } = require('./type_validators');

@@ -14,6 +17,8 @@ module.exports = function initializeAdapter(adapter = MemoryAdapter) {

if (!adapter.prototype || !adapter.prototype.constructor.name) {
throw new Error(
'Expected "adapter" to be a constructor, provide a valid adapter in Provider config.',
);
const constructable = isConstructable(adapter);
const executable = typeof adapter === 'function' && !util.types.isAsyncFunction(adapter);
const valid = constructable || executable;
if (!valid) {
throw new Error('Expected "adapter" to be a constructor or a factory function, provide a valid adapter in Provider config.');
}

@@ -20,0 +25,0 @@

@@ -16,2 +16,3 @@ /* eslint-disable max-classes-per-file */

const instance = require('../helpers/weak_cache');
const { isConstructable } = require('../helpers/type_validators');

@@ -27,3 +28,7 @@ const hasFormat = require('./mixins/has_format');

if (!adapterCache.has(obj)) {
adapterCache.set(obj, new (instance(provider).Adapter)(obj.name));
if (isConstructable(instance(provider).Adapter)) {
adapterCache.set(obj, new (instance(provider).Adapter)(obj.name));
} else {
adapterCache.set(obj, instance(provider).Adapter(obj.name));
}
}

@@ -30,0 +35,0 @@

@@ -19,2 +19,3 @@ /* eslint-disable max-classes-per-file */

const epochTime = require('../helpers/epoch_time');
const { isConstructable } = require('../helpers/type_validators');
const instance = require('../helpers/weak_cache');

@@ -138,3 +139,9 @@ const constantEquals = require('../helpers/constant_equals');

function getAdapter() {
if (!adapter) adapter = new (instance(provider).Adapter)('Client');
if (!adapter) {
if (isConstructable(instance(provider).Adapter)) {
adapter = new (instance(provider).Adapter)('Client');
} else {
adapter = instance(provider).Adapter('Client');
}
}
return adapter;

@@ -141,0 +148,0 @@ }

{
"name": "oidc-provider",
"version": "7.11.3",
"version": "7.11.4",
"description": "OAuth 2.0 Authorization Server implementation for Node.js with OpenID Connect",

@@ -5,0 +5,0 @@ "keywords": [

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