Skip to content

Commit

Permalink
FI-3273 Refactor test kit inputs for improved readability (#7)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
alisawallace authored Oct 17, 2024
1 parent 6600949 commit 68ce244
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 43 deletions.
30 changes: 15 additions & 15 deletions lib/udap_security_test_kit/authorization_code_group.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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: %(
Expand All @@ -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'
Expand Down Expand Up @@ -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
)
Expand Down
24 changes: 12 additions & 12 deletions lib/udap_security_test_kit/client_credentials_group.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,24 +47,24 @@ 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: {
name: :udap_cert_iss_client_creds_flow,
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
Expand All @@ -74,29 +74,29 @@ 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
}
}
} 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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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: %(
Expand All @@ -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'
Expand Down Expand Up @@ -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
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand Down

0 comments on commit 68ce244

Please sign in to comment.