smart_udap_harmonization_test_kit 0.9.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 (23) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +201 -0
  3. data/lib/smart_udap_harmonization_test_kit/smart_udap_authorization_code_authentication_group.rb +50 -0
  4. data/lib/smart_udap_harmonization_test_kit/smart_udap_authorization_code_group.rb +127 -0
  5. data/lib/smart_udap_harmonization_test_kit/smart_udap_authorization_code_redirect_test.rb +88 -0
  6. data/lib/smart_udap_harmonization_test_kit/smart_udap_context_test.rb +94 -0
  7. data/lib/smart_udap_harmonization_test_kit/smart_udap_encounter_context_test.rb +59 -0
  8. data/lib/smart_udap_harmonization_test_kit/smart_udap_fhir_context_test.rb +87 -0
  9. data/lib/smart_udap_harmonization_test_kit/smart_udap_intent_context_test.rb +25 -0
  10. data/lib/smart_udap_harmonization_test_kit/smart_udap_launch_context_group.rb +86 -0
  11. data/lib/smart_udap_harmonization_test_kit/smart_udap_need_patient_banner_context_test.rb +25 -0
  12. data/lib/smart_udap_harmonization_test_kit/smart_udap_openid_connect_group.rb +66 -0
  13. data/lib/smart_udap_harmonization_test_kit/smart_udap_patient_context_test.rb +58 -0
  14. data/lib/smart_udap_harmonization_test_kit/smart_udap_request_builder.rb +27 -0
  15. data/lib/smart_udap_harmonization_test_kit/smart_udap_smart_style_url_context_test.rb +33 -0
  16. data/lib/smart_udap_harmonization_test_kit/smart_udap_tenant_context_test.rb +25 -0
  17. data/lib/smart_udap_harmonization_test_kit/smart_udap_token_refresh_test.rb +129 -0
  18. data/lib/smart_udap_harmonization_test_kit/smart_udap_token_refresh_with_scopes_group.rb +81 -0
  19. data/lib/smart_udap_harmonization_test_kit/smart_udap_token_refresh_without_scopes_group.rb +70 -0
  20. data/lib/smart_udap_harmonization_test_kit/smart_udap_token_response_scope_test.rb +56 -0
  21. data/lib/smart_udap_harmonization_test_kit/version.rb +5 -0
  22. data/lib/smart_udap_harmonization_test_kit.rb +73 -0
  23. metadata +109 -0
