udap_security_test_kit 0.11.3 → 0.11.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/config/presets/UDAP_RunServerAgainstClient.json.erb +4 -4
- data/lib/udap_security_test_kit/client_suite/access_ac_group.rb +25 -0
- data/lib/udap_security_test_kit/client_suite/access_ac_interaction_test.rb +59 -0
- data/lib/udap_security_test_kit/client_suite/access_cc_group.rb +23 -0
- data/lib/udap_security_test_kit/client_suite/access_cc_interaction_test.rb +49 -0
- data/lib/udap_security_test_kit/client_suite/authorization_request_verification_test.rb +83 -0
- data/lib/udap_security_test_kit/client_suite/client_descriptions.rb +70 -0
- data/lib/udap_security_test_kit/client_suite/client_options.rb +20 -0
- data/lib/udap_security_test_kit/client_suite/oidc_jwks.json +32 -0
- data/lib/udap_security_test_kit/client_suite/oidc_jwks.rb +27 -0
- data/lib/udap_security_test_kit/client_suite/registration_ac_group.rb +18 -0
- data/lib/udap_security_test_kit/client_suite/registration_ac_verification_test.rb +38 -0
- data/lib/udap_security_test_kit/client_suite/registration_cc_group.rb +18 -0
- data/lib/udap_security_test_kit/client_suite/registration_cc_verification_test.rb +38 -0
- data/lib/udap_security_test_kit/client_suite/{client_registration_interaction_test.rb → registration_interaction_test.rb} +11 -4
- data/lib/udap_security_test_kit/client_suite/{client_registration_verification_test.rb → registration_request_verification.rb} +38 -40
- data/lib/udap_security_test_kit/client_suite/token_request_ac_verification_test.rb +49 -0
- data/lib/udap_security_test_kit/client_suite/token_request_cc_verification_test.rb +49 -0
- data/lib/udap_security_test_kit/client_suite/{client_token_request_verification_test.rb → token_request_verification.rb} +91 -46
- data/lib/udap_security_test_kit/client_suite/{client_token_use_verification_test.rb → token_use_verification_test.rb} +0 -3
- data/lib/udap_security_test_kit/client_suite.rb +46 -17
- data/lib/udap_security_test_kit/docs/udap_client_suite_description.md +74 -31
- data/lib/udap_security_test_kit/endpoints/echoing_fhir_responder_endpoint.rb +96 -0
- data/lib/udap_security_test_kit/endpoints/mock_udap_server/authorization_endpoint.rb +28 -0
- data/lib/udap_security_test_kit/endpoints/mock_udap_server/registration_endpoint.rb +31 -0
- data/lib/udap_security_test_kit/endpoints/mock_udap_server/token_endpoint.rb +56 -0
- data/lib/udap_security_test_kit/endpoints/mock_udap_server/udap_authorization_response_creation.rb +63 -0
- data/lib/udap_security_test_kit/endpoints/mock_udap_server/udap_registration_response_creation.rb +28 -0
- data/lib/udap_security_test_kit/endpoints/mock_udap_server/udap_token_response_creation.rb +218 -0
- data/lib/udap_security_test_kit/endpoints/mock_udap_server.rb +112 -31
- data/lib/udap_security_test_kit/metadata.rb +1 -1
- data/lib/udap_security_test_kit/tags.rb +4 -0
- data/lib/udap_security_test_kit/urls.rb +15 -8
- data/lib/udap_security_test_kit/version.rb +2 -2
- metadata +28 -12
- data/lib/udap_security_test_kit/client_suite/client_access_group.rb +0 -22
- data/lib/udap_security_test_kit/client_suite/client_access_interaction_test.rb +0 -53
- data/lib/udap_security_test_kit/client_suite/client_registration_group.rb +0 -26
- data/lib/udap_security_test_kit/endpoints/echoing_fhir_responder.rb +0 -52
- data/lib/udap_security_test_kit/endpoints/mock_udap_server/registration.rb +0 -57
- data/lib/udap_security_test_kit/endpoints/mock_udap_server/token.rb +0 -27
@@ -1,26 +0,0 @@
|
|
1
|
-
require_relative 'client_registration_interaction_test'
|
2
|
-
require_relative 'client_registration_verification_test'
|
3
|
-
|
4
|
-
module UDAPSecurityTestKit
|
5
|
-
class UDAPClientRegistration < Inferno::TestGroup
|
6
|
-
id :udap_client_registration
|
7
|
-
title 'Client Registration'
|
8
|
-
description %(
|
9
|
-
During these tests, the client system will dynamically register with Inferno's
|
10
|
-
simulated UDAP Server with the capabilities to perform the **UDAP B2B client credentials flow**.
|
11
|
-
At any time, the client may perform UDAP discovery on the simulated Inferno UDAP server.
|
12
|
-
)
|
13
|
-
run_as_group
|
14
|
-
|
15
|
-
input :udap_client_uri,
|
16
|
-
title: 'UDAP Client URI',
|
17
|
-
type: 'text',
|
18
|
-
description: %(
|
19
|
-
The UDAP Client URI that will be used to register with Inferno's simulated UDAP server.
|
20
|
-
),
|
21
|
-
optional: false
|
22
|
-
|
23
|
-
test from: :udap_client_registration_interaction
|
24
|
-
test from: :udap_client_registration_verification
|
25
|
-
end
|
26
|
-
end
|
@@ -1,52 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require_relative '../urls'
|
4
|
-
require_relative '../tags'
|
5
|
-
require_relative 'mock_udap_server'
|
6
|
-
|
7
|
-
module UDAPSecurityTestKit
|
8
|
-
class EchoingFHIRResponderEndpoint < Inferno::DSL::SuiteEndpoint
|
9
|
-
def test_run_identifier
|
10
|
-
MockUDAPServer.token_to_client_id(request.headers['authorization']&.delete_prefix('Bearer '))
|
11
|
-
end
|
12
|
-
|
13
|
-
def make_response
|
14
|
-
return if response.status == 401 # set in update_result (expired token handling there)
|
15
|
-
|
16
|
-
response.content_type = 'application/fhir+json'
|
17
|
-
|
18
|
-
# If the tester provided a response, echo it
|
19
|
-
# otherwise, operation outcome
|
20
|
-
echo_response = JSON.parse(result.input_json)
|
21
|
-
.find { |input| input['name'].include?('echoed_fhir_response') }
|
22
|
-
&.dig('value')
|
23
|
-
|
24
|
-
unless echo_response.present?
|
25
|
-
response.status = 400
|
26
|
-
response.body = FHIR::OperationOutcome.new(
|
27
|
-
issue: FHIR::OperationOutcome::Issue.new(
|
28
|
-
severity: 'fatal', code: 'required',
|
29
|
-
details: FHIR::CodeableConcept.new(text: 'No response provided to echo.')
|
30
|
-
)
|
31
|
-
).to_json
|
32
|
-
return
|
33
|
-
end
|
34
|
-
|
35
|
-
response.status = 200
|
36
|
-
response.body = echo_response
|
37
|
-
end
|
38
|
-
|
39
|
-
def update_result
|
40
|
-
if MockUDAPServer.request_has_expired_token?(request)
|
41
|
-
MockUDAPServer.update_response_for_expired_token(response)
|
42
|
-
return
|
43
|
-
end
|
44
|
-
|
45
|
-
nil # never update for now
|
46
|
-
end
|
47
|
-
|
48
|
-
def tags
|
49
|
-
[ACCESS_TAG]
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|
@@ -1,57 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require_relative '../../urls'
|
4
|
-
require_relative '../../tags'
|
5
|
-
require_relative '../mock_udap_server'
|
6
|
-
|
7
|
-
module UDAPSecurityTestKit
|
8
|
-
module MockUDAPServer
|
9
|
-
class RegistrationEndpoint < Inferno::DSL::SuiteEndpoint
|
10
|
-
def test_run_identifier
|
11
|
-
MockUDAPServer.client_uri_to_client_id(
|
12
|
-
client_uri_from_registration_payload(MockUDAPServer.parsed_io_body(request))
|
13
|
-
)
|
14
|
-
end
|
15
|
-
|
16
|
-
def make_response
|
17
|
-
parsed_body = MockUDAPServer.parsed_io_body(request)
|
18
|
-
client_id = MockUDAPServer.client_uri_to_client_id(client_uri_from_registration_payload(parsed_body))
|
19
|
-
ss_jwt = request_software_statement_jwt(parsed_body)
|
20
|
-
|
21
|
-
response_body = {
|
22
|
-
client_id:,
|
23
|
-
software_statement: ss_jwt
|
24
|
-
}
|
25
|
-
response_body.merge!(MockUDAPServer.jwt_claims(ss_jwt).except(['iss', 'sub', 'exp', 'iat', 'jti']))
|
26
|
-
|
27
|
-
response.body = response_body.to_json
|
28
|
-
response.headers['Cache-Control'] = 'no-store'
|
29
|
-
response.headers['Pragma'] = 'no-cache'
|
30
|
-
response.headers['Access-Control-Allow-Origin'] = '*'
|
31
|
-
response.content_type = 'application/json'
|
32
|
-
response.status = 201
|
33
|
-
end
|
34
|
-
|
35
|
-
def update_result
|
36
|
-
nil # never update for now
|
37
|
-
end
|
38
|
-
|
39
|
-
def tags
|
40
|
-
[REGISTRATION_TAG, UDAP_TAG]
|
41
|
-
end
|
42
|
-
|
43
|
-
private
|
44
|
-
|
45
|
-
def client_uri_from_registration_payload(reg_body)
|
46
|
-
software_statement_jwt = request_software_statement_jwt(reg_body)
|
47
|
-
return unless software_statement_jwt.present?
|
48
|
-
|
49
|
-
MockUDAPServer.jwt_claims(software_statement_jwt)&.dig('iss')
|
50
|
-
end
|
51
|
-
|
52
|
-
def request_software_statement_jwt(reg_body)
|
53
|
-
reg_body&.dig('software_statement')
|
54
|
-
end
|
55
|
-
end
|
56
|
-
end
|
57
|
-
end
|
@@ -1,27 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require_relative '../../urls'
|
4
|
-
require_relative '../../tags'
|
5
|
-
require_relative '../mock_udap_server'
|
6
|
-
|
7
|
-
module UDAPSecurityTestKit
|
8
|
-
module MockUDAPServer
|
9
|
-
class TokenEndpoint < Inferno::DSL::SuiteEndpoint
|
10
|
-
def test_run_identifier
|
11
|
-
MockUDAPServer.client_id_from_client_assertion(request.params[:client_assertion])
|
12
|
-
end
|
13
|
-
|
14
|
-
def make_response
|
15
|
-
MockUDAPServer.make_udap_token_response(request, response, test_run.test_session_id)
|
16
|
-
end
|
17
|
-
|
18
|
-
def update_result
|
19
|
-
nil # never update for now
|
20
|
-
end
|
21
|
-
|
22
|
-
def tags
|
23
|
-
[TOKEN_TAG, UDAP_TAG]
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|