xref: /aosp_15_r20/external/cronet/net/base/auth.cc (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
1 // Copyright 2011 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #include "net/base/auth.h"
6 
7 namespace net {
8 
9 AuthChallengeInfo::AuthChallengeInfo() = default;
10 
11 AuthChallengeInfo::AuthChallengeInfo(const AuthChallengeInfo& other) = default;
12 
MatchesExceptPath(const AuthChallengeInfo & other) const13 bool AuthChallengeInfo::MatchesExceptPath(
14     const AuthChallengeInfo& other) const {
15   return (is_proxy == other.is_proxy && challenger == other.challenger &&
16           scheme == other.scheme && realm == other.realm &&
17           challenge == other.challenge);
18 }
19 
20 AuthChallengeInfo::~AuthChallengeInfo() = default;
21 
22 AuthCredentials::AuthCredentials() = default;
23 
AuthCredentials(const std::u16string & username,const std::u16string & password)24 AuthCredentials::AuthCredentials(const std::u16string& username,
25                                  const std::u16string& password)
26     : username_(username), password_(password) {}
27 
28 AuthCredentials::~AuthCredentials() = default;
29 
Set(const std::u16string & username,const std::u16string & password)30 void AuthCredentials::Set(const std::u16string& username,
31                           const std::u16string& password) {
32   username_ = username;
33   password_ = password;
34 }
35 
Equals(const AuthCredentials & other) const36 bool AuthCredentials::Equals(const AuthCredentials& other) const {
37   return username_ == other.username_ && password_ == other.password_;
38 }
39 
Empty() const40 bool AuthCredentials::Empty() const {
41   return username_.empty() && password_.empty();
42 }
43 
44 }  // namespace net
45