netwerk/base/src/nsAuthInformationHolder.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/netwerk/base/src/nsAuthInformationHolder.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,46 @@
     1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.7 +
     1.8 +
     1.9 +#ifndef NSAUTHINFORMATIONHOLDER_H_
    1.10 +#define NSAUTHINFORMATIONHOLDER_H_
    1.11 +
    1.12 +#include "nsIAuthInformation.h"
    1.13 +#include "nsString.h"
    1.14 +
    1.15 +class nsAuthInformationHolder : public nsIAuthInformation {
    1.16 +public:
    1.17 +    // aAuthType must be ASCII
    1.18 +    nsAuthInformationHolder(uint32_t aFlags, const nsString& aRealm,
    1.19 +                            const nsCString& aAuthType)
    1.20 +        : mFlags(aFlags), mRealm(aRealm), mAuthType(aAuthType) {}
    1.21 +
    1.22 +    virtual ~nsAuthInformationHolder() {}
    1.23 +
    1.24 +    NS_DECL_ISUPPORTS
    1.25 +    NS_DECL_NSIAUTHINFORMATION
    1.26 +
    1.27 +    const nsString& User() const { return mUser; }
    1.28 +    const nsString& Password() const { return mPassword; }
    1.29 +    const nsString& Domain() const { return mDomain; }
    1.30 +
    1.31 +    /**
    1.32 +     * This method can be used to initialize the username when the
    1.33 +     * ONLY_PASSWORD flag is set.
    1.34 +     */
    1.35 +    void SetUserInternal(const nsString& aUsername) {
    1.36 +      mUser = aUsername;
    1.37 +    }
    1.38 +private:
    1.39 +    nsString mUser;
    1.40 +    nsString mPassword;
    1.41 +    nsString mDomain;
    1.42 +
    1.43 +    uint32_t mFlags;
    1.44 +    nsString mRealm;
    1.45 +    nsCString mAuthType;
    1.46 +};
    1.47 +
    1.48 +
    1.49 +#endif

mercurial