Class: SMARTAppLaunch::AppRedirectTest

Inherits:
Inferno::Test
  • Object
show all
Defined in:
lib/smart_app_launch/app_redirect_test.rb

Direct Known Subclasses

AppRedirectTestSTU2

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.calculate_s256_challenge(verifier) ⇒ Object



52
53
54
# File 'lib/smart_app_launch/app_redirect_test.rb', line 52

def self.calculate_s256_challenge(verifier)
  Base64.urlsafe_encode64(Digest::SHA256.digest(verifier), padding: false)
end

Instance Method Details

#audObject



56
57
58
# File 'lib/smart_app_launch/app_redirect_test.rb', line 56

def aud
  url
end

#authorization_url_builder(url, params) ⇒ Object



75
76
77
78
79
80
81
82
83
84
# File 'lib/smart_app_launch/app_redirect_test.rb', line 75

def authorization_url_builder(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

#wait_message(auth_url) ⇒ Object



60
61
62
63
64
65
66
67
68
69
70
71
72
73
# File 'lib/smart_app_launch/app_redirect_test.rb', line 60

def wait_message(auth_url)
  if config.options[:redirect_message_proc].present?
    return instance_exec(auth_url, &config.options[: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
    `#{config.options[:redirect_uri]}` with a state of `#{state}`.
  )
end