|
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 public: |
|
14 // aAuthType must be ASCII |
|
15 nsAuthInformationHolder(uint32_t aFlags, const nsString& aRealm, |
|
16 const nsCString& aAuthType) |
|
17 : mFlags(aFlags), mRealm(aRealm), mAuthType(aAuthType) {} |
|
18 |
|
19 virtual ~nsAuthInformationHolder() {} |
|
20 |
|
21 NS_DECL_ISUPPORTS |
|
22 NS_DECL_NSIAUTHINFORMATION |
|
23 |
|
24 const nsString& User() const { return mUser; } |
|
25 const nsString& Password() const { return mPassword; } |
|
26 const nsString& Domain() const { return mDomain; } |
|
27 |
|
28 /** |
|
29 * This method can be used to initialize the username when the |
|
30 * ONLY_PASSWORD flag is set. |
|
31 */ |
|
32 void SetUserInternal(const nsString& aUsername) { |
|
33 mUser = aUsername; |
|
34 } |
|
35 private: |
|
36 nsString mUser; |
|
37 nsString mPassword; |
|
38 nsString mDomain; |
|
39 |
|
40 uint32_t mFlags; |
|
41 nsString mRealm; |
|
42 nsCString mAuthType; |
|
43 }; |
|
44 |
|
45 |
|
46 #endif |