Skip to content

Commit

Permalink
refactor: use Set for client's nonSecretAuthMethods
Browse files Browse the repository at this point in the history
  • Loading branch information
panva committed Aug 4, 2019
1 parent 54b0a92 commit 603e979
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/models/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const fingerprint = properties => hash(properties, {
unorderedArrays: true,
});

const nonSecretAuthMethods = ['private_key_jwt', 'none', 'tls_client_auth', 'self_signed_tls_client_auth'];
const nonSecretAuthMethods = new Set(['private_key_jwt', 'none', 'tls_client_auth', 'self_signed_tls_client_auth']);
const clientEncryptions = [
'id_token_encrypted_response_alg',
'request_object_encryption_alg',
Expand Down Expand Up @@ -529,19 +529,19 @@ module.exports = function getClient(provider) {
}

static needsSecret(metadata) {
if (!nonSecretAuthMethods.includes(metadata.token_endpoint_auth_method)) {
if (!nonSecretAuthMethods.has(metadata.token_endpoint_auth_method)) {
return true;
}

if (
!nonSecretAuthMethods.includes(metadata.introspection_endpoint_auth_method)
!nonSecretAuthMethods.has(metadata.introspection_endpoint_auth_method)
&& metadata.introspection_endpoint_auth_method
) {
return true;
}

if (
!nonSecretAuthMethods.includes(metadata.revocation_endpoint_auth_method)
!nonSecretAuthMethods.has(metadata.revocation_endpoint_auth_method)
&& metadata.revocation_endpoint_auth_method
) {
return true;
Expand Down

0 comments on commit 603e979

Please sign in to comment.