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