#include "net/http/http_auth_ntlm_mechanism.h"
#include <string_view>
#include "base/base64.h"
#include "base/containers/span.h"
#include "base/logging.h"
#include "base/rand_util.h"
#include "base/time/time.h"
#include "net/base/net_errors.h"
#include "net/base/network_interfaces.h"
#include "net/http/http_auth_challenge_tokenizer.h"
#include "net/http/http_auth_multi_round_parse.h"
#include "net/http/http_auth_preferences.h"
#include "net/http/http_auth_scheme.h"
namespace net {
namespace {
uint64_t GetMSTime() { … }
void GenerateRandom(base::span<uint8_t> output) { … }
HttpAuthNtlmMechanism::GetMSTimeProc g_get_ms_time_proc = …;
HttpAuthNtlmMechanism::GenerateRandomProc g_generate_random_proc = …;
HttpAuthNtlmMechanism::HostNameProc g_host_name_proc = …;
template <typename T>
T SwapOut(T* target, T source) { … }
int SetAuthTokenFromBinaryToken(std::string* auth_token,
const std::vector<uint8_t>& next_token) { … }
}
HttpAuthNtlmMechanism::ScopedProcSetter::ScopedProcSetter(
GetMSTimeProc ms_time_proc,
GenerateRandomProc random_proc,
HostNameProc host_name_proc) { … }
HttpAuthNtlmMechanism::ScopedProcSetter::~ScopedProcSetter() { … }
HttpAuthNtlmMechanism::HttpAuthNtlmMechanism(
const HttpAuthPreferences* http_auth_preferences)
: … { … }
HttpAuthNtlmMechanism::~HttpAuthNtlmMechanism() = default;
bool HttpAuthNtlmMechanism::Init(const NetLogWithSource& net_log) { … }
bool HttpAuthNtlmMechanism::NeedsIdentity() const { … }
bool HttpAuthNtlmMechanism::AllowsExplicitCredentials() const { … }
HttpAuth::AuthorizationResult HttpAuthNtlmMechanism::ParseChallenge(
HttpAuthChallengeTokenizer* tok) { … }
int HttpAuthNtlmMechanism::GenerateAuthToken(
const AuthCredentials* credentials,
const std::string& spn,
const std::string& channel_bindings,
std::string* auth_token,
const NetLogWithSource& net_log,
CompletionOnceCallback callback) { … }
void HttpAuthNtlmMechanism::SetDelegation(
HttpAuth::DelegationType delegation_type) { … }
}