| 729 | } |
| 730 | |
| 731 | static bool TrustedDomainCheck(ThriftServer::ConnectionContext* connection_context, |
| 732 | const AuthenticationHash& hash, const std::string& origin, |
| 733 | const string& auth_header) { |
| 734 | if (!IsTrustedDomain(origin, FLAGS_trusted_domain, |
| 735 | FLAGS_trusted_domain_strict_localhost)) { |
| 736 | return false; |
| 737 | } |
| 738 | |
| 739 | if (!GetUsernameFromBasicAuthHeader(connection_context, auth_header)) { |
| 740 | return false; |
| 741 | } |
| 742 | // Create a cookie to return. |
| 743 | connection_context->return_headers.push_back( |
| 744 | Substitute("Set-Cookie: $0", |
| 745 | GenerateCookie(connection_context->username, hash, |
| 746 | HTTP_AUTH_MECH_TRUSTED_DOMAIN))); |
| 747 | return true; |
| 748 | } |
| 749 | |
| 750 | static bool HandleTrustedAuthHeader(ThriftServer::ConnectionContext* connection_context, |
| 751 | const AuthenticationHash& hash, const string& auth_header) { |
no test coverage detected