| 1020 | } |
| 1021 | |
| 1022 | TWrappedHttpResponse* ValidateSaml2AuthnResponse( |
| 1023 | ThriftServer::ConnectionContext* connection_context, |
| 1024 | const AuthenticationHash& hash) { |
| 1025 | TWrappedHttpRequest* request = connection_context->request.get(); |
| 1026 | TWrappedHttpResponse* response = connection_context->response.get(); |
| 1027 | DCHECK(request != nullptr); |
| 1028 | DCHECK(response == nullptr); |
| 1029 | response = new TWrappedHttpResponse(); |
| 1030 | connection_context->response.reset(response); |
| 1031 | // Parse the body. |
| 1032 | std::map<string, string*> params_to_check; |
| 1033 | string saml_relay_state; |
| 1034 | params_to_check["RelayState"] = &saml_relay_state; |
| 1035 | string error_msg; |
| 1036 | const string& content = request->content; |
| 1037 | if(!ParseParams(params_to_check, content, content, &error_msg)) { |
| 1038 | LOG(ERROR) << "failed to parse SAML response params: " << error_msg; |
| 1039 | return nullptr; |
| 1040 | } |
| 1041 | StripWhiteSpace(&saml_relay_state); |
| 1042 | request->params["RelayState"] = saml_relay_state; |
| 1043 | // We return some html in case of auth error. TODO: Should handle other |
| 1044 | // errors where no response is generated. |
| 1045 | Status status = |
| 1046 | ExecEnv::GetInstance()->frontend()->ValidateSaml2Response(*request, response); |
| 1047 | return response; |
| 1048 | } |
| 1049 | |
| 1050 | bool ValidateSaml2Bearer(ThriftServer::ConnectionContext* connection_context, |
| 1051 | const AuthenticationHash& hash) { |
nothing calls this directly
no test coverage detected