Thu, 15 Jan 2015 21:03:48 +0100
Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)
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