openid-client
Advanced tools
Comparing version 3.13.0 to 3.14.0
@@ -5,2 +5,11 @@ # Change Log | ||
# [3.14.0](https://github.com/panva/node-openid-client/compare/v3.13.0...v3.14.0) (2020-02-28) | ||
### Features | ||
* support additional authorized parties ([c9268ce](https://github.com/panva/node-openid-client/commit/c9268ce24c0080729652d7ba67a7f313227dc815)), closes [#231](https://github.com/panva/node-openid-client/issues/231) | ||
# [3.13.0](https://github.com/panva/node-openid-client/compare/v3.12.2...v3.13.0) (2020-02-18) | ||
@@ -7,0 +16,0 @@ |
@@ -200,3 +200,3 @@ /* eslint-disable max-classes-per-file */ | ||
*/ | ||
constructor(metadata = {}, jwks) { | ||
constructor(metadata = {}, jwks, options) { | ||
super(); | ||
@@ -234,2 +234,6 @@ | ||
if (options !== undefined) { | ||
instance(this).set('options', options); | ||
} | ||
this[CLOCK_TOLERANCE] = 0; | ||
@@ -908,7 +912,19 @@ } | ||
if (payload.azp !== undefined && payload.azp !== this.client_id) { | ||
throw new RPError({ | ||
printf: ['azp must be the client_id, expected %s, got: %s', this.client_id, payload.azp], | ||
jwt, | ||
}); | ||
if (payload.azp !== undefined) { | ||
let { additionalAuthorizedParties } = instance(this).get('options') || {}; | ||
if (typeof additionalAuthorizedParties === 'string') { | ||
additionalAuthorizedParties = [this.client_id, additionalAuthorizedParties]; | ||
} else if (Array.isArray(additionalAuthorizedParties)) { | ||
additionalAuthorizedParties = [this.client_id, ...additionalAuthorizedParties]; | ||
} else { | ||
additionalAuthorizedParties = [this.client_id]; | ||
} | ||
if (!additionalAuthorizedParties.includes(payload.azp)) { | ||
throw new RPError({ | ||
printf: ['azp mismatch, got: %s', payload.azp], | ||
jwt, | ||
}); | ||
} | ||
} | ||
@@ -1395,8 +1411,10 @@ | ||
*/ | ||
static async register(properties, { initialAccessToken, jwks } = {}) { | ||
static async register(metadata, options = {}) { | ||
const { initialAccessToken, jwks, ...clientOptions } = options; | ||
assertIssuerConfiguration(this.issuer, 'registration_endpoint'); | ||
if (jwks !== undefined && !(properties.jwks || properties.jwks_uri)) { | ||
if (jwks !== undefined && !(metadata.jwks || metadata.jwks_uri)) { | ||
const keystore = getKeystore.call(this, jwks); | ||
properties.jwks = keystore.toJWKS(false); | ||
metadata.jwks = keystore.toJWKS(false); | ||
} | ||
@@ -1409,3 +1427,3 @@ | ||
json: true, | ||
body: properties, | ||
body: metadata, | ||
url: this.issuer.registration_endpoint, | ||
@@ -1416,3 +1434,3 @@ method: 'POST', | ||
return new this(responseBody, jwks); | ||
return new this(responseBody, jwks, clientOptions); | ||
} | ||
@@ -1436,3 +1454,3 @@ | ||
*/ | ||
static async fromUri(registrationClientUri, registrationAccessToken, jwks) { | ||
static async fromUri(registrationClientUri, registrationAccessToken, jwks, clientOptions) { | ||
const response = await request.call(this, { | ||
@@ -1446,3 +1464,3 @@ method: 'GET', | ||
return new this(responseBody, jwks); | ||
return new this(responseBody, jwks, clientOptions); | ||
} | ||
@@ -1449,0 +1467,0 @@ |
{ | ||
"name": "openid-client", | ||
"version": "3.13.0", | ||
"version": "3.14.0", | ||
"description": "OpenID Connect Relying Party (RP, Client) implementation for Node.js runtime, supports passportjs", | ||
@@ -52,3 +52,3 @@ "keywords": [ | ||
"oidc-token-hash": "^5.0.0", | ||
"p-any": "^2.1.0" | ||
"p-any": "^3.0.0" | ||
}, | ||
@@ -55,0 +55,0 @@ "devDependencies": { |
@@ -337,2 +337,6 @@ /// <reference types="node" /> | ||
export interface ClientOptions { | ||
additionalAuthorizedParties?: string | string[]; | ||
} | ||
/** | ||
@@ -344,3 +348,3 @@ * Encapsulates a dynamically registered, discovered or instantiated OpenID Connect Client (Client), | ||
export class Client { | ||
constructor(metadata: ClientMetadata, jwks?: JSONWebKeySet); | ||
constructor(metadata: ClientMetadata, jwks?: JSONWebKeySet, options?: ClientOptions); | ||
[custom.http_options]: CustomHttpOptionsProvider; | ||
@@ -458,4 +462,4 @@ [custom.clock_tolerance]: number; | ||
deviceAuthorization(parameters?: DeviceAuthorizationParameters, extras?: DeviceAuthorizationExtras): Promise<DeviceFlowHandle<Client>>; | ||
static register(metadata: object, other?: RegisterOther): Promise<Client>; | ||
static fromUri(registrationClientUri: string, registrationAccessToken: string, jwks?: JSONWebKeySet): Promise<Client>; | ||
static register(metadata: object, other?: RegisterOther & ClientOptions): Promise<Client>; | ||
static fromUri(registrationClientUri: string, registrationAccessToken: string, jwks?: JSONWebKeySet, clientOptions?: ClientOptions): Promise<Client>; | ||
static [custom.http_options]: CustomHttpOptionsProvider; | ||
@@ -462,0 +466,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
159481
3125
+ Addedp-any@3.0.0(transitive)
+ Addedp-some@5.0.0(transitive)
- Removedp-any@2.1.0(transitive)
- Removedp-some@4.1.0(transitive)
- Removedtype-fest@0.3.1(transitive)
Updatedp-any@^3.0.0