| 27 | } |
| 28 | |
| 29 | std::pair<String, bool> InterserverIOHTTPHandler::checkAuthentication(HTTPServerRequest & request) const |
| 30 | { |
| 31 | auto server_credentials = server.context()->getInterserverCredentials(); |
| 32 | if (server_credentials) |
| 33 | { |
| 34 | if (!request.hasCredentials()) |
| 35 | return server_credentials->isValidUser("", ""); |
| 36 | |
| 37 | String scheme; |
| 38 | String info; |
| 39 | request.getCredentials(scheme, info); |
| 40 | |
| 41 | if (scheme != "Basic") |
| 42 | return {"Server requires HTTP Basic authentication but client provides another method", false}; |
| 43 | |
| 44 | Poco::Net::HTTPBasicCredentials credentials(info); |
| 45 | return server_credentials->isValidUser(credentials.getUsername(), credentials.getPassword()); |
| 46 | } |
| 47 | if (request.hasCredentials()) |
| 48 | { |
| 49 | return {"Client requires HTTP Basic authentication, but server doesn't provide it", false}; |
| 50 | } |
| 51 | |
| 52 | return {"", true}; |
| 53 | } |
| 54 | |
| 55 | void InterserverIOHTTPHandler::processQuery(HTTPServerRequest & request, HTTPServerResponse & response, OutputPtr output) |
| 56 | { |
nothing calls this directly
no test coverage detected