tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

nsAuthInformationHolder.h (1214B)


      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 #ifndef NSAUTHINFORMATIONHOLDER_H_
      6 #define NSAUTHINFORMATIONHOLDER_H_
      7 
      8 #include "nsIAuthInformation.h"
      9 #include "nsString.h"
     10 
     11 class nsAuthInformationHolder : public nsIAuthInformation {
     12 protected:
     13  virtual ~nsAuthInformationHolder() = default;
     14 
     15 public:
     16  // aAuthType must be ASCII
     17  nsAuthInformationHolder(uint32_t aFlags, const nsString& aRealm,
     18                          const nsACString& aAuthType)
     19      : mFlags(aFlags), mRealm(aRealm), mAuthType(aAuthType) {}
     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) { mUser = aUsername; }
     33 
     34 private:
     35  nsString mUser;
     36  nsString mPassword;
     37  nsString mDomain;
     38 
     39  uint32_t mFlags;
     40  nsString mRealm;
     41  nsCString mAuthType;
     42 };
     43 
     44 #endif