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 2.0.0-alpha.1.2.0 to 2.0.0-alpha.1.3.0

2

lib/actions/authorization/load_account.js

@@ -11,3 +11,3 @@ 'use strict';

const Account = provider.Account;
ctx.oidc.account = await Account.findById(accountId);
ctx.oidc.account = await Account.findById.call(ctx, accountId);
}

@@ -14,0 +14,0 @@

@@ -31,4 +31,4 @@ 'use strict';

async function validateInitialAccessToken(ctx, next) {
const setup = instance(provider).configuration('features.registration');
switch (setup.initialAccessToken && typeof setup.initialAccessToken) {
const registration = instance(provider).configuration('features.registration');
switch (registration.initialAccessToken && typeof registration.initialAccessToken) {
case 'boolean': {

@@ -41,3 +41,3 @@ const initialAccessToken = await provider.InitialAccessToken.find(ctx.oidc.bearer);

const valid = constantEquals(
new Buffer(setup.initialAccessToken, 'utf8'),
new Buffer(registration.initialAccessToken, 'utf8'),
new Buffer(ctx.oidc.bearer, 'utf8'),

@@ -66,2 +66,3 @@ 1000);

ctx.oidc.client = client;
ctx.oidc.registrationAccessToken = regAccessToken;

@@ -78,3 +79,3 @@ await next();

const properties = {};
const clientId = uuid.v4();
const clientId = uuid();

@@ -178,4 +179,2 @@ const rat = new provider.RegistrationAccessToken({ clientId });

provider.emit('registration_update.success', ctx.oidc.client, ctx);
const properties = {};

@@ -214,2 +213,14 @@

const management = instance(provider).configuration('features.registrationManagement');
if (management.rotateRegistrationAccessToken) {
const rat = new provider.RegistrationAccessToken({ clientId: ctx.oidc.client.clientId });
await ctx.oidc.registrationAccessToken.destroy();
ctx.oidc.registrationAccessToken = rat;
ctx.body.registration_access_token = await rat.save();
}
provider.emit('registration_update.success', ctx.oidc.client, ctx);
await next();

@@ -216,0 +227,0 @@ },

@@ -54,3 +54,3 @@ 'use strict';

const account = await provider.Account.findById(code.accountId);
const account = await provider.Account.findById.call(ctx, code.accountId);

@@ -57,0 +57,0 @@ ctx.assert(account,

@@ -38,3 +38,3 @@ 'use strict';

const account = await Account.findById(refreshToken.accountId);
const account = await Account.findById.call(ctx, refreshToken.accountId);

@@ -41,0 +41,0 @@ ctx.assert(account,

@@ -82,3 +82,3 @@ 'use strict';

async function loadAccount(ctx, next) {
const account = await provider.Account.findById(ctx.oidc.accessToken.accountId);
const account = await provider.Account.findById.call(ctx, ctx.oidc.accessToken.accountId);

@@ -85,0 +85,0 @@ ctx.assert(account, new errors.InvalidTokenError());

'use strict';
const MemoryAdapter = require('../adapters/memory_adapter');
const ConfigurationSchema = require('./configuration_schema');

@@ -55,10 +54,2 @@

/* eslint-enable */
if (!this.adapter) this.adapter = MemoryAdapter;
if (!this.findById) {
this.findById = id => Promise.resolve({
accountId: id,
claims() { return { sub: id }; },
});
}
}

@@ -65,0 +56,0 @@ }

@@ -5,2 +5,3 @@ 'use strict';

const epochTime = require('../helpers/epoch_time');
const MemoryAdapter = require('../adapters/memory_adapter');

@@ -229,3 +230,4 @@ const cache = new LRU(100);

*/
logoutSource: function logoutSource(form) {
logoutSource(form) {
// this => koa context;
this.body = `<!DOCTYPE html>

@@ -251,3 +253,3 @@ <head>

*/
uniqueness: function uniqueness(jti, expiresAt) {
uniqueness(jti, expiresAt) {
// this => koa context;

@@ -269,3 +271,4 @@ if (cache.get(jti)) return Promise.resolve(false);

*/
renderError: function renderError(error) {
renderError(error) {
// this => koa context;
this.type = 'html';

@@ -293,6 +296,31 @@

*/
interactionUrl: function interactionUrl(interaction) { // eslint-disable-line no-unused-vars
interactionUrl(interaction) { // eslint-disable-line no-unused-vars
// this => koa context;
return `/interaction/${this.oidc.uuid}`;
},
/*
* findById
*
* description: helper used by the OP to load your account and retrieve it's avaialble claims
* affects: authorization, authorization_code and refresh_token grants, id token claims
* note: The whole method should return a Promise and #claims() can return a Promise too
*/
findById(id) {
// this => koa context;
return Promise.resolve({
accountId: id,
claims() { return { sub: id }; },
});
},
/*
* adapter
*
* description: TODO
* -> see https://github.com/panva/node-oidc-provider/blob/master/docs/configuration.md#persistance
*/
adapter: MemoryAdapter,
};

@@ -64,3 +64,3 @@ {

},
"version": "2.0.0-alpha.1.2.0",
"version": "2.0.0-alpha.1.3.0",
"files": [

@@ -67,0 +67,0 @@ "lib"

@@ -27,4 +27,4 @@ # oidc-provider

## 'next' branch/release
This branch is being kept up to date with the latest master only having the internal dependencies
being koa2 based, therefore requiring ES7 async/await capable node runtime (or live transpile).
This branch is being kept up to date with the latest release, only having the internal dependencies
koa2 based, therefore requiring ES7 async/await capable node runtime (or live transpile).
There are no extra features or master-unreleased features. 2.0.0 of this library will come when koa2

@@ -31,0 +31,0 @@ releases as latest and when ES7 async/await lands in LTS nodejs release (probably LTSv8).

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