smart_app_launch_test_kit 0.5.0 → 0.5.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 047dcb8643e2524e9bdcd7653db652640f08e672085d18fd589d4a50e717cd08
4
- data.tar.gz: cf7fe4c64a2e9c9bb9e50bcc2176e7ee5a8c5cac6a970376fb29b8d31e50ca96
3
+ metadata.gz: f80a6156d7f541a28a876f54e29a1d7457b84c06feb6aea21d54a499e734ef91
4
+ data.tar.gz: 9f0990127c9bd562c1328e82a53d0c431c08fb3fbb1fbd24735049a40303eaba
5
5
  SHA512:
6
- metadata.gz: 4b0bd4cfc4a2d2db72017cf433482edb59aeb22ea4d538a03a44f14664631d86e9426a4b1b521175673275c7464a0b3f33f673fc488a1b2b9581c5df6a97e7bf
7
- data.tar.gz: a99702f36d6b8501102cadfca039b0f7b6e46e65e19068da1a52971afee24758228fa59f0c3273c6bad730b47f107d80074e5b222bb9dfd5921c35473e423f1e
6
+ metadata.gz: 819be8732a3feed22713a508e3f316101c5cfab62055b68666c94991359c79bc41159086c721b62886c3e38db51305e085ef4ef0dcaed7a9ab615600542a417c
7
+ data.tar.gz: c811a8aaaea089ca2ebaddb559a3ab2fa3ab2a73e2afbcc485e2375654735a6a68ba20fcbc95e0483ba65c83fed367d449289ee79020522887d418e1e9a0a0fb
@@ -10,7 +10,13 @@ module SMARTAppLaunch
10
10
  input :url
11
11
  receives_request :launch
12
12
 
13
- config options: { launch_uri: "#{Inferno::Application['base_url']}/custom/smart/launch" }
13
+ def default_launch_uri
14
+ "#{Inferno::Application['base_url']}/custom/smart/launch"
15
+ end
16
+
17
+ def launch_uri
18
+ config.options[:launch_uri].presence || default_launch_uri
19
+ end
14
20
 
15
21
  def wait_message
16
22
  return instance_exec(&config.options[:launch_message_proc]) if config.options[:launch_message_proc].present?
@@ -21,7 +27,7 @@ module SMARTAppLaunch
21
27
  Waiting for Inferno to be launched from the EHR.
22
28
 
23
29
  Tests will resume once Inferno receives a launch request at
24
- `#{config.options[:launch_uri]}` with an `iss` of `#{url}`.
30
+ `#{launch_uri}` with an `iss` of `#{url}`.
25
31
  )
26
32
  end
27
33
 
@@ -47,7 +47,13 @@ module SMARTAppLaunch
47
47
  output :state, :pkce_code_challenge, :pkce_code_verifier
48
48
  receives_request :redirect
49
49
 
50
- config options: { redirect_uri: "#{Inferno::Application['base_url']}/custom/smart/redirect" }
50
+ def default_redirect_uri
51
+ "#{Inferno::Application['base_url']}/custom/smart/redirect"
52
+ end
53
+
54
+ def redirect_uri
55
+ config.options[:redirect_uri].presence || default_redirect_uri
56
+ end
51
57
 
52
58
  def self.calculate_s256_challenge(verifier)
53
59
  Base64.urlsafe_encode64(Digest::SHA256.digest(verifier), padding: false)
@@ -68,7 +74,7 @@ module SMARTAppLaunch
68
74
  [Follow this link to authorize with the SMART server](#{auth_url}).
69
75
 
70
76
  Tests will resume once Inferno receives a request at
71
- `#{config.options[:redirect_uri]}` with a state of `#{state}`.
77
+ `#{redirect_uri}` with a state of `#{state}`.
72
78
  )
73
79
  end
74
80
 
@@ -94,7 +100,7 @@ module SMARTAppLaunch
94
100
  oauth2_params = {
95
101
  'response_type' => 'code',
96
102
  'client_id' => client_id,
97
- 'redirect_uri' => config.options[:redirect_uri],
103
+ 'redirect_uri' => redirect_uri,
98
104
  'scope' => requested_scopes,
99
105
  'state' => state,
100
106
  'aud' => aud
@@ -32,12 +32,20 @@ module SMARTAppLaunch
32
32
  ]
33
33
  }
34
34
 
35
+ def default_post_authorization_uri
36
+ "#{Inferno::Application['base_url']}/custom/smart_stu2/post_auth"
37
+ end
38
+
39
+ def post_authorization_uri
40
+ config.options[:post_authorization_uri].presence || default_post_authorization_uri
41
+ end
42
+
35
43
  def authorization_url_builder(url, params)
36
44
  return super if authorization_method == 'get'
37
45
 
38
46
  post_params = params.merge(auth_url: url)
39
47
 
40
- post_url = URI(config.options[:post_authorization_uri])
48
+ post_url = URI(post_authorization_uri)
41
49
  post_url.query = URI.encode_www_form(post_params)
42
50
  post_url.to_s
43
51
  end
@@ -36,7 +36,13 @@ module SMARTAppLaunch
36
36
  uses_request :redirect
37
37
  makes_request :token
38
38
 
39
- config options: { redirect_uri: "#{Inferno::Application['base_url']}/custom/smart/redirect" }
39
+ def default_redirect_uri
40
+ "#{Inferno::Application['base_url']}/custom/smart/redirect"
41
+ end
42
+
43
+ def redirect_uri
44
+ config.options[:redirect_uri].presence || default_redirect_uri
45
+ end
40
46
 
41
47
  def add_credentials_to_request(oauth2_params, oauth2_headers)
42
48
  if client_secret.present?
@@ -52,7 +58,7 @@ module SMARTAppLaunch
52
58
 
53
59
  oauth2_params = {
54
60
  code:,
55
- redirect_uri: config.options[:redirect_uri],
61
+ redirect_uri:,
56
62
  grant_type: 'authorization_code'
57
63
  }
58
64
  oauth2_headers = { 'Content-Type' => 'application/x-www-form-urlencoded' }
@@ -1,4 +1,4 @@
1
1
  module SMARTAppLaunch
2
- VERSION = '0.5.0'.freeze
3
- LAST_UPDATED = '2025-02-10'.freeze # TODO: update next release
2
+ VERSION = '0.5.1'.freeze
3
+ LAST_UPDATED = '2025-03-07'.freeze
4
4
  end
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.5.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stephen MacVicar
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-02-10 00:00:00.000000000 Z
11
+ date: 2025-03-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: inferno_core