Class: UDAPSecurityTestKit::MockUDAPServer::TokenEndpoint

Inherits:
Inferno::DSL::SuiteEndpoint
  • Object
show all
Includes:
UDAPTokenResponseCreation, URLs
Defined in:
lib/udap_security_test_kit/endpoints/mock_udap_server/token_endpoint.rb

Instance Method Summary collapse

Methods included from URLs

#client_authorization_url, #client_base_url, #client_fhir_base_url, #client_introspection_url, #client_registration_url, #client_resume_fail_url, #client_resume_pass_url, #client_suite_id, #client_token_url, #client_udap_discovery_url

Methods included from UDAPTokenResponseCreation

#make_udap_authorization_code_token_response, #make_udap_client_credential_token_response, #make_udap_refresh_token_response, #udap_authenticated?, #udap_construct_id_token, #udap_pkce_valid?, #udap_registered_scope, #udap_requested_scope_context

Instance Method Details

#make_responseObject



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/udap_security_test_kit/endpoints/mock_udap_server/token_endpoint.rb', line 27

def make_response
  case request.params[:grant_type]
  when CLIENT_CREDENTIALS_TAG
    make_udap_client_credential_token_response
  when AUTHORIZATION_CODE_TAG
    make_udap_authorization_code_token_response
  when REFRESH_TOKEN_TAG
    make_udap_refresh_token_response
  else
    MockUDAPServer.update_response_for_error(
      response,
      "unsupported grant_type: #{request.params[:grant_type]}"
    )
  end
end

#tagsObject



47
48
49
50
51
52
53
# File 'lib/udap_security_test_kit/endpoints/mock_udap_server/token_endpoint.rb', line 47

def tags
  tags = [TOKEN_TAG, UDAP_TAG]
  if [CLIENT_CREDENTIALS_TAG, AUTHORIZATION_CODE_TAG, REFRESH_TOKEN_TAG].include?(request.params[:grant_type])
    tags << request.params[:grant_type]
  end
  tags
end

#test_run_identifierObject



14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/udap_security_test_kit/endpoints/mock_udap_server/token_endpoint.rb', line 14

def test_run_identifier
  case request.params[:grant_type]
  when CLIENT_CREDENTIALS_TAG
    MockUDAPServer.client_id_from_client_assertion(request.params[:client_assertion])
  when AUTHORIZATION_CODE_TAG
    MockUDAPServer.issued_token_to_client_id(request.params[:code])
  when REFRESH_TOKEN_TAG
    MockUDAPServer.issued_token_to_client_id(
      MockUDAPServer.refresh_token_to_authorization_code(request.params[:refresh_token])
    )
  end
end

#update_resultObject



43
44
45
# File 'lib/udap_security_test_kit/endpoints/mock_udap_server/token_endpoint.rb', line 43

def update_result
  nil # never update for now
end