/src/mozilla-central/netwerk/base/nsAuthInformationHolder.h
Line | Count | Source (jump to first uncovered line) |
1 | | /* This Source Code Form is subject to the terms of the Mozilla Public |
2 | | * License, v. 2.0. If a copy of the MPL was not distributed with this |
3 | | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
4 | | |
5 | | |
6 | | #ifndef NSAUTHINFORMATIONHOLDER_H_ |
7 | | #define NSAUTHINFORMATIONHOLDER_H_ |
8 | | |
9 | | #include "nsIAuthInformation.h" |
10 | | #include "nsString.h" |
11 | | |
12 | | class nsAuthInformationHolder : public nsIAuthInformation { |
13 | | |
14 | | protected: |
15 | 0 | virtual ~nsAuthInformationHolder() = default; |
16 | | |
17 | | public: |
18 | | // aAuthType must be ASCII |
19 | | nsAuthInformationHolder(uint32_t aFlags, const nsString& aRealm, |
20 | | const nsCString& aAuthType) |
21 | 0 | : mFlags(aFlags), mRealm(aRealm), mAuthType(aAuthType) {} |
22 | | |
23 | | NS_DECL_ISUPPORTS |
24 | | NS_DECL_NSIAUTHINFORMATION |
25 | | |
26 | 0 | const nsString& User() const { return mUser; } |
27 | 0 | const nsString& Password() const { return mPassword; } |
28 | 0 | const nsString& Domain() const { return mDomain; } |
29 | | |
30 | | /** |
31 | | * This method can be used to initialize the username when the |
32 | | * ONLY_PASSWORD flag is set. |
33 | | */ |
34 | 0 | void SetUserInternal(const nsString& aUsername) { |
35 | 0 | mUser = aUsername; |
36 | 0 | } |
37 | | private: |
38 | | nsString mUser; |
39 | | nsString mPassword; |
40 | | nsString mDomain; |
41 | | |
42 | | uint32_t mFlags; |
43 | | nsString mRealm; |
44 | | nsCString mAuthType; |
45 | | }; |
46 | | |
47 | | |
48 | | #endif |