@@ -24,6 +24,7 @@ const instance = require('./weak_cache');
24
24
const formatters = require ( './formatters' ) ;
25
25
const pick = require ( './_/pick' ) ;
26
26
const without = require ( './_/without' ) ;
27
+ const omitBy = require ( './_/omit_by' ) ;
27
28
28
29
const clientAuthEndpoints = [ 'token' , 'introspection' , 'revocation' ] ;
29
30
// TODO: in v7.x remove the `introspection` and `revocation` metadata, only token endpoint will be
@@ -32,6 +33,10 @@ const W3CEmailRegExp = /^[a-zA-Z0-9.!#$%&’*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a
32
33
const encAlgRequiringJwks = / ^ ( R S A | E C D H ) / ;
33
34
const requestSignAlgRequiringJwks = / ^ (?: P S (?: 2 5 6 | 3 8 4 | 5 1 2 ) | R S (?: 2 5 6 | 3 8 4 | 5 1 2 ) | E S (?: 2 5 6 K ? | 3 8 4 | 5 1 2 ) | E d D S A ) $ / ;
34
35
36
+ function isUndefined ( value ) {
37
+ return value === undefined ;
38
+ }
39
+
35
40
function checkClientAuth ( schema ) {
36
41
return ! ! clientAuthEndpoints . find ( ( endpoint ) => [ 'private_key_jwt' , 'self_signed_tls_client_auth' ] . includes ( schema [ `${ endpoint } _endpoint_auth_method` ] ) ) ;
37
42
}
@@ -240,8 +245,14 @@ module.exports = function getSchema(provider) {
240
245
241
246
Object . assign (
242
247
this ,
243
- pick ( DEFAULT , ...RECOGNIZED_METADATA ) ,
244
- pick ( metadata , ...RECOGNIZED_METADATA , ...configuration . extraClientMetadata . properties ) ,
248
+ omitBy (
249
+ pick ( DEFAULT , ...RECOGNIZED_METADATA ) ,
250
+ isUndefined ,
251
+ ) ,
252
+ omitBy (
253
+ pick ( metadata , ...RECOGNIZED_METADATA , ...configuration . extraClientMetadata . properties ) ,
254
+ isUndefined ,
255
+ ) ,
245
256
) ;
246
257
247
258
this . required ( ) ;
0 commit comments