openid-client
Advanced tools
Comparing version 1.7.2 to 1.8.0
@@ -8,2 +8,3 @@ # openid-client CHANGELOG | ||
<!-- TOC START min:2 max:2 link:true update:true --> | ||
- [Version 1.8.0](#version-180) | ||
- [Version 1.7.0](#version-170) | ||
@@ -22,2 +23,9 @@ - [Version 1.6.0](#version-160) | ||
## Version 1.8.0 | ||
- [DIFF](https://github.com/panva/node-openid-client/compare/v1.7.2...v1.8.0) | ||
- Issuer and Client now recognize custom properties, this is so that new Registry Contents do not | ||
require a new release of openid-client to be picked up. Custom properties are exposed as getters | ||
so long as they do not interfere with the object's Prototype and they are always available in | ||
`#metadata` getter. | ||
## Version 1.7.0 | ||
@@ -24,0 +32,0 @@ ### Version 1.7.2 |
@@ -23,3 +23,2 @@ 'use strict'; | ||
const CALLBACK_PROPERTIES = require('./consts').CALLBACK_PROPERTIES; | ||
const CLIENT_METADATA = require('./consts').CLIENT_METADATA; | ||
const CLIENT_DEFAULTS = require('./consts').CLIENT_DEFAULTS; | ||
@@ -38,3 +37,3 @@ const JWT_CONTENT = require('./consts').JWT_CONTENT; | ||
function instance(ctx) { | ||
if (!map.has(ctx)) map.set(ctx, {}); | ||
if (!map.has(ctx)) map.set(ctx, { metadata: {} }); | ||
return map.get(ctx); | ||
@@ -149,8 +148,12 @@ } | ||
constructor(metadata, keystore) { | ||
const recognized = _.chain(metadata) | ||
.pick(CLIENT_METADATA) | ||
.defaults(CLIENT_DEFAULTS) | ||
.value(); | ||
const properties = Object.assign({}, CLIENT_DEFAULTS, metadata); | ||
_.forEach(recognized, (value, key) => { instance(this)[key] = value; }); | ||
_.forEach(properties, (value, key) => { | ||
instance(this).metadata[key] = value; | ||
if (!this[key]) { | ||
Object.defineProperty(this, key, { | ||
get() { return instance(this).metadata[key]; }, | ||
}); | ||
} | ||
}); | ||
@@ -817,3 +820,3 @@ if (keystore !== undefined) { | ||
get metadata() { | ||
return _.chain(this).pick(CLIENT_METADATA).omitBy(_.isUndefined).value(); | ||
return instance(this).metadata; | ||
} | ||
@@ -914,10 +917,2 @@ | ||
CLIENT_METADATA.forEach((prop) => { | ||
Object.defineProperty(Client.prototype, prop, { | ||
get() { | ||
return instance(this)[prop]; | ||
}, | ||
}); | ||
}); | ||
module.exports = Client; |
@@ -9,80 +9,10 @@ const pkg = require('../package.json'); | ||
const ISSUER_METADATA = [ | ||
'acr_values_supported', | ||
'authorization_endpoint', | ||
'check_session_iframe', | ||
'claims_parameter_supported', | ||
'claims_supported', | ||
'claim_types_supported', | ||
'code_challenge_methods_supported', | ||
'end_session_endpoint', | ||
'grant_types_supported', | ||
'id_token_encryption_alg_values_supported', | ||
'id_token_encryption_enc_values_supported', | ||
'id_token_signing_alg_values_supported', | ||
'issuer', | ||
'jwks_uri', | ||
'registration_endpoint', | ||
'request_object_encryption_alg_values_supported', | ||
'request_object_encryption_enc_values_supported', | ||
'request_object_signing_alg_values_supported', | ||
'request_parameter_supported', | ||
'request_uri_parameter_supported', | ||
'require_request_uri_registration', | ||
'response_modes_supported', | ||
'response_types_supported', | ||
'scopes_supported', | ||
'subject_types_supported', | ||
'token_endpoint', | ||
'token_endpoint_auth_methods_supported', | ||
'token_endpoint_auth_signing_alg_values_supported', | ||
'token_introspection_endpoint', | ||
'introspection_endpoint', | ||
'token_revocation_endpoint', | ||
'revocation_endpoint', | ||
'userinfo_encryption_alg_values_supported', | ||
'userinfo_encryption_enc_values_supported', | ||
'userinfo_endpoint', | ||
'userinfo_signing_alg_values_supported', | ||
]; | ||
const CLIENT_DEFAULTS = { | ||
application_type: ['web'], | ||
grant_types: ['authorization_code'], | ||
id_token_signed_response_alg: 'RS256', | ||
response_types: ['code'], | ||
token_endpoint_auth_method: 'client_secret_basic', | ||
}; | ||
const CLIENT_METADATA = [ | ||
'application_type', | ||
'client_id', | ||
'client_name', | ||
'client_secret', | ||
'client_secret_expires_at', | ||
'client_uri', | ||
'contacts', | ||
'default_acr_values', | ||
'default_max_age', | ||
'grant_types', | ||
'id_token_encrypted_response_alg', | ||
'id_token_encrypted_response_enc', | ||
'id_token_signed_response_alg', | ||
'initiate_login_uri', | ||
'jwks', | ||
'jwks_uri', | ||
'logo_uri', | ||
'policy_uri', | ||
'post_logout_redirect_uris', | ||
'redirect_uris', | ||
'registration_access_token', | ||
'registration_client_uri', | ||
'request_object_encryption_alg', | ||
'request_object_encryption_enc', | ||
'request_object_signing_alg', | ||
'request_uris', | ||
'require_auth_time', | ||
'response_types', | ||
'sector_identifier_uri', | ||
'subject_type', | ||
'token_endpoint_auth_method', | ||
'token_endpoint_auth_signing_alg', | ||
'tos_uri', | ||
'userinfo_encrypted_response_alg', | ||
'userinfo_encrypted_response_enc', | ||
'userinfo_signed_response_alg', | ||
]; | ||
const ISSUER_DEFAULTS = { | ||
@@ -98,10 +28,2 @@ claims_parameter_supported: false, | ||
const CLIENT_DEFAULTS = { | ||
application_type: ['web'], | ||
grant_types: ['authorization_code'], | ||
id_token_signed_response_alg: 'RS256', | ||
response_types: ['code'], | ||
token_endpoint_auth_method: 'client_secret_basic', | ||
}; | ||
const CALLBACK_PROPERTIES = [ | ||
@@ -130,6 +52,4 @@ 'access_token', | ||
module.exports.CLIENT_DEFAULTS = CLIENT_DEFAULTS; | ||
module.exports.CLIENT_METADATA = CLIENT_METADATA; | ||
module.exports.DEFAULT_HTTP_OPTIONS = DEFAULT_HTTP_OPTIONS; | ||
module.exports.ISSUER_DEFAULTS = ISSUER_DEFAULTS; | ||
module.exports.ISSUER_METADATA = ISSUER_METADATA; | ||
module.exports.JWT_CONTENT = JWT_CONTENT; | ||
@@ -136,0 +56,0 @@ module.exports.USER_AGENT = USER_AGENT; |
@@ -13,3 +13,2 @@ 'use strict'; | ||
const ISSUER_DEFAULTS = require('./consts').ISSUER_DEFAULTS; | ||
const ISSUER_METADATA = require('./consts').ISSUER_METADATA; | ||
const DISCOVERY = require('./consts').DISCOVERY; | ||
@@ -30,3 +29,3 @@ const WEBFINGER = require('./consts').WEBFINGER; | ||
function instance(ctx) { | ||
if (!privateProps.has(ctx)) privateProps.set(ctx, {}); | ||
if (!privateProps.has(ctx)) privateProps.set(ctx, { metadata: {} }); | ||
return privateProps.get(ctx); | ||
@@ -48,16 +47,20 @@ } | ||
constructor(metadata) { | ||
const recognized = _.chain(metadata) | ||
.pick(ISSUER_METADATA) | ||
.defaults(ISSUER_DEFAULTS) | ||
.value(); | ||
const properties = Object.assign({}, ISSUER_DEFAULTS, metadata); | ||
if (!recognized.introspection_endpoint && recognized.token_introspection_endpoint) { | ||
recognized.introspection_endpoint = recognized.token_introspection_endpoint; | ||
if (!properties.introspection_endpoint && properties.token_introspection_endpoint) { | ||
properties.introspection_endpoint = properties.token_introspection_endpoint; | ||
} | ||
if (!recognized.revocation_endpoint && recognized.token_revocation_endpoint) { | ||
recognized.revocation_endpoint = recognized.token_revocation_endpoint; | ||
if (!properties.revocation_endpoint && properties.token_revocation_endpoint) { | ||
properties.revocation_endpoint = properties.token_revocation_endpoint; | ||
} | ||
_.forEach(recognized, (value, key) => { instance(this)[key] = value; }); | ||
_.forEach(properties, (value, key) => { | ||
instance(this).metadata[key] = value; | ||
if (!this[key]) { | ||
Object.defineProperty(this, key, { | ||
get() { return instance(this).metadata[key]; }, | ||
}); | ||
} | ||
}); | ||
@@ -145,3 +148,3 @@ instance(this).cache = new LRU({ max: 100 }); | ||
get metadata() { | ||
return _.omitBy(_.pick(this, ISSUER_METADATA), _.isUndefined); | ||
return instance(this).metadata; | ||
} | ||
@@ -231,10 +234,2 @@ | ||
ISSUER_METADATA.forEach((prop) => { | ||
Object.defineProperty(Issuer.prototype, prop, { | ||
get() { | ||
return instance(this)[prop]; | ||
}, | ||
}); | ||
}); | ||
module.exports = Issuer; |
{ | ||
"name": "openid-client", | ||
"version": "1.7.2", | ||
"version": "1.8.0", | ||
"description": "OpenID Connect Relying Party (RP, Client) implementation for Node.js servers, supports passportjs", | ||
@@ -50,7 +50,7 @@ "main": "lib/index.js", | ||
"istanbul": "^0.4.4", | ||
"koa": "^1.2.0", | ||
"koa": "^2.2.0", | ||
"koa-body": "^1.4.0", | ||
"koa-ejs": "^3.0.0", | ||
"koa-router": "^5.4.0", | ||
"koa-session": "^3.3.1", | ||
"koa-ejs": "^4.0.0", | ||
"koa-router": "^7.1.1", | ||
"koa-session": "^5.0.0", | ||
"mocha": "^3.0.0", | ||
@@ -57,0 +57,0 @@ "nock": "^9.0.0", |
# openid-client | ||
[![build][travis-image]][travis-url] [![codecov][codecov-image]][codecov-url] [![npm][npm-image]][npm-url] [![licence][licence-image]][licence-url] | ||
[![build][travis-image]][travis-url] [![codecov][codecov-image]][codecov-url] | ||
@@ -61,2 +61,3 @@ openid-client is a server side [OpenID][openid-connect] Relying Party (RP, Client) implementation for | ||
[![build][conformance-image]][conformance-url] | ||
@@ -423,8 +424,6 @@ ## Example | ||
[travis-url]: https://travis-ci.org/panva/node-openid-client | ||
[conformance-image]: https://img.shields.io/travis/panva/openid-client-conformance-tests/master.svg?style=flat-square&maxAge=7200&label=conformance%20build%20status | ||
[conformance-url]: https://github.com/panva/openid-client-conformance-tests | ||
[codecov-image]: https://img.shields.io/codecov/c/github/panva/node-openid-client/master.svg?style=flat-square&maxAge=7200 | ||
[codecov-url]: https://codecov.io/gh/panva/node-openid-client | ||
[npm-image]: https://img.shields.io/npm/v/openid-client.svg?style=flat-square&maxAge=7200 | ||
[npm-url]: https://www.npmjs.com/package/openid-client | ||
[licence-image]: https://img.shields.io/github/license/panva/node-openid-client.svg?style=flat-square&maxAge=7200 | ||
[licence-url]: LICENSE.md | ||
[openid-connect]: http://openid.net/connect/ | ||
@@ -443,1 +442,2 @@ [heroku-example]: https://tranquil-reef-95185.herokuapp.com/client | ||
[passport-url]: http://passportjs.org | ||
[npm-url]: https://www.npmjs.com/package/openid-client |
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
69813
1292