davinci_pdex_test_kit 0.12.0 → 0.12.1
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/pdex_payer_client_postman_preset.json.erb +67 -0
- data/lib/davinci_pdex_test_kit/docs/payer_client_suite_description_v200.md +124 -32
- data/lib/davinci_pdex_test_kit/pdex_payer_client/client_auth_smart_alca_group.rb +32 -0
- data/lib/davinci_pdex_test_kit/pdex_payer_client/client_auth_smart_alcs_group.rb +32 -0
- data/lib/davinci_pdex_test_kit/pdex_payer_client/client_auth_smart_alp_group.rb +32 -0
- data/lib/davinci_pdex_test_kit/pdex_payer_client/client_auth_udap_group.rb +31 -0
- data/lib/davinci_pdex_test_kit/pdex_payer_client/client_member_match_tests/client_member_match_validation_test.rb +0 -1
- data/lib/davinci_pdex_test_kit/pdex_payer_client/client_registration/configuration_display_smart_test.rb +38 -0
- data/lib/davinci_pdex_test_kit/pdex_payer_client/client_registration/configuration_display_udap_test.rb +38 -0
- data/lib/davinci_pdex_test_kit/pdex_payer_client/client_registration_group.rb +67 -0
- data/lib/davinci_pdex_test_kit/pdex_payer_client/client_validation_test.rb +10 -2
- data/lib/davinci_pdex_test_kit/pdex_payer_client/client_workflow_interaction_test.rb +37 -7
- data/lib/davinci_pdex_test_kit/pdex_payer_client/clinical_data_request_tests/allergyintolerance_clinical_data_request_test.rb +0 -1
- data/lib/davinci_pdex_test_kit/pdex_payer_client/clinical_data_request_tests/careplan_clinical_data_request_test.rb +0 -1
- data/lib/davinci_pdex_test_kit/pdex_payer_client/clinical_data_request_tests/careteam_clinical_data_request_test.rb +0 -1
- data/lib/davinci_pdex_test_kit/pdex_payer_client/clinical_data_request_tests/condition_clinical_data_request_test.rb +0 -1
- data/lib/davinci_pdex_test_kit/pdex_payer_client/clinical_data_request_tests/device_clinical_data_request_test.rb +1 -2
- data/lib/davinci_pdex_test_kit/pdex_payer_client/clinical_data_request_tests/diagnosticreport_clinical_data_request_test.rb +0 -1
- data/lib/davinci_pdex_test_kit/pdex_payer_client/clinical_data_request_tests/documentreference_clinical_data_request_test.rb +0 -1
- data/lib/davinci_pdex_test_kit/pdex_payer_client/clinical_data_request_tests/encounter_clinical_data_request_test.rb +0 -1
- data/lib/davinci_pdex_test_kit/pdex_payer_client/clinical_data_request_tests/explanationofbenefit_clinical_data_request_test.rb +0 -1
- data/lib/davinci_pdex_test_kit/pdex_payer_client/clinical_data_request_tests/goal_clinical_data_request_test.rb +0 -1
- data/lib/davinci_pdex_test_kit/pdex_payer_client/clinical_data_request_tests/immunization_clinical_data_request_test.rb +0 -1
- data/lib/davinci_pdex_test_kit/pdex_payer_client/clinical_data_request_tests/location_clinical_data_request_test.rb +0 -1
- data/lib/davinci_pdex_test_kit/pdex_payer_client/clinical_data_request_tests/medicationdispense_clinical_data_request_test.rb +0 -1
- data/lib/davinci_pdex_test_kit/pdex_payer_client/clinical_data_request_tests/medicationrequest_clinical_data_request_test.rb +0 -1
- data/lib/davinci_pdex_test_kit/pdex_payer_client/clinical_data_request_tests/observation_clinical_data_request_test.rb +0 -1
- data/lib/davinci_pdex_test_kit/pdex_payer_client/clinical_data_request_tests/organization_clinical_data_request_test.rb +0 -1
- data/lib/davinci_pdex_test_kit/pdex_payer_client/clinical_data_request_tests/patient_clinical_data_request_test.rb +0 -1
- data/lib/davinci_pdex_test_kit/pdex_payer_client/clinical_data_request_tests/practitioner_clinical_data_request_test.rb +0 -1
- data/lib/davinci_pdex_test_kit/pdex_payer_client/clinical_data_request_tests/practitionerrole_clinical_data_request_test.rb +0 -1
- data/lib/davinci_pdex_test_kit/pdex_payer_client/clinical_data_request_tests/procedure_clinical_data_request_test.rb +0 -1
- data/lib/davinci_pdex_test_kit/pdex_payer_client/mock_server/export_endpoint.rb +1 -1
- data/lib/davinci_pdex_test_kit/pdex_payer_client/mock_server/export_status_endpoint.rb +1 -1
- data/lib/davinci_pdex_test_kit/pdex_payer_client/mock_server/next_page_endpoint.rb +9 -2
- data/lib/davinci_pdex_test_kit/pdex_payer_client/mock_server/patient_endpoint.rb +1 -1
- data/lib/davinci_pdex_test_kit/pdex_payer_client/mock_server/proxy_endpoint.rb +15 -6
- data/lib/davinci_pdex_test_kit/pdex_payer_client/mock_server/resource_read_endpoint.rb +1 -1
- data/lib/davinci_pdex_test_kit/pdex_payer_client/mock_server/resource_search_endpoint.rb +1 -1
- data/lib/davinci_pdex_test_kit/pdex_payer_client/mock_server.rb +28 -2
- data/lib/davinci_pdex_test_kit/pdex_payer_client/mock_udap_smart_server/authorization_endpoint.rb +53 -0
- data/lib/davinci_pdex_test_kit/pdex_payer_client/mock_udap_smart_server/token_endpoint.rb +85 -0
- data/lib/davinci_pdex_test_kit/pdex_payer_client/pdex_client_options.rb +26 -0
- data/lib/davinci_pdex_test_kit/pdex_payer_client/tags.rb +8 -9
- data/lib/davinci_pdex_test_kit/pdex_payer_client/urls.rb +17 -9
- data/lib/davinci_pdex_test_kit/pdex_payer_client_suite.rb +51 -2
- data/lib/davinci_pdex_test_kit/pdex_payer_server/workflow_export_group.rb +2 -0
- data/lib/davinci_pdex_test_kit/pdex_payer_server_suite.rb +3 -3
- data/lib/davinci_pdex_test_kit/requirements/davinci-pdex-test-kit_requirements.csv +6 -4
- data/lib/davinci_pdex_test_kit/requirements/generated/davinci-pdex-test-kit_requirements_coverage.csv +8 -6
- data/lib/davinci_pdex_test_kit/version.rb +2 -2
- data/lib/inferno_requirements_tools/tasks/collect_requirements.rb +228 -0
- metadata +42 -4
- data/config/presets/pdex_payer_client_postman_preset.json +0 -12
- data/lib/davinci_pdex_test_kit/pdex_payer_client/mock_server/token_endpoint.rb +0 -27
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'smart_app_launch_test_kit'
|
2
|
+
|
1
3
|
module DaVinciPDexTestKit
|
2
4
|
module PDexPayerClient
|
3
5
|
class PDexClientWorkflowInteractionTest < Inferno::Test
|
@@ -10,21 +12,48 @@ module DaVinciPDexTestKit
|
|
10
12
|
- clinical data requests, including resource read and searches, patient-level $everything,
|
11
13
|
and group-level $export.
|
12
14
|
)
|
13
|
-
input :
|
15
|
+
input :client_id,
|
16
|
+
title: 'Client Id',
|
17
|
+
type: 'text',
|
18
|
+
optional: true,
|
19
|
+
locked: true,
|
20
|
+
description: SMARTAppLaunch::INPUT_CLIENT_ID_DESCRIPTION_LOCKED
|
21
|
+
input :smart_launch_urls,
|
22
|
+
title: 'SMART App Launch URL(s)',
|
23
|
+
type: 'textarea',
|
24
|
+
locked: true,
|
25
|
+
optional: true,
|
26
|
+
description: SMARTAppLaunch::INPUT_SMART_LAUNCH_URLS_DESCRIPTION_LOCKED
|
27
|
+
input :launch_context,
|
28
|
+
title: 'Launch Context',
|
29
|
+
type: 'textarea',
|
30
|
+
optional: true,
|
31
|
+
description: SMARTAppLaunch::INPUT_LAUNCH_CONTEXT_DESCRIPTION
|
32
|
+
input :fhir_user_relative_reference,
|
33
|
+
title: 'FHIR User Relative Reference',
|
34
|
+
type: 'text',
|
35
|
+
optional: true,
|
36
|
+
description: SMARTAppLaunch::INPUT_FHIR_USER_RELATIVE_REFERENCE
|
37
|
+
input_order :launch_context, :fhir_user_relative_reference, :smart_launch_urls, :client_id
|
38
|
+
output :launch_key
|
14
39
|
config options: { accepts_multiple_requests: true }
|
15
40
|
|
16
41
|
verifies_requirements 'hl7.fhir.us.davinci-pdex_2.0.0@27', 'hl7.fhir.us.davinci-pdex_2.0.0@41'
|
17
42
|
|
18
43
|
run do
|
19
44
|
wait(
|
20
|
-
identifier:
|
45
|
+
identifier: client_id,
|
21
46
|
message: %(
|
22
47
|
Submit PDex requests to find a matching member and retrieve clinical data covering the
|
23
48
|
complete scope of [member health history data defined by
|
24
|
-
PDex](https://hl7.org/fhir/us/davinci-pdex/STU2/introduction.html#member-health-history)
|
25
|
-
|
49
|
+
PDex](https://hl7.org/fhir/us/davinci-pdex/STU2/introduction.html#member-health-history)
|
50
|
+
to the simulated FHIR server at
|
51
|
+
|
52
|
+
`#{fhir_base_url}`
|
53
|
+
|
54
|
+
Available APIs include:
|
26
55
|
* Single patient $member-match: `#{member_match_url}`
|
27
|
-
* Single Resource read and search API: `#{
|
56
|
+
* Single Resource read and search API: `#{resource_url}`, with `:endpoint` replaced with
|
28
57
|
the target resource type.
|
29
58
|
* Patient-level $everything: `#{everything_url}`, with `:patient` replaced with the
|
30
59
|
id for the target patient.
|
@@ -37,9 +66,10 @@ module DaVinciPDexTestKit
|
|
37
66
|
in the JSON manifest returned with the export status request when the job is completed.
|
38
67
|
Note that the `Accept` header should be `application/fhir+ndjson` on these requests.
|
39
68
|
|
40
|
-
All requests must include the `Authorization` header with value `Bearer
|
69
|
+
All requests must include the `Authorization` header with value `Bearer <access_token>`
|
70
|
+
where `<access_token>` is a token obtained using the registered client id `#{client_id}`.
|
41
71
|
|
42
|
-
[Click here](#{resume_clinical_data_url}?token=#{
|
72
|
+
[Click here](#{resume_clinical_data_url}?token=#{client_id}) when finished making requests
|
43
73
|
for Inferno to evaluate.
|
44
74
|
),
|
45
75
|
timeout: 900
|
@@ -15,7 +15,7 @@ module DaVinciPDexTestKit
|
|
15
15
|
req.url 'Group/pdex-Group/$export' # TODO: change from static response
|
16
16
|
req.headers = http_headers_as_hash.merge(server_proxy.headers)
|
17
17
|
end
|
18
|
-
response.headers["content-location"] = server_response.headers["content-location"]&.gsub(/(.*)\?/, "#{
|
18
|
+
response.headers["content-location"] = server_response.headers["content-location"]&.gsub(/(.*)\?/, "#{fhir_base_url}/$export-poll-status?")
|
19
19
|
response.body = server_response.body
|
20
20
|
end
|
21
21
|
|
@@ -27,7 +27,7 @@ module DaVinciPDexTestKit
|
|
27
27
|
end
|
28
28
|
|
29
29
|
def replace_export_urls(export_status_output)
|
30
|
-
export_status_output['output'].map! { |binary| {type: binary["type"], url: binary["url"].gsub(fhir_reference_server,
|
30
|
+
export_status_output['output'].map! { |binary| {type: binary["type"], url: binary["url"].gsub(fhir_reference_server, fhir_base_url)} }
|
31
31
|
export_status_output['request'] = export_url
|
32
32
|
export_status_output
|
33
33
|
end
|
@@ -9,12 +9,19 @@ module DaVinciPDexTestKit
|
|
9
9
|
def make_response
|
10
10
|
server_response = server_proxy.get('', JSON.parse(request.params.to_json))
|
11
11
|
response.status = server_response.status
|
12
|
+
fhir_response = FHIR.from_contents(server_response.body)
|
13
|
+
return unless fhir_response.present?
|
14
|
+
|
12
15
|
response.format = 'application/fhir+json'
|
13
|
-
|
16
|
+
if fhir_response.is_a?(FHIR::Bundle)
|
17
|
+
response.body = replace_bundle_urls(fhir_response).to_json
|
18
|
+
else
|
19
|
+
response.body = fhir_response.to_json
|
20
|
+
end
|
14
21
|
end
|
15
22
|
|
16
23
|
def tags
|
17
|
-
[
|
24
|
+
[RESOURCE_API_TAG]
|
18
25
|
end
|
19
26
|
|
20
27
|
end
|
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'faraday'
|
2
2
|
require 'faraday_middleware'
|
3
|
+
require 'smart_app_launch_test_kit'
|
3
4
|
|
4
5
|
require_relative '../urls'
|
5
6
|
|
@@ -15,7 +16,11 @@ module DaVinciPDexTestKit
|
|
15
16
|
include ::DaVinciPDexTestKit::PDexPayerClient::URLs
|
16
17
|
|
17
18
|
def test_run_identifier
|
18
|
-
request.
|
19
|
+
return request.params[:session_path] if request.params[:session_path].present?
|
20
|
+
|
21
|
+
SMARTAppLaunch::MockSMARTServer.issued_token_to_client_id(
|
22
|
+
request.headers['authorization']&.delete_prefix('Bearer ')
|
23
|
+
)
|
19
24
|
end
|
20
25
|
|
21
26
|
def make_response
|
@@ -84,10 +89,14 @@ module DaVinciPDexTestKit
|
|
84
89
|
/custom\/pdex_payer_client\/fhir\/([a-zA-Z_-]+)([\/\?].*)?/.match(url)&.to_a&.at(1)
|
85
90
|
end
|
86
91
|
|
92
|
+
def supported_searches
|
93
|
+
@supported_searchs ||= SEARCHES_BY_PRIORITY
|
94
|
+
end
|
95
|
+
|
87
96
|
# Filter request parameters to only include those allowed by PDex API (hardcoded in collections.rb)
|
88
97
|
# @return [Hash]
|
89
98
|
def match_request_to_expectation(endpoint, params)
|
90
|
-
matched_search =
|
99
|
+
matched_search = supported_searches[endpoint.to_sym]&.find {|expectation| (params.keys.map{|key| key.to_s} & expectation).sort == expectation}
|
91
100
|
|
92
101
|
if matched_search
|
93
102
|
params.select {|key, value| matched_search.include?(key.to_s) || key == "_revInclude" || key == "_include"}
|
@@ -128,12 +137,12 @@ module DaVinciPDexTestKit
|
|
128
137
|
elsif is_json?(server_response.body)
|
129
138
|
response.format = 'application/json'
|
130
139
|
# Uncomment to recklessly replace all proxy urls with our urls:
|
131
|
-
# response.body = server_response.body.gsub(fhir_reference_server,
|
140
|
+
# response.body = server_response.body.gsub(fhir_reference_server, fhir_base_url)
|
132
141
|
response.body = server_response.body
|
133
142
|
|
134
143
|
else
|
135
144
|
# Uncomment to recklessly replace all proxy urls with our urls:
|
136
|
-
# response.body = server_response.body.gsub(fhir_reference_server,
|
145
|
+
# response.body = server_response.body.gsub(fhir_reference_server, fhir_base_url)
|
137
146
|
response.body = server_response.body
|
138
147
|
end
|
139
148
|
|
@@ -155,10 +164,10 @@ module DaVinciPDexTestKit
|
|
155
164
|
end
|
156
165
|
|
157
166
|
def replace_bundle_urls(bundle)
|
158
|
-
bundle&.link.map! {|link| {relation: link.relation, url: link.url.gsub(fhir_reference_server,
|
167
|
+
bundle&.link.map! {|link| {relation: link.relation, url: link.url.gsub(fhir_reference_server, fhir_base_url)}}
|
159
168
|
bundle&.entry&.map! do |bundled_resource|
|
160
169
|
{
|
161
|
-
fullUrl: bundled_resource.fullUrl.gsub(fhir_reference_server,
|
170
|
+
fullUrl: bundled_resource.fullUrl.gsub(fhir_reference_server, fhir_base_url),
|
162
171
|
resource: bundled_resource.resource,
|
163
172
|
search: bundled_resource.search
|
164
173
|
}
|
@@ -1,4 +1,5 @@
|
|
1
|
-
|
1
|
+
require 'smart_app_launch_test_kit'
|
2
|
+
|
2
3
|
require_relative 'mock_server/resource_search_endpoint'
|
3
4
|
require_relative 'mock_server/resource_read_endpoint'
|
4
5
|
require_relative 'mock_server/patient_endpoint'
|
@@ -8,6 +9,8 @@ require_relative 'mock_server/export_endpoint'
|
|
8
9
|
require_relative 'mock_server/export_status_endpoint'
|
9
10
|
require_relative 'mock_server/member_match_endpoint'
|
10
11
|
require_relative 'mock_server/next_page_endpoint'
|
12
|
+
require_relative 'mock_udap_smart_server/authorization_endpoint'
|
13
|
+
require_relative 'mock_udap_smart_server/token_endpoint'
|
11
14
|
|
12
15
|
require_relative '../user_input_response'
|
13
16
|
require_relative 'urls'
|
@@ -35,7 +38,29 @@ module DaVinciPDexTestKit
|
|
35
38
|
File.readlines(File.expand_path('mock_server/resources/mock_capability_statement.json', __dir__))
|
36
39
|
]
|
37
40
|
}
|
38
|
-
|
41
|
+
|
42
|
+
# SMART App Launch / Backend Services server simulation
|
43
|
+
route(:get, SMARTAppLaunch::SMART_DISCOVERY_PATH, lambda { |_env|
|
44
|
+
SMARTAppLaunch::MockSMARTServer.smart_server_metadata(id)
|
45
|
+
})
|
46
|
+
route(:get, UDAPSecurityTestKit::UDAP_DISCOVERY_PATH, lambda { |_env|
|
47
|
+
UDAPSecurityTestKit::MockUDAPServer.udap_server_metadata(id)
|
48
|
+
})
|
49
|
+
route(:get, SMARTAppLaunch::OIDC_DISCOVERY_PATH, ->(_env) {SMARTAppLaunch::MockSMARTServer.openid_connect_metadata(id) })
|
50
|
+
route(
|
51
|
+
:get,
|
52
|
+
SMARTAppLaunch::OIDC_JWKS_PATH,
|
53
|
+
->(_env) { [200, { 'Content-Type' => 'application/json' }, [SMARTAppLaunch::OIDCJWKS.jwks_json]] }
|
54
|
+
)
|
55
|
+
suite_endpoint :post, UDAPSecurityTestKit::REGISTRATION_PATH,
|
56
|
+
UDAPSecurityTestKit::MockUDAPServer::RegistrationEndpoint
|
57
|
+
suite_endpoint :post, UDAPSecurityTestKit::TOKEN_PATH,
|
58
|
+
DaVinciPDexTestKit::PDexPayerClient::MockUdapSmartServer::TokenEndpoint
|
59
|
+
suite_endpoint :get, UDAPSecurityTestKit::AUTHORIZATION_PATH,
|
60
|
+
DaVinciPDexTestKit::PDexPayerClient::MockUdapSmartServer::AuthorizationEndpoint
|
61
|
+
suite_endpoint :post, UDAPSecurityTestKit::AUTHORIZATION_PATH,
|
62
|
+
DaVinciPDexTestKit::PDexPayerClient::MockUdapSmartServer::AuthorizationEndpoint
|
63
|
+
|
39
64
|
suite_endpoint :post, MEMBER_MATCH_PATH, MemberMatchEndpoint
|
40
65
|
suite_endpoint :get, EVERYTHING_PATH, PatientEverythingEndpoint
|
41
66
|
suite_endpoint :get, EXPORT_PATH, ExportEndpoint
|
@@ -44,6 +69,7 @@ module DaVinciPDexTestKit
|
|
44
69
|
suite_endpoint :get, PATIENT_PATH, PatientEndpoint # PDex Patient query needs its own endpoint
|
45
70
|
suite_endpoint :get, RESOURCE_PATH, ResourceSearchEndpoint
|
46
71
|
suite_endpoint :get, INSTANCE_PATH, ResourceReadEndpoint
|
72
|
+
suite_endpoint :get, PATIENT_INSTANCE_PATH, ResourceReadEndpoint
|
47
73
|
suite_endpoint :get, BASE_FHIR_PATH, NextPageEndpoint # TODO: better pagination route?
|
48
74
|
|
49
75
|
end
|
data/lib/davinci_pdex_test_kit/pdex_payer_client/mock_udap_smart_server/authorization_endpoint.rb
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'udap_security_test_kit'
|
4
|
+
require 'smart_app_launch_test_kit'
|
5
|
+
require_relative '../urls'
|
6
|
+
require_relative '../tags'
|
7
|
+
require_relative '../pdex_client_options'
|
8
|
+
|
9
|
+
module DaVinciPDexTestKit
|
10
|
+
module PDexPayerClient
|
11
|
+
module MockUdapSmartServer
|
12
|
+
class AuthorizationEndpoint < Inferno::DSL::SuiteEndpoint
|
13
|
+
include SMARTAppLaunch::MockSMARTServer::SMARTAuthorizationResponseCreation
|
14
|
+
include UDAPSecurityTestKit::MockUDAPServer::UDAPAuthorizationResponseCreation
|
15
|
+
include PDexClientOptions
|
16
|
+
|
17
|
+
def test_run_identifier
|
18
|
+
request.params[:client_id]
|
19
|
+
end
|
20
|
+
|
21
|
+
def suite_options
|
22
|
+
@suite_options ||=
|
23
|
+
Inferno::Repositories::TestSessions.new.find(result.test_session_id)
|
24
|
+
&.suite_options&.map { |so| [so.id, so.value] }&.to_h
|
25
|
+
end
|
26
|
+
|
27
|
+
def make_response
|
28
|
+
if selected_security_ig(suite_options) == UDAPSecurityTestKit::UDAP_TAG
|
29
|
+
make_udap_authorization_response
|
30
|
+
else
|
31
|
+
make_smart_authorization_response
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def update_result
|
36
|
+
nil # never update for now
|
37
|
+
end
|
38
|
+
|
39
|
+
def tags
|
40
|
+
tags = [UDAPSecurityTestKit::AUTHORIZATION_TAG, UDAPSecurityTestKit::AUTHORIZATION_CODE_TAG]
|
41
|
+
tags <<
|
42
|
+
if selected_security_ig(suite_options) == UDAPSecurityTestKit::UDAP_TAG
|
43
|
+
UDAPSecurityTestKit::UDAP_TAG
|
44
|
+
else
|
45
|
+
SMARTAppLaunch::SMART_TAG
|
46
|
+
end
|
47
|
+
|
48
|
+
tags
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
@@ -0,0 +1,85 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'udap_security_test_kit'
|
4
|
+
require 'smart_app_launch_test_kit'
|
5
|
+
require_relative '../urls'
|
6
|
+
|
7
|
+
module DaVinciPDexTestKit
|
8
|
+
module PDexPayerClient
|
9
|
+
module MockUdapSmartServer
|
10
|
+
class TokenEndpoint < Inferno::DSL::SuiteEndpoint
|
11
|
+
include SMARTAppLaunch::MockSMARTServer::SMARTTokenResponseCreation
|
12
|
+
include UDAPSecurityTestKit::MockUDAPServer::UDAPTokenResponseCreation
|
13
|
+
include URLs
|
14
|
+
|
15
|
+
def test_run_identifier
|
16
|
+
case request.params[:grant_type]
|
17
|
+
when UDAPSecurityTestKit::CLIENT_CREDENTIALS_TAG
|
18
|
+
UDAPSecurityTestKit::MockUDAPServer.client_id_from_client_assertion(request.params[:client_assertion])
|
19
|
+
when UDAPSecurityTestKit::AUTHORIZATION_CODE_TAG
|
20
|
+
UDAPSecurityTestKit::MockUDAPServer.issued_token_to_client_id(request.params[:code])
|
21
|
+
when UDAPSecurityTestKit::REFRESH_TOKEN_TAG
|
22
|
+
UDAPSecurityTestKit::MockUDAPServer.issued_token_to_client_id(
|
23
|
+
UDAPSecurityTestKit::MockUDAPServer.refresh_token_to_authorization_code(request.params[:refresh_token])
|
24
|
+
)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def make_response
|
29
|
+
if request.params[:udap].present?
|
30
|
+
case request.params[:grant_type]
|
31
|
+
when UDAPSecurityTestKit::CLIENT_CREDENTIALS_TAG
|
32
|
+
make_udap_client_credential_token_response
|
33
|
+
when UDAPSecurityTestKit::AUTHORIZATION_CODE_TAG
|
34
|
+
make_udap_authorization_code_token_response
|
35
|
+
when UDAPSecurityTestKit::REFRESH_TOKEN_TAG
|
36
|
+
make_udap_refresh_token_response
|
37
|
+
else
|
38
|
+
UDAPSecurityTestKit::MockUDAPServer.update_response_for_invalid_assertion(
|
39
|
+
response,
|
40
|
+
"unsupported grant_type: #{request.params[:grant_type]}"
|
41
|
+
)
|
42
|
+
end
|
43
|
+
else
|
44
|
+
if request.params[:grant_type] == SMARTAppLaunch::CLIENT_CREDENTIALS_TAG
|
45
|
+
return make_smart_client_credential_token_response
|
46
|
+
end
|
47
|
+
|
48
|
+
suite_options_list = Inferno::Repositories::TestSessions.new.find(result.test_session_id)&.suite_options
|
49
|
+
suite_options_hash = suite_options_list&.map { |option| [option.id, option.value] }&.to_h
|
50
|
+
smart_authentication_approach =
|
51
|
+
SMARTAppLaunch::SMARTClientOptions.smart_authentication_approach(suite_options_hash)
|
52
|
+
|
53
|
+
case request.params[:grant_type]
|
54
|
+
when SMARTAppLaunch::AUTHORIZATION_CODE_TAG
|
55
|
+
make_smart_authorization_code_token_response(smart_authentication_approach)
|
56
|
+
when SMARTAppLaunch::REFRESH_TOKEN_TAG
|
57
|
+
make_smart_refresh_token_response(smart_authentication_approach)
|
58
|
+
else
|
59
|
+
SMARTAppLaunch::MockSMARTServer.update_response_for_invalid_assertion(
|
60
|
+
response,
|
61
|
+
"unsupported grant_type: #{request.params[:grant_type]}"
|
62
|
+
)
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
def update_result
|
68
|
+
nil # never update for now
|
69
|
+
end
|
70
|
+
|
71
|
+
def tags
|
72
|
+
tags = [UDAPSecurityTestKit::TOKEN_TAG]
|
73
|
+
tags << (request.params[:udap].present? ? UDAPSecurityTestKit::UDAP_TAG : SMARTAppLaunch::SMART_TAG)
|
74
|
+
if [UDAPSecurityTestKit::CLIENT_CREDENTIALS_TAG,
|
75
|
+
UDAPSecurityTestKit::AUTHORIZATION_CODE_TAG,
|
76
|
+
UDAPSecurityTestKit::REFRESH_TOKEN_TAG].include?(request.params[:grant_type])
|
77
|
+
tags << request.params[:grant_type]
|
78
|
+
end
|
79
|
+
|
80
|
+
tags
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'smart_app_launch_test_kit'
|
4
|
+
require 'udap_security_test_kit'
|
5
|
+
|
6
|
+
module DaVinciPDexTestKit
|
7
|
+
module PDexPayerClient
|
8
|
+
module PDexClientOptions
|
9
|
+
SMART_APP_LAUNCH_PUBLIC = SMARTAppLaunch::SMARTClientOptions::SMART_APP_LAUNCH_PUBLIC
|
10
|
+
SMART_APP_LAUNCH_CONFIDENTIAL_SYMMETRIC =
|
11
|
+
SMARTAppLaunch::SMARTClientOptions::SMART_APP_LAUNCH_CONFIDENTIAL_SYMMETRIC
|
12
|
+
SMART_APP_LAUNCH_CONFIDENTIAL_ASYMMETRIC =
|
13
|
+
SMARTAppLaunch::SMARTClientOptions::SMART_APP_LAUNCH_CONFIDENTIAL_ASYMMETRIC
|
14
|
+
UDAP_AUTHORIZATION_CODE =
|
15
|
+
UDAPSecurityTestKit::UDAPClientOptions::UDAP_AUTHORIZATION_CODE
|
16
|
+
|
17
|
+
def selected_security_ig(suite_options)
|
18
|
+
if suite_options[:client_type].include?(UDAPSecurityTestKit::UDAP_TAG)
|
19
|
+
UDAPSecurityTestKit::UDAP_TAG
|
20
|
+
else
|
21
|
+
SMARTAppLaunch::SMART_TAG
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -2,14 +2,13 @@
|
|
2
2
|
|
3
3
|
module DaVinciPDexTestKit
|
4
4
|
module PDexPayerClient
|
5
|
-
|
6
|
-
|
7
|
-
PATIENT_ID_REQUEST_TAG = '
|
8
|
-
BINARY_TAG = '
|
9
|
-
EXPORT_TAG = '
|
10
|
-
EXPORT_STATUS_TAG = '
|
11
|
-
EVERYTHING_TAG = '
|
12
|
-
MEMBER_MATCH_TAG = '
|
13
|
-
|
5
|
+
RESOURCE_API_TAG = 'resource_api'
|
6
|
+
RESOURCE_ID_TAG = 'resource_id'
|
7
|
+
PATIENT_ID_REQUEST_TAG = 'patient_id_request'
|
8
|
+
BINARY_TAG = 'binary'
|
9
|
+
EXPORT_TAG = 'export'
|
10
|
+
EXPORT_STATUS_TAG = 'export_status'
|
11
|
+
EVERYTHING_TAG = 'everything'
|
12
|
+
MEMBER_MATCH_TAG = 'member_match'
|
14
13
|
end
|
15
14
|
end
|