#include "net/http/http_auth_controller.h"
#include <utility>
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/metrics/histogram_macros.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "base/threading/platform_thread.h"
#include "base/values.h"
#include "net/base/auth.h"
#include "net/base/url_util.h"
#include "net/dns/host_resolver.h"
#include "net/http/http_auth_handler.h"
#include "net/http/http_auth_handler_factory.h"
#include "net/http/http_network_session.h"
#include "net/http/http_request_headers.h"
#include "net/http/http_request_info.h"
#include "net/http/http_response_headers.h"
#include "net/log/net_log_event_type.h"
#include "net/log/net_log_source.h"
#include "net/log/net_log_source_type.h"
#include "net/log/net_log_with_source.h"
#include "url/scheme_host_port.h"
namespace net {
namespace {
enum AuthEvent { … };
enum AuthTarget { … };
AuthTarget DetermineAuthTarget(const HttpAuthHandler* handler) { … }
void HistogramAuthEvent(HttpAuthHandler* handler, AuthEvent auth_event) { … }
base::Value::Dict ControllerParamsToValue(HttpAuth::Target target,
const GURL& url) { … }
}
HttpAuthController::HttpAuthController(
HttpAuth::Target target,
const GURL& auth_url,
const NetworkAnonymizationKey& network_anonymization_key,
HttpAuthCache* http_auth_cache,
HttpAuthHandlerFactory* http_auth_handler_factory,
HostResolver* host_resolver)
: … { … }
HttpAuthController::~HttpAuthController() { … }
void HttpAuthController::BindToCallingNetLog(
const NetLogWithSource& caller_net_log) { … }
int HttpAuthController::MaybeGenerateAuthToken(
const HttpRequestInfo* request,
CompletionOnceCallback callback,
const NetLogWithSource& caller_net_log) { … }
bool HttpAuthController::SelectPreemptiveAuth(
const NetLogWithSource& caller_net_log) { … }
void HttpAuthController::AddAuthorizationHeader(
HttpRequestHeaders* authorization_headers) { … }
int HttpAuthController::HandleAuthChallenge(
scoped_refptr<HttpResponseHeaders> headers,
const SSLInfo& ssl_info,
bool do_not_send_server_auth,
bool establishing_tunnel,
const NetLogWithSource& caller_net_log) { … }
void HttpAuthController::ResetAuth(const AuthCredentials& credentials) { … }
bool HttpAuthController::HaveAuthHandler() const { … }
bool HttpAuthController::HaveAuth() const { … }
bool HttpAuthController::NeedsHTTP11() const { … }
void HttpAuthController::InvalidateCurrentHandler(
InvalidateHandlerAction action) { … }
void HttpAuthController::InvalidateRejectedAuthFromCache() { … }
void HttpAuthController::PrepareIdentityForReuse() { … }
bool HttpAuthController::SelectNextAuthIdentityToTry() { … }
void HttpAuthController::PopulateAuthChallenge() { … }
int HttpAuthController::HandleGenerateTokenResult(int result) { … }
void HttpAuthController::OnGenerateAuthTokenDone(int result) { … }
void HttpAuthController::TakeAuthInfo(std::optional<AuthChallengeInfo>* other) { … }
bool HttpAuthController::IsAuthSchemeDisabled(HttpAuth::Scheme scheme) const { … }
void HttpAuthController::DisableAuthScheme(HttpAuth::Scheme scheme) { … }
void HttpAuthController::DisableEmbeddedIdentity() { … }
void HttpAuthController::OnConnectionClosed() { … }
}