onc_certification_g10_test_kit 7.0.3 → 7.2.0

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.
Files changed (63) hide show
  1. checksums.yaml +4 -4
  2. data/config/presets/g10_reference_server_preset.json +1467 -0
  3. data/lib/inferno/ext/bloomer.rb +1 -1
  4. data/lib/inferno/terminology/tasks/process_umls.rb +1 -1
  5. data/lib/onc_certification_g10_test_kit/bulk_data_authorization.rb +73 -67
  6. data/lib/onc_certification_g10_test_kit/bulk_data_group_export_cancel_stu1.rb +1 -2
  7. data/lib/onc_certification_g10_test_kit/bulk_data_group_export_cancel_stu2.rb +7 -1
  8. data/lib/onc_certification_g10_test_kit/bulk_data_group_export_parameters.rb +1 -1
  9. data/lib/onc_certification_g10_test_kit/bulk_data_group_export_stu1.rb +10 -2
  10. data/lib/onc_certification_g10_test_kit/bulk_data_group_export_validation.rb +6 -2
  11. data/lib/onc_certification_g10_test_kit/bulk_export_validation_tester.rb +7 -3
  12. data/lib/onc_certification_g10_test_kit/configuration_checker.rb +5 -13
  13. data/lib/onc_certification_g10_test_kit/encounter_context_test.rb +3 -3
  14. data/lib/onc_certification_g10_test_kit/export_kick_off_performer.rb +7 -3
  15. data/lib/onc_certification_g10_test_kit/feature.rb +5 -4
  16. data/lib/onc_certification_g10_test_kit/igs/01-us-core-v400.tgz +0 -0
  17. data/lib/onc_certification_g10_test_kit/igs/03-us-core-v311.tgz +0 -0
  18. data/lib/onc_certification_g10_test_kit/igs/04-us-core-610.tgz +0 -0
  19. data/lib/onc_certification_g10_test_kit/metadata.rb +103 -0
  20. data/lib/onc_certification_g10_test_kit/multi_patient_api_stu1.rb +0 -4
  21. data/lib/onc_certification_g10_test_kit/multi_patient_api_stu2.rb +8 -4
  22. data/lib/onc_certification_g10_test_kit/patient_context_test.rb +3 -3
  23. data/lib/onc_certification_g10_test_kit/patient_scope_test.rb +1 -1
  24. data/lib/onc_certification_g10_test_kit/restricted_resource_type_access_group.rb +3 -10
  25. data/lib/onc_certification_g10_test_kit/scope_constants.rb +52 -0
  26. data/lib/onc_certification_g10_test_kit/short_id_map.yml +11 -20
  27. data/lib/onc_certification_g10_test_kit/single_patient_api_group.rb +18 -17
  28. data/lib/onc_certification_g10_test_kit/single_patient_us_core_4_api_group.rb +18 -17
  29. data/lib/onc_certification_g10_test_kit/single_patient_us_core_5_api_group.rb +18 -17
  30. data/lib/onc_certification_g10_test_kit/single_patient_us_core_6_api_group.rb +20 -19
  31. data/lib/onc_certification_g10_test_kit/single_patient_us_core_7_api_group.rb +20 -19
  32. data/lib/onc_certification_g10_test_kit/smart_app_launch_invalid_aud_group.rb +108 -65
  33. data/lib/onc_certification_g10_test_kit/smart_asymmetric_launch_group.rb +42 -89
  34. data/lib/onc_certification_g10_test_kit/smart_ehr_patient_launch_group.rb +33 -43
  35. data/lib/onc_certification_g10_test_kit/smart_ehr_patient_launch_group_stu2.rb +32 -54
  36. data/lib/onc_certification_g10_test_kit/smart_ehr_patient_launch_group_stu2_2.rb +34 -55
  37. data/lib/onc_certification_g10_test_kit/smart_ehr_practitioner_app_group.rb +103 -146
  38. data/lib/onc_certification_g10_test_kit/smart_fine_grained_scopes_group.rb +17 -55
  39. data/lib/onc_certification_g10_test_kit/smart_fine_grained_scopes_group_stu2_2.rb +17 -55
  40. data/lib/onc_certification_g10_test_kit/smart_fine_grained_scopes_us_core_7_group.rb +17 -55
  41. data/lib/onc_certification_g10_test_kit/smart_fine_grained_scopes_us_core_7_group_stu2_2.rb +17 -55
  42. data/lib/onc_certification_g10_test_kit/smart_granular_scope_selection_group.rb +33 -68
  43. data/lib/onc_certification_g10_test_kit/smart_granular_scope_selection_test.rb +4 -3
  44. data/lib/onc_certification_g10_test_kit/smart_invalid_pkce_group.rb +45 -89
  45. data/lib/onc_certification_g10_test_kit/smart_invalid_token_group.rb +45 -89
  46. data/lib/onc_certification_g10_test_kit/smart_invalid_token_group_stu2.rb +53 -91
  47. data/lib/onc_certification_g10_test_kit/smart_invalid_token_refresh_test.rb +9 -6
  48. data/lib/onc_certification_g10_test_kit/smart_limited_app_group.rb +86 -278
  49. data/lib/onc_certification_g10_test_kit/smart_public_standalone_launch_group.rb +32 -59
  50. data/lib/onc_certification_g10_test_kit/smart_public_standalone_launch_group_stu2.rb +36 -75
  51. data/lib/onc_certification_g10_test_kit/smart_public_standalone_launch_group_stu2_2.rb +36 -75
  52. data/lib/onc_certification_g10_test_kit/smart_scopes_test.rb +6 -1
  53. data/lib/onc_certification_g10_test_kit/smart_standalone_patient_app_group.rb +90 -118
  54. data/lib/onc_certification_g10_test_kit/smart_v1_scopes_group.rb +62 -116
  55. data/lib/onc_certification_g10_test_kit/tasks/generate_matrix.rb +3 -12
  56. data/lib/onc_certification_g10_test_kit/token_introspection_group.rb +12 -25
  57. data/lib/onc_certification_g10_test_kit/token_introspection_group_stu2_2.rb +12 -14
  58. data/lib/onc_certification_g10_test_kit/token_revocation_group.rb +44 -33
  59. data/lib/onc_certification_g10_test_kit/unrestricted_resource_type_access_group.rb +3 -3
  60. data/lib/onc_certification_g10_test_kit/urls.rb +4 -0
  61. data/lib/onc_certification_g10_test_kit/version.rb +2 -1
  62. data/lib/onc_certification_g10_test_kit.rb +119 -65
  63. metadata +20 -68
