Module: DaVinciPASTestKit::SessionIdentification

Instance Method Summary collapse

Instance Method Details

#bearer_token_to_wait_identifier(token) ⇒ Object

interpret the bearer token structure to determine the wait identifer

  • if structured like a token returned by the simulated Auth server, return the client URI

  • otherwise, use the raw token (provided token)



38
39
40
41
42
43
# File 'lib/davinci_pas_test_kit/session_identification.rb', line 38

def bearer_token_to_wait_identifier(token)
  client_id = UDAPSecurityTestKit::MockUDAPServer.issued_token_to_client_id(token)
  return client_id if client_id.present?

  token
end

#session_endpont_url(endpoint, client_id, session_url_path) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/davinci_pas_test_kit/session_identification.rb', line 15

def session_endpont_url(endpoint, client_id, session_url_path)
  path =
    if client_id.present?
      ''
    elsif session_url_path.present?
      session_url_path
    else
      test_session_id
    end

  case endpoint
  when :submit
    session_submit_url(path)
  when :inquire
    session_inquire_url(path)
  when :subscription
    session_fhir_subscription_url(path)
  end
end

#session_wait_identifier(client_id, session_url_path) ⇒ Object



6
7
8
9
10
11
12
13
# File 'lib/davinci_pas_test_kit/session_identification.rb', line 6

def session_wait_identifier(client_id, session_url_path)
  # look at test config and determine the wait identifier to use
  # at somepoint this would be an inferno type, for now, just two options
  return client_id if client_id.present?
  return session_url_path if session_url_path.present?

  test_session_id
end