nsAuthInformationHolder.cpp (1414B)
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 #include "nsAuthInformationHolder.h" 6 7 NS_IMPL_ISUPPORTS(nsAuthInformationHolder, nsIAuthInformation) 8 9 NS_IMETHODIMP 10 nsAuthInformationHolder::GetFlags(uint32_t* aFlags) { 11 *aFlags = mFlags; 12 return NS_OK; 13 } 14 15 NS_IMETHODIMP 16 nsAuthInformationHolder::GetRealm(nsAString& aRealm) { 17 aRealm = mRealm; 18 return NS_OK; 19 } 20 21 NS_IMETHODIMP 22 nsAuthInformationHolder::GetAuthenticationScheme(nsACString& aScheme) { 23 aScheme = mAuthType; 24 return NS_OK; 25 } 26 27 NS_IMETHODIMP 28 nsAuthInformationHolder::GetUsername(nsAString& aUserName) { 29 aUserName = mUser; 30 return NS_OK; 31 } 32 33 NS_IMETHODIMP 34 nsAuthInformationHolder::SetUsername(const nsAString& aUserName) { 35 if (!(mFlags & ONLY_PASSWORD)) mUser = aUserName; 36 return NS_OK; 37 } 38 39 NS_IMETHODIMP 40 nsAuthInformationHolder::GetPassword(nsAString& aPassword) { 41 aPassword = mPassword; 42 return NS_OK; 43 } 44 45 NS_IMETHODIMP 46 nsAuthInformationHolder::SetPassword(const nsAString& aPassword) { 47 mPassword = aPassword; 48 return NS_OK; 49 } 50 51 NS_IMETHODIMP 52 nsAuthInformationHolder::GetDomain(nsAString& aDomain) { 53 aDomain = mDomain; 54 return NS_OK; 55 } 56 57 NS_IMETHODIMP 58 nsAuthInformationHolder::SetDomain(const nsAString& aDomain) { 59 if (mFlags & NEED_DOMAIN) mDomain = aDomain; 60 return NS_OK; 61 }