@@ -1,11 +1,15 @@
1
+ require_relative 'scope_constants'
2
+
1
3
  module ONCCertificationG10TestKit
2
4
  class SMARTInvalidTokenGroupSTU2 < Inferno::TestGroup
5
+ include ScopeConstants
6
+
3
7
  title 'Invalid Access Token Request'
4
8
  short_title 'Invalid Token Request'
5
9
  input_instructions %(
6
10
  Register Inferno as a standalone application using the following information:
7
11
 
8
- * Redirect URI: `#{SMARTAppLaunch::AppRedirectTest.config.options[:redirect_uri]}`
12
+ * Redirect URI: `#{REDIRECT_URI}`
9
13
  )
10
14
  description %(
11
15
  This scenario verifies that a SMART Launch
@@ -22,80 +26,44 @@ module ONCCertificationG10TestKit
22
26
  id :g10_smart_invalid_token_request_stu2
23
27
  run_as_group
24
28
 
25
- input :use_pkce,
26
- title: 'Proof Key for Code Exchange (PKCE)',
27
- type: 'radio',
28
- default: 'true',
29
- locked: true,
29
+ config(
30
+ inputs: {
31
+ smart_auth_info: {
32
+ name: :standalone_smart_auth_info,
33
+ title: 'Standalone Launch Credentials',
30
34
  options: {
31
- list_options: [
35
+ mode: 'auth',
36
+ components: [
32
37
  {
33
- label: 'Enabled',
34
- value: 'true'
38
+ name: :requested_scopes,
39
+ default: STANDALONE_SMART_1_SCOPES
35
40
  },
36
41
  {
37
- label: 'Disabled',
38
- value: 'false'
39
- }
40
- ]
41
- }
42
- input :pkce_code_challenge_method,
43
- optional: true,
44
- title: 'PKCE Code Challenge Method',
45
- type: 'radio',
46
- default: 'S256',
47
- locked: true,
48
- options: {
49
- list_options: [
42
+ name: :auth_type,
43
+ default: 'symmetric',
44
+ locked: true
45
+ },
46
+ {
47
+ name: :auth_request_method,
48
+ default: 'GET',
49
+ locked: true
50
+ },
51
+ {
52
+ name: :use_discovery,
53
+ locked: true
54
+ },
50
55
  {
51
- label: 'S256',
52
- value: 'S256'
56
+ name: :pkce_support,
57
+ default: 'enabled',
58
+ locked: true
53
59
  },
54
60
  {
55
- label: 'Plain',
56
- value: 'plain'
61
+ name: :pkce_code_challenge_method,
62
+ default: 'S256',
63
+ locked: true
57
64
  }
58
65
  ]
59
66
  }
60
-
61
- input_order :url,
62
- :standalone_client_id,
63
- :standalone_client_secret,
64
- :standalone_requested_scopes,
65
- :use_pkce,
66
- :pkce_code_challenge_method,
67
- :smart_authorization_url,
68
- :smart_token_url
69
-
70
- config(
71
- inputs: {
72
- client_id: {
73
- name: :standalone_client_id,
74
- title: 'Standalone Client ID',
75
- description: 'Client ID provided during registration of Inferno as a standalone application'
76
- },
77
- client_secret: {
78
- name: :standalone_client_secret,
79
- title: 'Standalone Client Secret',
80
- description: 'Client Secret provided during registration of Inferno as a standalone application'
81
- },
82
- requested_scopes: {
83
- name: :standalone_requested_scopes,
84
- title: 'Standalone Scope',
85
- description: 'OAuth 2.0 scope provided by system to enable all required functionality',
86
- type: 'textarea',
87
- default: %(
88
- launch/patient openid fhirUser offline_access
89
- patient/Medication.read patient/AllergyIntolerance.read
90
- patient/CarePlan.read patient/CareTeam.read patient/Condition.read
91
- patient/Device.read patient/DiagnosticReport.read
92
- patient/DocumentReference.read patient/Encounter.read
93
- patient/Goal.read patient/Immunization.read patient/Location.read
94
- patient/MedicationRequest.read patient/Observation.read
95
- patient/Organization.read patient/Patient.read
96
- patient/Practitioner.read patient/Procedure.read
97
- patient/Provenance.read patient/PractitionerRole.read
98
- ).gsub(/\s{2,}/, ' ').strip
99
67
  },
100
68
  url: {
101
69
  title: 'Standalone FHIR Endpoint',
@@ -107,27 +75,16 @@ module ONCCertificationG10TestKit
107
75
  state: {
108
76
  name: :invalid_token_state
109
77
  },
110
- smart_authorization_url: {
111
- title: 'OAuth 2.0 Authorize Endpoint',
112
- description: 'OAuth 2.0 Authorize Endpoint provided during the patient standalone launch'
113
- },
114
- smart_token_url: {
115
- title: 'OAuth 2.0 Token Endpoint',
116
- description: 'OAuth 2.0 Token Endpoint provided during the patient standalone launch'
117
- },
118
78
  pkce_code_verifier: {
119
79
  name: :invalid_token_pkce_code_verifier
120
- },
121
- client_auth_type: {
122
- locked: true,
123
- default: 'confidential_symmetric'
124
80
  }
125
81
  },
126
82
  outputs: {
127
83
  code: { name: :invalid_token_code },
128
84
  state: { name: :invalid_token_state },
129
85
  expires_in: { name: :invalid_token_expires_in },
130
- pkce_code_verifier: { name: :invalid_token_pkce_code_verifier }
86
+ pkce_code_verifier: { name: :invalid_token_pkce_code_verifier },
87
+ smart_auth_info: { name: :standalone_smart_auth_info }
131
88
  },
132
89
  requests: {
133
90
  redirect: { name: :invalid_token_redirect },
@@ -135,10 +92,13 @@ module ONCCertificationG10TestKit
135
92
  }
136
93
  )
137
94
 
95
+ test from: :well_known_endpoint
96
+
138
97
  test from: :smart_app_redirect_stu2
139
98
  test from: :smart_code_received
140
99
 
141
100
  test do
101
+ id 'Test03'
142
102
  title ' OAuth token exchange fails when supplied invalid code'
143
103
  description %(
144
104
  If the request failed verification or is invalid, the authorization
@@ -146,7 +106,7 @@ module ONCCertificationG10TestKit
146
106
  )
147
107
  uses_request :redirect
148
108
 
149
- input :use_pkce, :client_id, :client_secret, :smart_token_url
109
+ input :smart_auth_info, type: :auth_info
150
110
  input :pkce_code_verifier,
151
111
  optional: true
152
112
  run do
@@ -155,26 +115,27 @@ module ONCCertificationG10TestKit
155
115
  oauth2_params = {
156
116
  grant_type: 'authorization_code',
157
117
  code: 'BAD_CODE',
158
- redirect_uri: config.options[:redirect_uri]
118
+ redirect_uri: REDIRECT_URI
159
119
  }
160
120
  oauth2_headers = { 'Content-Type' => 'application/x-www-form-urlencoded' }
161
121
 
162
- if client_secret.present?
163
- client_credentials = "#{client_id}:#{client_secret}"
122
+ if smart_auth_info.symmetric_auth?
123
+ client_credentials = "#{smart_auth_info.client_id}:#{smart_auth_info.client_secret}"
164
124
  oauth2_headers['Authorization'] = "Basic #{Base64.strict_encode64(client_credentials)}"
165
125
  else
166
- oauth2_params[:client_id] = client_id
126
+ oauth2_params[:client_id] = smart_auth_info.client_id
167
127
  end
168
128
 
169
- oauth2_params[:code_verifier] = pkce_code_verifier if use_pkce == 'true'
129
+ oauth2_params[:code_verifier] = pkce_code_verifier if smart_auth_info.pkce_enabled?
170
130
 
171
- post(smart_token_url, body: oauth2_params, name: :token, headers: oauth2_headers)
131
+ post(smart_auth_info.token_url, body: oauth2_params, name: :token, headers: oauth2_headers)
172
132
 
173
133
  assert_response_status(400)
174
134
  end
175
135
  end
176
136
 
177
137
  test do
138
+ id 'Test04'
178
139
  title 'OAuth token exchange fails when supplied invalid client ID'
179
140
  description %(
180
141
  If the request failed verification or is invalid, the authorization
@@ -182,7 +143,8 @@ module ONCCertificationG10TestKit
182
143
  )
183
144
  uses_request :redirect
184
145
 
185
- input :use_pkce, :code, :smart_token_url, :client_secret
146
+ input :code
147
+ input :smart_auth_info, type: :auth_info
186
148
  input :pkce_code_verifier,
187
149
  optional: true
188
150
 
@@ -194,20 +156,20 @@ module ONCCertificationG10TestKit
194
156
  oauth2_params = {
195
157
  grant_type: 'authorization_code',
196
158
  code:,
197
- redirect_uri: config.options[:redirect_uri]
159
+ redirect_uri: REDIRECT_URI
198
160
  }
199
161
  oauth2_headers = { 'Content-Type' => 'application/x-www-form-urlencoded' }
200
162
 
201
- if client_secret.present?
202
- client_credentials = "#{client_id}:#{client_secret}"
163
+ if smart_auth_info.symmetric_auth?
164
+ client_credentials = "#{client_id}:#{smart_auth_info.client_secret}"
203
165
  oauth2_headers['Authorization'] = "Basic #{Base64.strict_encode64(client_credentials)}"
204
166
  else
205
167
  oauth2_params[:client_id] = client_id
206
168
  end
207
169
 
208
- oauth2_params[:code_verifier] = pkce_code_verifier if use_pkce == 'true'
170
+ oauth2_params[:code_verifier] = pkce_code_verifier if smart_auth_info.pkce_enabled?
209
171
 
210
- post(smart_token_url, body: oauth2_params, name: :token, headers: oauth2_headers)
172
+ post(smart_auth_info.token_url, body: oauth2_params, name: :token, headers: oauth2_headers)
211
173
 
212
174
  assert_response_status([400, 401])
213
175
  end
@@ -8,10 +8,13 @@ module ONCCertificationG10TestKit
8
8
 
9
9
  [OAuth 2.0 RFC (6749)](https://www.rfc-editor.org/rfc/rfc6749#section-6)
10
10
  )
11
- input :refresh_token, :smart_token_url, :client_id, :received_scopes
12
- input :client_secret, optional: true
11
+ input :smart_auth_info, type: 'auth_info'
12
+ input :received_scopes
13
13
 
14
14
  run do
15
+ skip_if smart_auth_info.refresh_token.blank?,
16
+ 'No refresh token was received'
17
+
15
18
  oauth2_params = {
16
19
  'grant_type' => 'refresh_token',
17
20
  'refresh_token' => SecureRandom.uuid
@@ -20,14 +23,14 @@ module ONCCertificationG10TestKit
20
23
 
21
24
  oauth2_params['scope'] = received_scopes if config.options[:include_scopes]
22
25
 
23
- if client_secret.present?
24
- credentials = Base64.strict_encode64("#{client_id}:#{client_secret}")
26
+ if smart_auth_info.symmetric_auth?
27
+ credentials = Base64.strict_encode64("#{smart_auth_info.client_id}:#{smart_auth_info.client_secret}")
25
28
  oauth2_headers['Authorization'] = "Basic #{credentials}"
26
29
  else
27
- oauth2_params['client_id'] = client_id
30
+ oauth2_params['client_id'] = smart_auth_info.client_id
28
31
  end
29
32
 
30
- post(smart_token_url, body: oauth2_params, headers: oauth2_headers)
33
+ post(smart_auth_info.token_url, body: oauth2_params, headers: oauth2_headers)
31
34
 
32
35
  assert_response_status([400, 401])
33
36
  end