Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
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/. */
6 #ifndef NSAUTHINFORMATIONHOLDER_H_
7 #define NSAUTHINFORMATIONHOLDER_H_
9 #include "nsIAuthInformation.h"
10 #include "nsString.h"
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) {}
19 virtual ~nsAuthInformationHolder() {}
21 NS_DECL_ISUPPORTS
22 NS_DECL_NSIAUTHINFORMATION
24 const nsString& User() const { return mUser; }
25 const nsString& Password() const { return mPassword; }
26 const nsString& Domain() const { return mDomain; }
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;
40 uint32_t mFlags;
41 nsString mRealm;
42 nsCString mAuthType;
43 };
46 #endif