From 68ce24436ee6097a454388b52b87efafd3bc38fa Mon Sep 17 00:00:00 2001 From: Alisa Wallace <140003092+alisawallace@users.noreply.github.com> Date: Thu, 17 Oct 2024 12:14:28 -0700 Subject: [PATCH] FI-3273 Refactor test kit inputs for improved readability (#7) * Refactor flow-specific registration scope input names * Refactor flow-specific grant type input name * Refactor flow-specific client cert input name * Refactor flow-specific client private key input name * Refactor flow-specific client issuer ID input name * Refactor flow-specific registration certifications input name * Refactor grant type input to include udap prefix --- .../authorization_code_group.rb | 30 +++++++++---------- .../authorization_code_token_exchange_test.rb | 8 ++--- .../client_credentials_group.rb | 24 +++++++-------- .../client_credentials_token_exchange_test.rb | 8 ++--- ...orization_code_token_exchange_test_spec.rb | 8 ++--- ...nt_credentials_token_exchange_test_spec.rb | 8 ++--- 6 files changed, 43 insertions(+), 43 deletions(-) diff --git a/lib/udap_security_test_kit/authorization_code_group.rb b/lib/udap_security_test_kit/authorization_code_group.rb index d89ce7e..979dcc9 100644 --- a/lib/udap_security_test_kit/authorization_code_group.rb +++ b/lib/udap_security_test_kit/authorization_code_group.rb @@ -45,24 +45,24 @@ class AuthorizationCodeGroup < Inferno::TestGroup config: { inputs: { udap_registration_grant_type: { - name: :reg_grant_type_auth_code, + name: :udap_auth_code_flow_registration_grant_type, default: 'authorization_code', locked: true }, udap_client_cert_pem: { - name: :udap_client_cert_pem_auth_code_flow, + name: :udap_auth_code_flow_client_cert_pem, title: 'Authorization Code Client Certificate(s) (PEM Format)' }, udap_client_private_key_pem: { - name: :udap_client_private_key_auth_code_flow, + name: :udap_auth_code_flow_client_private_key, title: 'Authorization Code Client Private Key (PEM Format)' }, udap_cert_iss: { - name: :udap_cert_iss_auth_code_flow, + name: :udap_auth_code_flow_cert_iss, title: 'Authorization Code JWT Issuer (iss) Claim' }, udap_registration_requested_scope: { - name: :udap_registration_scope_auth_code_flow, + name: :udap_auth_code_flow_registration_scope, title: 'Authorization Code Registration Requested Scope(s)', description: %( String containing a space delimited list of scopes requested by the client application for use in @@ -72,29 +72,29 @@ class AuthorizationCodeGroup < Inferno::TestGroup ) }, udap_registration_certifications: { - name: :udap_registration_certifications_auth_code_flow, + name: :udap_auth_code_flow_registration_certifications, title: 'Authorization Code UDAP Registration Certifications' } }, outputs: { udap_client_cert_pem: { - name: :udap_client_cert_pem_auth_code_flow + name: :udap_auth_code_flow_client_cert_pem }, udap_client_private_key_pem: { - name: :udap_client_private_key_auth_code_flow + name: :udap_auth_code_flow_client_private_key }, udap_cert_iss: { - name: :udap_cert_iss_auth_code_flow + name: :udap_auth_code_flow_cert_iss } } } do input_order :udap_registration_endpoint, - :reg_grant_type_auth_code, - :udap_client_cert_pem_auth_code_flow, - :udap_client_private_key_auth_code_flow, - :udap_cert_iss_auth_code_flow, - :udap_registration_scope_auth_code_flow, - :udap_jwt_signing_alg, :udap_registration_certifications_auth_code_flow + :udap_auth_code_flow_registration_grant_type, + :udap_auth_code_flow_client_cert_pem, + :udap_auth_code_flow_client_private_key, + :udap_auth_code_flow_cert_iss, + :udap_auth_code_flow_registration_scope, + :udap_jwt_signing_alg, :udap_auth_code_flow_registration_certifications end group from: :udap_authorization_code_authentication_group, diff --git a/lib/udap_security_test_kit/authorization_code_token_exchange_test.rb b/lib/udap_security_test_kit/authorization_code_token_exchange_test.rb index 2f9a4d2..f920f8f 100644 --- a/lib/udap_security_test_kit/authorization_code_token_exchange_test.rb +++ b/lib/udap_security_test_kit/authorization_code_token_exchange_test.rb @@ -23,7 +23,7 @@ class AuthorizationCodeTokenExchangeTest < Inferno::Test title: 'Token Endpoint', description: 'The full URL from which Inferno will request an access token' - input :udap_client_cert_pem_auth_code_flow, + input :udap_auth_code_flow_client_cert_pem, title: 'X.509 Client Certificate (PEM Format)', type: 'textarea', description: %( @@ -34,7 +34,7 @@ class AuthorizationCodeTokenExchangeTest < Inferno::Test authorization server under test. ) - input :udap_client_private_key_auth_code_flow, + input :udap_auth_code_flow_client_private_key, type: 'textarea', title: 'Client Private Key (PEM Format)', description: 'The private key corresponding to the X.509 client certificate' @@ -70,11 +70,11 @@ class AuthorizationCodeTokenExchangeTest < Inferno::Test nil ) - x5c_certs = UDAPJWTBuilder.split_user_input_cert_string(udap_client_cert_pem_auth_code_flow) + x5c_certs = UDAPJWTBuilder.split_user_input_cert_string(udap_auth_code_flow_client_cert_pem) client_assertion_jwt = UDAPJWTBuilder.encode_jwt_with_x5c_header( client_assertion_payload, - udap_client_private_key_auth_code_flow, + udap_auth_code_flow_client_private_key, udap_jwt_signing_alg, x5c_certs ) diff --git a/lib/udap_security_test_kit/client_credentials_group.rb b/lib/udap_security_test_kit/client_credentials_group.rb index 99303e4..723e60b 100644 --- a/lib/udap_security_test_kit/client_credentials_group.rb +++ b/lib/udap_security_test_kit/client_credentials_group.rb @@ -47,16 +47,16 @@ class ClientCredentialsGroup < Inferno::TestGroup config: { inputs: { udap_registration_grant_type: { - name: :reg_grant_type_client_creds, + name: :udap_client_credentials_flow_registration_grant_type, default: 'client_credentials', locked: true }, udap_client_cert_pem: { - name: :udap_client_cert_pem_client_creds_flow, + name: :udap_client_credentials_flow_client_cert_pem, title: 'Client Credentials Client Certificate(s) (PEM Format)' }, udap_client_private_key_pem: { - name: :udap_client_private_key_client_creds_flow, + name: :udap_client_credentials_flow_client_private_key, title: 'Client Credentials Client Private Key (PEM Format)' }, udap_cert_iss: { @@ -64,7 +64,7 @@ class ClientCredentialsGroup < Inferno::TestGroup title: 'Client Credentials JWT Issuer (iss) Claim' }, udap_registration_requested_scope: { - name: :udap_registration_scope_client_creds_flow, + name: :udap_client_credentials_flow_registration_scope, title: 'Client Credentials Registration Requested Scope(s)', description: %( String containing a space delimited list of scopes requested by the client application for use in @@ -74,16 +74,16 @@ class ClientCredentialsGroup < Inferno::TestGroup ) }, udap_registration_certifications: { - name: :udap_registration_certifications_client_creds_flow, + name: :udap_client_creds_flow_registration_certifications, title: 'Client Credentials UDAP Registration Certifications' } }, outputs: { udap_client_cert_pem: { - name: :udap_client_cert_pem_client_creds_flow + name: :udap_client_credentials_flow_client_cert_pem }, udap_client_private_key_pem: { - name: :udap_client_private_key_client_creds_flow + name: :udap_client_credentials_flow_client_private_key }, udap_cert_iss: { name: :udap_cert_iss_client_creds_flow @@ -91,12 +91,12 @@ class ClientCredentialsGroup < Inferno::TestGroup } } do input_order :udap_registration_endpoint, - :reg_grant_type_client_creds, - :udap_client_cert_pem_client_creds_flow, - :udap_client_private_key_client_creds_flow, + :udap_client_credentials_flow_registration_grant_type, + :udap_client_credentials_flow_client_cert_pem, + :udap_client_credentials_flow_client_private_key, :udap_cert_iss_client_creds_flow, - :udap_registration_scope_client_creds_flow, - :udap_jwt_signing_alg, :udap_registration_certifications_client_creds_flow + :udap_client_credentials_flow_registration_scope, + :udap_jwt_signing_alg, :udap_client_creds_flow_registration_certifications end group from: :udap_client_credentials_authentication_group, diff --git a/lib/udap_security_test_kit/client_credentials_token_exchange_test.rb b/lib/udap_security_test_kit/client_credentials_token_exchange_test.rb index 1473cde..7014e71 100644 --- a/lib/udap_security_test_kit/client_credentials_token_exchange_test.rb +++ b/lib/udap_security_test_kit/client_credentials_token_exchange_test.rb @@ -38,7 +38,7 @@ class ClientCredentialsTokenExchangeTest < Inferno::Test title: 'Token Endpoint', description: 'The full URL from which Inferno will request an access token' - input :udap_client_cert_pem_client_creds_flow, + input :udap_client_credentials_flow_client_cert_pem, title: 'X.509 Client Certificate(s) (PEM Format)', type: 'textarea', description: %( @@ -48,7 +48,7 @@ class ClientCredentialsTokenExchangeTest < Inferno::Test authorization server under test. ) - input :udap_client_private_key_client_creds_flow, + input :udap_client_credentials_flow_client_private_key, type: 'textarea', title: 'Client Private Key (PEM Format)', description: 'The private key corresponding to the X.509 client certificate' @@ -97,12 +97,12 @@ class ClientCredentialsTokenExchangeTest < Inferno::Test ) x5c_certs = UDAPJWTBuilder.split_user_input_cert_string( - udap_client_cert_pem_client_creds_flow + udap_client_credentials_flow_client_cert_pem ) client_assertion_jwt = UDAPJWTBuilder.encode_jwt_with_x5c_header( client_assertion_payload, - udap_client_private_key_client_creds_flow, + udap_client_credentials_flow_client_private_key, udap_jwt_signing_alg, x5c_certs ) diff --git a/spec/udap_security_test_kit/authorization_code_token_exchange_test_spec.rb b/spec/udap_security_test_kit/authorization_code_token_exchange_test_spec.rb index 1c9ac1d..70f2ccc 100644 --- a/spec/udap_security_test_kit/authorization_code_token_exchange_test_spec.rb +++ b/spec/udap_security_test_kit/authorization_code_token_exchange_test_spec.rb @@ -7,11 +7,11 @@ let(:session_data_repo) { Inferno::Repositories::SessionData.new } let(:results_repo) { Inferno::Repositories::Results.new } let(:test_session) { repo_create(:test_session, test_suite_id: 'udap_security') } - let(:udap_client_cert_pem_auth_code_flow) do + let(:udap_auth_code_flow_client_cert_pem) do UDAPSecurityTestKit::DefaultCertFileLoader.load_test_client_cert_pem_file end - let(:udap_client_private_key_auth_code_flow) do + let(:udap_auth_code_flow_client_private_key) do UDAPSecurityTestKit::DefaultCertFileLoader.load_test_client_private_key_file end @@ -23,8 +23,8 @@ udap_authorization_code: 'CODE', udap_token_endpoint:, udap_client_id: 'CLIENT_ID', - udap_client_cert_pem_auth_code_flow:, - udap_client_private_key_auth_code_flow:, + udap_auth_code_flow_client_cert_pem:, + udap_auth_code_flow_client_private_key:, udap_jwt_signing_alg: 'RS256' } end diff --git a/spec/udap_security_test_kit/client_credentials_token_exchange_test_spec.rb b/spec/udap_security_test_kit/client_credentials_token_exchange_test_spec.rb index 1d8d067..90672dd 100644 --- a/spec/udap_security_test_kit/client_credentials_token_exchange_test_spec.rb +++ b/spec/udap_security_test_kit/client_credentials_token_exchange_test_spec.rb @@ -6,11 +6,11 @@ let(:session_data_repo) { Inferno::Repositories::SessionData.new } let(:results_repo) { Inferno::Repositories::Results.new } let(:test_session) { repo_create(:test_session, test_suite_id: 'udap_security') } - let(:udap_client_cert_pem_client_creds_flow) do + let(:udap_client_credentials_flow_client_cert_pem) do UDAPSecurityTestKit::DefaultCertFileLoader.load_test_client_cert_pem_file end - let(:udap_client_private_key_client_creds_flow) do + let(:udap_client_credentials_flow_client_private_key) do UDAPSecurityTestKit::DefaultCertFileLoader.load_test_client_private_key_file end @@ -21,8 +21,8 @@ { udap_token_endpoint:, udap_client_id: 'CLIENT_ID', - udap_client_cert_pem_client_creds_flow:, - udap_client_private_key_client_creds_flow:, + udap_client_credentials_flow_client_cert_pem:, + udap_client_credentials_flow_client_private_key:, udap_jwt_signing_alg: 'RS256' } end