smart_app_launch_test_kit 0.1.4 → 0.1.5
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/lib/smart_app_launch/app_redirect_test_stu2.rb +45 -0
- data/lib/smart_app_launch/ehr_launch_group_stu2.rb +11 -0
- data/lib/smart_app_launch/post_auth.html +35 -0
- data/lib/smart_app_launch/smart_stu2_suite.rb +8 -2
- data/lib/smart_app_launch/standalone_launch_group_stu2.rb +9 -0
- data/lib/smart_app_launch/token_response_body_test.rb +1 -1
- data/lib/smart_app_launch/version.rb +1 -1
- metadata +7 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 685a8ecce753a4b74d881e6aca85706d7e4890c659957e01a4d416e5b848cd43
|
4
|
+
data.tar.gz: 931481829fde8294374fb9c0c8cd5ac93080eef417cbf6b17348b07cb5e6e85d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3e3dec5a9de9015a9c47c4d1856a7d2116e84969f6cc14cac95328837fd02ae45c8bff9f01940e40d88a04a58eed7de0e6a1e640c42feea54e92962f24ad92b2
|
7
|
+
data.tar.gz: 85e2f0e570e6308b2646f7a781fd34d4296ed04372d836385dccaa53d5552426e5bfaf1e7a3e25721e68d0af0d0ae6136a3ad3732b1d2c0785c3e1a83ee9d40a
|
@@ -0,0 +1,45 @@
|
|
1
|
+
require 'uri'
|
2
|
+
require_relative 'app_redirect_test'
|
3
|
+
|
4
|
+
module SMARTAppLaunch
|
5
|
+
class AppRedirectTestSTU2 < AppRedirectTest
|
6
|
+
id :smart_app_redirect_stu2
|
7
|
+
description %(
|
8
|
+
Client browser redirected from OAuth server to redirect URI of client
|
9
|
+
app as described in SMART authorization sequence.
|
10
|
+
|
11
|
+
Client SHALL use either the HTTP GET or the HTTP POST method to send the
|
12
|
+
Authorization Request to the Authorization Server.
|
13
|
+
|
14
|
+
[Authorization Code
|
15
|
+
Request](http://hl7.org/fhir/smart-app-launch/STU2/app-launch.html#request-4)
|
16
|
+
)
|
17
|
+
|
18
|
+
input :authorization_method,
|
19
|
+
title: 'Authorization Method',
|
20
|
+
type: 'radio',
|
21
|
+
default: 'get',
|
22
|
+
options: {
|
23
|
+
list_options: [
|
24
|
+
{
|
25
|
+
label: 'GET',
|
26
|
+
value: 'get'
|
27
|
+
},
|
28
|
+
{
|
29
|
+
label: 'POST',
|
30
|
+
value: 'post'
|
31
|
+
}
|
32
|
+
]
|
33
|
+
}
|
34
|
+
|
35
|
+
def authorization_url_builder(url, params)
|
36
|
+
return super if authorization_method == 'get'
|
37
|
+
|
38
|
+
post_params = params.merge(auth_url: url)
|
39
|
+
|
40
|
+
post_url = URI(config.options[:post_authorization_uri])
|
41
|
+
post_url.query = URI.encode_www_form(post_params)
|
42
|
+
post_url.to_s
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -1,3 +1,4 @@
|
|
1
|
+
require_relative 'app_redirect_test_stu2'
|
1
2
|
require_relative 'ehr_launch_group'
|
2
3
|
|
3
4
|
module SMARTAppLaunch
|
@@ -38,8 +39,18 @@ module SMARTAppLaunch
|
|
38
39
|
pkce_code_challenge_method: {
|
39
40
|
default: 'S256',
|
40
41
|
locked: true
|
42
|
+
},
|
43
|
+
requested_scopes: {
|
44
|
+
default: 'launch openid fhirUser offline_access user/*.rs'
|
41
45
|
}
|
42
46
|
}
|
43
47
|
)
|
48
|
+
|
49
|
+
test from: :smart_app_redirect_stu2 do
|
50
|
+
input :launch
|
51
|
+
end
|
52
|
+
|
53
|
+
redirect_index = children.find_index { |child| child.id.to_s.end_with? 'app_redirect' }
|
54
|
+
children[redirect_index] = children.pop
|
44
55
|
end
|
45
56
|
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html lang="en">
|
3
|
+
<head>
|
4
|
+
<!-- Use the highest supported document mode of Internet Explorer -->
|
5
|
+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
6
|
+
|
7
|
+
<meta charset="utf-8" />
|
8
|
+
<title>Inferno POST Authorization Redirect</title>
|
9
|
+
</head>
|
10
|
+
<body>
|
11
|
+
<noscript>You need to enable JavaScript to run this app.</noscript>
|
12
|
+
<form id="form" style="display:none;">
|
13
|
+
</form>
|
14
|
+
</body>
|
15
|
+
<script>
|
16
|
+
const params = Object.fromEntries(new URLSearchParams(window.location.search).entries());
|
17
|
+
const submitUrl = params.auth_url;
|
18
|
+
delete params.auth_url;
|
19
|
+
const form = document.getElementById('form');
|
20
|
+
form.method = 'POST';
|
21
|
+
form.action = submitUrl;
|
22
|
+
|
23
|
+
for (const property in params) {
|
24
|
+
let input = document.createElement('input');
|
25
|
+
input.setAttribute('name', property);
|
26
|
+
|
27
|
+
let value = params[property].replace(/\+/g, ' ');
|
28
|
+
input.setAttribute('value', decodeURIComponent(value));
|
29
|
+
|
30
|
+
form.appendChild(input);
|
31
|
+
}
|
32
|
+
|
33
|
+
form.submit();
|
34
|
+
</script>
|
35
|
+
</html>
|
@@ -21,9 +21,15 @@ module SMARTAppLaunch
|
|
21
21
|
request.query_parameters['state']
|
22
22
|
end
|
23
23
|
|
24
|
+
@post_auth_page = File.read(File.join(__dir__, 'post_auth.html'))
|
25
|
+
post_auth_handler = proc { [200, {}, [@post_auth_page]] }
|
26
|
+
|
27
|
+
route :get, '/post_auth', post_auth_handler
|
28
|
+
|
24
29
|
config options: {
|
25
|
-
redirect_uri: "#{Inferno::Application['base_url']}/custom/
|
26
|
-
launch_uri: "#{Inferno::Application['base_url']}/custom/
|
30
|
+
redirect_uri: "#{Inferno::Application['base_url']}/custom/smart_stu2/redirect",
|
31
|
+
launch_uri: "#{Inferno::Application['base_url']}/custom/smart_stu2/launch",
|
32
|
+
post_authorization_uri: "#{Inferno::Application['base_url']}/custom/smart_stu2/post_auth"
|
27
33
|
}
|
28
34
|
|
29
35
|
group do
|
@@ -1,3 +1,4 @@
|
|
1
|
+
require_relative 'app_redirect_test_stu2'
|
1
2
|
require_relative 'standalone_launch_group'
|
2
3
|
|
3
4
|
module SMARTAppLaunch
|
@@ -36,8 +37,16 @@ module SMARTAppLaunch
|
|
36
37
|
pkce_code_challenge_method: {
|
37
38
|
default: 'S256',
|
38
39
|
locked: true
|
40
|
+
},
|
41
|
+
requested_scopes: {
|
42
|
+
default: 'launch/patient openid fhirUser offline_access patient/*.rs'
|
39
43
|
}
|
40
44
|
}
|
41
45
|
)
|
46
|
+
|
47
|
+
test from: :smart_app_redirect_stu2
|
48
|
+
|
49
|
+
redirect_index = children.find_index { |child| child.id.to_s.end_with? 'app_redirect' }
|
50
|
+
children[redirect_index] = children.pop
|
42
51
|
end
|
43
52
|
end
|
@@ -43,7 +43,7 @@ module SMARTAppLaunch
|
|
43
43
|
validate_required_fields_present(token_response_body, ['access_token', 'token_type', 'expires_in', 'scope'])
|
44
44
|
validate_token_field_types(token_response_body)
|
45
45
|
validate_token_type(token_response_body)
|
46
|
-
check_for_missing_scopes(requested_scopes, token_response_body)
|
46
|
+
check_for_missing_scopes(requested_scopes, token_response_body) unless config.options[:ignore_missing_scopes_check]
|
47
47
|
|
48
48
|
assert access_token.present?, 'Token response did not contain an access token'
|
49
49
|
assert token_response_body['token_type']&.casecmp('Bearer')&.zero?,
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: smart_app_launch_test_kit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stephen MacVicar
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-08-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: inferno_core
|
@@ -133,6 +133,7 @@ files:
|
|
133
133
|
- LICENSE
|
134
134
|
- lib/smart_app_launch/app_launch_test.rb
|
135
135
|
- lib/smart_app_launch/app_redirect_test.rb
|
136
|
+
- lib/smart_app_launch/app_redirect_test_stu2.rb
|
136
137
|
- lib/smart_app_launch/code_received_test.rb
|
137
138
|
- lib/smart_app_launch/discovery_stu1_group.rb
|
138
139
|
- lib/smart_app_launch/discovery_stu2_group.rb
|
@@ -147,6 +148,7 @@ files:
|
|
147
148
|
- lib/smart_app_launch/openid_retrieve_jwks_test.rb
|
148
149
|
- lib/smart_app_launch/openid_token_header_test.rb
|
149
150
|
- lib/smart_app_launch/openid_token_payload_test.rb
|
151
|
+
- lib/smart_app_launch/post_auth.html
|
150
152
|
- lib/smart_app_launch/smart_stu1_suite.rb
|
151
153
|
- lib/smart_app_launch/smart_stu2_suite.rb
|
152
154
|
- lib/smart_app_launch/standalone_launch_group.rb
|
@@ -169,7 +171,7 @@ licenses:
|
|
169
171
|
metadata:
|
170
172
|
homepage_uri: https://github.com/inferno_framework/smart-app-launch-test-kit
|
171
173
|
source_code_uri: https://github.com/inferno_framework/smart-app-launch-test-kit
|
172
|
-
post_install_message:
|
174
|
+
post_install_message:
|
173
175
|
rdoc_options: []
|
174
176
|
require_paths:
|
175
177
|
- lib
|
@@ -185,7 +187,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
185
187
|
version: '0'
|
186
188
|
requirements: []
|
187
189
|
rubygems_version: 3.1.6
|
188
|
-
signing_key:
|
190
|
+
signing_key:
|
189
191
|
specification_version: 4
|
190
192
|
summary: Inferno Tests for the SMART Application Launch Framework Implementation Guide
|
191
193
|
test_files: []
|