@@ -0,0 +1,70 @@
1
+ require_relative 'smart_udap_token_refresh_test'
2
+ require_relative 'smart_udap_token_refresh_with_scopes_group'
3
+ require_relative 'smart_udap_token_response_scope_test'
4
+ require 'udap_security_test_kit/token_exchange_response_body_test'
5
+ require 'udap_security_test_kit/token_exchange_response_headers_test'
6
+
7
+ module SMART_UDAP_HarmonizationTestKit
8
+ class SMART_UDAP_TokenRefreshWithoutScopesGroup < Inferno::TestGroup # rubocop:disable Naming/ClassAndModuleCamelCase
9
+ title 'Support for Token Refresh Without Scopes'
10
+ id :smart_udap_token_refresh_without_scopes
11
+
12
+ scopes_omitted_description = %(
13
+ The optional `scope` parameter will not be inclued in the token exchange request. [RFC 6749 Section 6](https://datatracker.ietf.org/doc/html/rfc6749#section-6)
14
+ states:
15
+ > The requested scope MUST NOT include any scope
16
+ not originally granted by the resource owner, and *if omitted is
17
+ treated as equal to the scope originally granted by the
18
+ resource owner*.
19
+ )
20
+
21
+ description %(
22
+ #{SMART_UDAP_HarmonizationTestKit::SMART_UDAP_TokenRefreshWithScopesGroup.token_refresh_group_description}
23
+ #{scopes_omitted_description}
24
+ )
25
+
26
+ run_as_group
27
+
28
+ test from: :smart_udap_token_refresh,
29
+ config: {
30
+ inputs: {
31
+ udap_received_scopes: {
32
+ locked: true,
33
+ description: 'Will be omitted in refresh request.'
34
+ }
35
+ }
36
+ }
37
+
38
+ test from: :udap_token_exchange_response_body,
39
+ config: {
40
+ inputs: {
41
+ token_response_body: {
42
+ name: :smart_udap_token_refresh_response_body
43
+ }
44
+ }
45
+ }
46
+
47
+ test from: :smart_udap_token_response_scope,
48
+ config: {
49
+ inputs: {
50
+ udap_auth_code_flow_token_exchange_response_body: {
51
+ name: :smart_udap_token_refresh_response_body
52
+ },
53
+ udap_auth_code_flow_registration_scope: {
54
+ name: :udap_received_scopes,
55
+ locked: true
56
+ },
57
+ udap_auth_code_flow_token_retrieval_time: {
58
+ name: :smart_udap_refresh_token_retrieval_time
59
+ }
60
+ }
61
+ }
62
+
63
+ test from: :udap_token_exchange_response_headers,
64
+ config: {
65
+ requests: {
66
+ name: :smart_udap_token_refresh_request
67
+ }
68
+ }
69
+ end
70
+ end
@@ -0,0 +1,56 @@
1
+ require 'smart_app_launch/token_payload_validation'
2
+
3
+ module SMART_UDAP_HarmonizationTestKit
4
+ class SMART_UDAP_TokenResponseScopeTest < Inferno::Test # rubocop:disable Naming/ClassAndModuleCamelCase
5
+ include SMARTAppLaunch::TokenPayloadValidation
6
+ title 'Token exchange reponse body includes required content for SMART scopes'
7
+ id :smart_udap_token_response_scope
8
+ description %(
9
+ In addition to the baseline UDAP requirements for the token exchange response body, this test verifies that the
10
+ scope parameter is included in the response body and issues a warning if any of the requested scopes are
11
+ missing.
12
+ )
13
+
14
+ input :udap_auth_code_flow_token_exchange_response_body,
15
+ :udap_auth_code_flow_registration_scope,
16
+ :udap_auth_code_flow_token_retrieval_time,
17
+ :udap_token_endpoint,
18
+ :udap_client_id
19
+
20
+ output :smart_credentials,
21
+ :id_token,
22
+ :refresh_token,
23
+ :access_token,
24
+ :expires_in,
25
+ :patient_id,
26
+ :encounter_id,
27
+ :received_scopes
28
+
29
+ run do
30
+ assert_valid_json(udap_auth_code_flow_token_exchange_response_body)
31
+ token_response_body_parsed = JSON.parse(udap_auth_code_flow_token_exchange_response_body)
32
+
33
+ output smart_credentials: {
34
+ refresh_token: token_response_body_parsed['refresh_token'],
35
+ access_token: token_response_body_parsed['access_token'],
36
+ expires_in: token_response_body_parsed['expires_in'],
37
+ client_id: udap_client_id,
38
+ client_secret: '',
39
+ udap_auth_code_flow_token_retrieval_time:,
40
+ token_url: udap_token_endpoint
41
+ }.to_json
42
+
43
+ output id_token: token_response_body_parsed['id_token'],
44
+ refresh_token: token_response_body_parsed['refresh_token'],
45
+ access_token: token_response_body_parsed['access_token'],
46
+ expires_in: token_response_body_parsed['expires_in'],
47
+ patient_id: token_response_body_parsed['patient'],
48
+ encounter_id: token_response_body_parsed['encounter'],
49
+ received_scopes: token_response_body_parsed['scope']
50
+
51
+ assert received_scopes.present?, 'Token exchange response does not include the `scope` parameter'
52
+
53
+ check_for_missing_scopes(udap_auth_code_flow_registration_scope, token_response_body_parsed)
54
+ end
55
+ end
56
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module SMART_UDAP_HarmonizationTestKit
4
+ VERSION = '0.9.0'
5
+ end
@@ -0,0 +1,73 @@
1
+ require 'udap_security_test_kit'
2
+ require_relative 'smart_udap_harmonization_test_kit/smart_udap_authorization_code_group'
3
+ require_relative 'smart_udap_harmonization_test_kit/version'
4
+
5
+ module SMART_UDAP_HarmonizationTestKit
6
+ class Suite < Inferno::TestSuite
7
+ id :smart_udap_harmonization
8
+ title 'SMART-UDAP Harmonization'
9
+ description %(
10
+ ## Overview
11
+ This test suite tests server support for the [Security for Scalable
12
+ Registration, Authentication, and Authorization
13
+ IG](https://hl7.org/fhir/us/udap-security/index.html) set of UDAP
14
+ workflows (discovery, client registration, and
15
+ authentication/authorization) using [SMART App Launch STU2-compliant
16
+ scopes and launch
17
+ contexts](https://hl7.org/fhir/smart-app-launch/STU2.2/scopes-and-launch-context.html).
18
+
19
+ The [Security for Scalable Registration, Authentication, and Authorization
20
+ IG](https://hl7.org/fhir/us/udap-security/index.html) states that
21
+
22
+ > This guide is also intended to be compatible and harmonious with client and
23
+ > server use of versions 1 or 2 of the HL7 SMART App Launch IG.
24
+
25
+ This test kit is an effort to demonstrate how a client could interact with a
26
+ server supporting both UDAP and SMART App Launch.
27
+
28
+ The basic assumption underlying these tests is that a client could perform
29
+ dynamic registration and launch with client authorization from the UDAP workflow
30
+ while using SMART App Launch scopes, and the server could include additional
31
+ launch context parameters defined by SMART App Launch in the token response.
32
+
33
+ ## Known Limitations
34
+ The UDAP dynamic registration workflow does not define a way to register a
35
+ launch URI, so the tests only perform a standalone launch.
36
+ )
37
+
38
+ version VERSION
39
+
40
+ resume_test_route :get, '/redirect' do |request|
41
+ request.query_parameters['state']
42
+ end
43
+
44
+ config options: {
45
+ redirect_uri: "#{Inferno::Application['base_url']}/custom/smart_udap_harmonization/redirect"
46
+ }
47
+
48
+ links [
49
+ {
50
+ label: 'Report Issue',
51
+ url: 'https://github.com/inferno-framework/smart-udap-harmonization-test-kit/issues'
52
+ },
53
+ {
54
+ label: 'Open Source',
55
+ url: 'https://github.com/inferno-framework/smart-udap-harmonization-test-kit'
56
+ },
57
+ {
58
+ label: 'Download',
59
+ url: 'https://github.com/inferno-framework/smart-udap-harmonization-test-kit/releases'
60
+ },
61
+ {
62
+ label: 'UDAP Implementation Guide',
63
+ url: 'https://hl7.org/fhir/us/udap-security/STU1'
64
+ },
65
+ {
66
+ label: 'SMART Implementation Guide',
67
+ url: 'https://hl7.org/fhir/smart-app-launch/STU2.2/scopes-and-launch-context.html'
68
+ }
69
+ ]
70
+
71
+ group from: :smart_udap_authorization_code_group
72
+ end
73
+ end
metadata ADDED
@@ -0,0 +1,109 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: smart_udap_harmonization_test_kit
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.9.0
5
+ platform: ruby
6
+ authors:
7
+ - Alisa Wallace
8
+ - Stephen MacVicar
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2024-11-12 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: inferno_core
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - "~>"
19
+ - !ruby/object:Gem::Version
20
+ version: 0.5.0
21
+ type: :runtime
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - "~>"
26
+ - !ruby/object:Gem::Version
27
+ version: 0.5.0
28
+ - !ruby/object:Gem::Dependency
29
+ name: smart_app_launch_test_kit
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - "~>"
33
+ - !ruby/object:Gem::Version
34
+ version: 0.4.3
35
+ type: :runtime
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - "~>"
40
+ - !ruby/object:Gem::Version
41
+ version: 0.4.3
42
+ - !ruby/object:Gem::Dependency
43
+ name: udap_security_test_kit
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - "~>"
47
+ - !ruby/object:Gem::Version
48
+ version: 0.10.0
49
+ type: :runtime
50
+ prerelease: false
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - "~>"
54
+ - !ruby/object:Gem::Version
55
+ version: 0.10.0
56
+ description: Test Kit for integrating SMART App Launch and UDAP Security IGs
57
+ email:
58
+ - inferno@groups.mitre.org
59
+ executables: []
60
+ extensions: []
61
+ extra_rdoc_files: []
62
+ files:
63
+ - LICENSE
64
+ - lib/smart_udap_harmonization_test_kit.rb
65
+ - lib/smart_udap_harmonization_test_kit/smart_udap_authorization_code_authentication_group.rb
66
+ - lib/smart_udap_harmonization_test_kit/smart_udap_authorization_code_group.rb
67
+ - lib/smart_udap_harmonization_test_kit/smart_udap_authorization_code_redirect_test.rb
68
+ - lib/smart_udap_harmonization_test_kit/smart_udap_context_test.rb
69
+ - lib/smart_udap_harmonization_test_kit/smart_udap_encounter_context_test.rb
70
+ - lib/smart_udap_harmonization_test_kit/smart_udap_fhir_context_test.rb
71
+ - lib/smart_udap_harmonization_test_kit/smart_udap_intent_context_test.rb
72
+ - lib/smart_udap_harmonization_test_kit/smart_udap_launch_context_group.rb
73
+ - lib/smart_udap_harmonization_test_kit/smart_udap_need_patient_banner_context_test.rb
74
+ - lib/smart_udap_harmonization_test_kit/smart_udap_openid_connect_group.rb
75
+ - lib/smart_udap_harmonization_test_kit/smart_udap_patient_context_test.rb
76
+ - lib/smart_udap_harmonization_test_kit/smart_udap_request_builder.rb
77
+ - lib/smart_udap_harmonization_test_kit/smart_udap_smart_style_url_context_test.rb
78
+ - lib/smart_udap_harmonization_test_kit/smart_udap_tenant_context_test.rb
79
+ - lib/smart_udap_harmonization_test_kit/smart_udap_token_refresh_test.rb
80
+ - lib/smart_udap_harmonization_test_kit/smart_udap_token_refresh_with_scopes_group.rb
81
+ - lib/smart_udap_harmonization_test_kit/smart_udap_token_refresh_without_scopes_group.rb
82
+ - lib/smart_udap_harmonization_test_kit/smart_udap_token_response_scope_test.rb
83
+ - lib/smart_udap_harmonization_test_kit/version.rb
84
+ homepage: https://github.com/inferno-framework/smart-udap-harmonization-test-kit
85
+ licenses:
86
+ - Apache-2.0
87
+ metadata:
88
+ homepage_uri: https://github.com/inferno-framework/smart-udap-harmonization-test-kit
89
+ source_code_uri: https://github.com/inferno-framework/smart-udap-harmonization-test-kit
90
+ post_install_message:
91
+ rdoc_options: []
92
+ require_paths:
93
+ - lib
94
+ required_ruby_version: !ruby/object:Gem::Requirement
95
+ requirements:
96
+ - - ">="
97
+ - !ruby/object:Gem::Version
98
+ version: 3.1.2
99
+ required_rubygems_version: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ requirements: []
105
+ rubygems_version: 3.5.9
106
+ signing_key:
107
+ specification_version: 4
108
+ summary: SMART-UDAP Harmonization Test Kit
109
+ test_files: []