nsAuthInformationHolder.cpp 1.4 KB

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