Class: UDAPSecurityTestKit::AuthorizationCodeRedirectTest

Inherits:
Inferno::Test
  • Object
show all
Defined in:
lib/udap_security_test_kit/authorization_code_redirect_test.rb

Instance Method Summary collapse

Instance Method Details

#authorization_url_builder(url, params) ⇒ Object



77
78
79
80
81
82
83
84
85
86
# File 'lib/udap_security_test_kit/authorization_code_redirect_test.rb', line 77

def authorization_url_builder(url, params)
  uri = URI(url)

  # because the URL might have parameters on it
  original_parameters = URI.decode_www_form(uri.query || '').to_h
  new_params = original_parameters.merge(params)

  uri.query = URI.encode_www_form(new_params)
  uri.to_s
end

#wait_message(auth_url) ⇒ Object



62
63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/udap_security_test_kit/authorization_code_redirect_test.rb', line 62

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 auth server](#{auth_url}).

    Tests will resume once Inferno receives a request at
    `#{config.options[:redirect_uri]}` with a state of `#{udap_authorization_code_state}`.
  )
end