Class: SMARTAppLaunch::AppRedirectTest
- Inherits:
-
Inferno::Test
- Object
- Inferno::Test
- SMARTAppLaunch::AppRedirectTest
- Defined in:
- lib/smart_app_launch/app_redirect_test.rb
Direct Known Subclasses
Class Method Summary collapse
Instance Method Summary collapse
- #aud ⇒ Object
- #authorization_url_builder(url, params) ⇒ Object
- #default_redirect_uri ⇒ Object
- #redirect_uri ⇒ Object
- #wait_message(auth_url) ⇒ Object
Class Method Details
.calculate_s256_challenge(verifier) ⇒ Object
28 29 30 |
# File 'lib/smart_app_launch/app_redirect_test.rb', line 28 def self.calculate_s256_challenge(verifier) Base64.urlsafe_encode64(Digest::SHA256.digest(verifier), padding: false) end |
Instance Method Details
#aud ⇒ Object
32 33 34 |
# File 'lib/smart_app_launch/app_redirect_test.rb', line 32 def aud url end |
#authorization_url_builder(url, params) ⇒ Object
51 52 53 54 55 56 57 58 59 60 |
# File 'lib/smart_app_launch/app_redirect_test.rb', line 51 def (url, params) uri = URI(url) # because the URL might have parameters on it original_parameters = Hash[URI.decode_www_form(uri.query || '')] new_params = original_parameters.merge(params) uri.query = URI.encode_www_form(new_params) uri.to_s end |
#default_redirect_uri ⇒ Object
20 21 22 |
# File 'lib/smart_app_launch/app_redirect_test.rb', line 20 def default_redirect_uri "#{Inferno::Application['base_url']}/custom/smart/redirect" end |
#redirect_uri ⇒ Object
24 25 26 |
# File 'lib/smart_app_launch/app_redirect_test.rb', line 24 def redirect_uri config.[:redirect_uri].presence || default_redirect_uri end |
#wait_message(auth_url) ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/smart_app_launch/app_redirect_test.rb', line 36 def (auth_url) if config.[:redirect_message_proc].present? return instance_exec(auth_url, &config.[:redirect_message_proc]) end %( ### #{self.class.parent&.parent&.title} [Follow this link to authorize with the SMART server](#{auth_url}). Tests will resume once Inferno receives a request at `#{redirect_uri}` with a state of `#{state}`. ) end |