Class: DaVinciPDexTestKit::PDexPayerClient::MockUdapSmartServer::TokenEndpoint
- Inherits:
-
Inferno::DSL::SuiteEndpoint
- Object
- Inferno::DSL::SuiteEndpoint
- DaVinciPDexTestKit::PDexPayerClient::MockUdapSmartServer::TokenEndpoint
show all
- Includes:
- URLs, SMARTAppLaunch::MockSMARTServer::SMARTTokenResponseCreation, UDAPSecurityTestKit::MockUDAPServer::UDAPTokenResponseCreation
- Defined in:
- lib/davinci_pdex_test_kit/pdex_payer_client/mock_udap_smart_server/token_endpoint.rb
Constant Summary
Constants included
from URLs
URLs::AUTHORIZATION_PATH, URLs::BASE_FHIR_PATH, URLs::BINARY_PATH, URLs::EVERYTHING_PATH, URLs::EXPORT_PATH, URLs::EXPORT_STATUS_PATH, URLs::INSTANCE_PATH, URLs::MEMBER_MATCH_PATH, URLs::METADATA_PATH, URLs::PATIENT_INSTANCE_PATH, URLs::PATIENT_PATH, URLs::RESOURCE_PATH, URLs::RESUME_CLINICAL_DATA_PATH, URLs::RESUME_FAIL_PATH, URLs::RESUME_PASS_PATH, URLs::TOKEN_PATH
Instance Method Summary
collapse
Methods included from URLs
#base_url, #client_fhir_base_url, #fhir_base_url, #suite_id
Instance Method Details
#make_response ⇒ Object
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
# File 'lib/davinci_pdex_test_kit/pdex_payer_client/mock_udap_smart_server/token_endpoint.rb', line 28
def make_response
if request.params[:udap].present?
case request.params[:grant_type]
when UDAPSecurityTestKit::CLIENT_CREDENTIALS_TAG
make_udap_client_credential_token_response
when UDAPSecurityTestKit::AUTHORIZATION_CODE_TAG
make_udap_authorization_code_token_response
when UDAPSecurityTestKit::REFRESH_TOKEN_TAG
make_udap_refresh_token_response
else
UDAPSecurityTestKit::MockUDAPServer.update_response_for_invalid_assertion(
response,
"unsupported grant_type: #{request.params[:grant_type]}"
)
end
else
if request.params[:grant_type] == SMARTAppLaunch::CLIENT_CREDENTIALS_TAG
return make_smart_client_credential_token_response
end
suite_options_list = Inferno::Repositories::TestSessions.new.find(result.test_session_id)&.suite_options
suite_options_hash = suite_options_list&.map { |option| [option.id, option.value] }&.to_h
smart_authentication_approach =
SMARTAppLaunch::SMARTClientOptions.smart_authentication_approach(suite_options_hash)
case request.params[:grant_type]
when SMARTAppLaunch::AUTHORIZATION_CODE_TAG
make_smart_authorization_code_token_response(smart_authentication_approach)
when SMARTAppLaunch::REFRESH_TOKEN_TAG
make_smart_refresh_token_response(smart_authentication_approach)
else
SMARTAppLaunch::MockSMARTServer.update_response_for_invalid_assertion(
response,
"unsupported grant_type: #{request.params[:grant_type]}"
)
end
end
end
|
71
72
73
74
75
76
77
78
79
80
81
|
# File 'lib/davinci_pdex_test_kit/pdex_payer_client/mock_udap_smart_server/token_endpoint.rb', line 71
def tags
tags = [UDAPSecurityTestKit::TOKEN_TAG]
tags << (request.params[:udap].present? ? UDAPSecurityTestKit::UDAP_TAG : SMARTAppLaunch::SMART_TAG)
if [UDAPSecurityTestKit::CLIENT_CREDENTIALS_TAG,
UDAPSecurityTestKit::AUTHORIZATION_CODE_TAG,
UDAPSecurityTestKit::REFRESH_TOKEN_TAG].include?(request.params[:grant_type])
tags << request.params[:grant_type]
end
tags
end
|
#test_run_identifier ⇒ Object
15
16
17
18
19
20
21
22
23
24
25
26
|
# File 'lib/davinci_pdex_test_kit/pdex_payer_client/mock_udap_smart_server/token_endpoint.rb', line 15
def test_run_identifier
case request.params[:grant_type]
when UDAPSecurityTestKit::CLIENT_CREDENTIALS_TAG
UDAPSecurityTestKit::MockUDAPServer.client_id_from_client_assertion(request.params[:client_assertion])
when UDAPSecurityTestKit::AUTHORIZATION_CODE_TAG
UDAPSecurityTestKit::MockUDAPServer.issued_token_to_client_id(request.params[:code])
when UDAPSecurityTestKit::REFRESH_TOKEN_TAG
UDAPSecurityTestKit::MockUDAPServer.issued_token_to_client_id(
UDAPSecurityTestKit::MockUDAPServer.refresh_token_to_authorization_code(request.params[:refresh_token])
)
end
end
|
#update_result ⇒ Object
67
68
69
|
# File 'lib/davinci_pdex_test_kit/pdex_payer_client/mock_udap_smart_server/token_endpoint.rb', line 67
def update_result
nil
end
|