Socket
Socket
Sign inDemoInstall

openid-client

Package Overview
Dependencies
44
Maintainers
1
Versions
180
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.13.0 to 1.14.0

5

CHANGELOG.md

@@ -8,2 +8,3 @@ # openid-client CHANGELOG

<!-- TOC START min:2 max:2 link:true update:true -->
- [Version 1.14.0](#version-1140)
- [Version 1.13.0](#version-1130)

@@ -28,2 +29,6 @@ - [Version 1.12.0](#version-1120)

## Version 1.14.0
- [DIFF](https://github.com/panva/node-openid-client/compare/v1.13.0...v1.14.0)
- added Passport Strategy `passReqToCallback` option, defaults to false
## Version 1.13.0

@@ -30,0 +35,0 @@ - [DIFF](https://github.com/panva/node-openid-client/compare/v1.12.1...v1.13.0)

15

lib/passport_strategy.js

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

this._verify = verify;
this._passReqToCallback = opts.passReqToCallback;
this._key = opts.sessionKey || `oidc:${url.parse(this._issuer.issuer).hostname}`;

@@ -100,3 +101,4 @@ this._params = opts.params || {};

const loadUserinfo = this._verify.length > 2 && client.issuer.userinfo_endpoint;
const passReq = this._passReqToCallback;
const loadUserinfo = this._verify.length > (passReq ? 3 : 2) && client.issuer.userinfo_endpoint;

@@ -118,7 +120,8 @@ if (loadUserinfo) {

callback.then((result) => {
if (loadUserinfo) {
this._verify(result.tokenset, result.userinfo, verified.bind(this));
} else {
this._verify(result.tokenset, verified.bind(this));
}
const args = [result.tokenset, verified.bind(this)];
if (loadUserinfo) args.splice(1, 0, result.userinfo);
if (passReq) args.unshift(req);
this._verify.apply(this, args);
}).catch((error) => {

@@ -125,0 +128,0 @@ if (error instanceof OpenIdConnectError &&

4

package.json
{
"name": "openid-client",
"version": "1.13.0",
"version": "1.14.0",
"description": "OpenID Connect Relying Party (RP, Client) implementation for Node.js servers, supports passportjs",

@@ -60,3 +60,3 @@ "main": "lib/index.js",

"sinon": "^3.0.0",
"timekeeper": "^1.0.0"
"timekeeper": "^2.0.0"
},

@@ -63,0 +63,0 @@ "dependencies": {

@@ -372,3 +372,3 @@ # openid-client

const params = {
// ... any authorization params
// ... any authorization request parameters go here
// client_id defaults to client.client_id

@@ -379,4 +379,6 @@ // redirect_uri defaults to client.redirect_uris[0]

}
const passReqToCallback = false; // optional, defaults to false, when true req is passed as a first
// argument to verify fn
passport.use('oidc', new Strategy({ client, [params] }, (tokenset, userinfo, done) => {
passport.use('oidc', new Strategy({ client, [params], [passReqToCallback] }, (tokenset, userinfo, done) => {
console.log('tokenset', tokenset);

@@ -383,0 +385,0 @@ console.log('access_token', tokenset.access_token);

SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc