nsIAuthInformation.idl 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  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 "nsISupports.idl"
  5. /**
  6. * A object that hold authentication information. The caller of
  7. * nsIAuthPrompt2::promptUsernameAndPassword or
  8. * nsIAuthPrompt2::promptPasswordAsync provides an object implementing this
  9. * interface; the prompt implementation can then read the values here to prefill
  10. * the dialog. After the user entered the authentication information, it should
  11. * set the attributes of this object to indicate to the caller what was entered
  12. * by the user.
  13. */
  14. [scriptable, uuid(0d73639c-2a92-4518-9f92-28f71fea5f20)]
  15. interface nsIAuthInformation : nsISupports
  16. {
  17. /** @name Flags */
  18. /* @{ */
  19. /**
  20. * This dialog belongs to a network host.
  21. */
  22. const uint32_t AUTH_HOST = 1;
  23. /**
  24. * This dialog belongs to a proxy.
  25. */
  26. const uint32_t AUTH_PROXY = 2;
  27. /**
  28. * This dialog needs domain information. The user interface should show a
  29. * domain field, prefilled with the domain attribute's value.
  30. */
  31. const uint32_t NEED_DOMAIN = 4;
  32. /**
  33. * This dialog only asks for password information. Authentication prompts
  34. * SHOULD NOT show a username field. Attempts to change the username field
  35. * will have no effect. nsIAuthPrompt2 implementations should, however, show
  36. * its initial value to the user in some form. For example, a paragraph in
  37. * the dialog might say "Please enter your password for user jsmith at
  38. * server intranet".
  39. *
  40. * This flag is mutually exclusive with #NEED_DOMAIN.
  41. */
  42. const uint32_t ONLY_PASSWORD = 8;
  43. /**
  44. * We have already tried to log in for this channel
  45. * (with auth values from a previous promptAuth call),
  46. * but it failed, so we now ask the user to provide a new, correct login.
  47. *
  48. * @see also RFC 2616, Section 10.4.2
  49. */
  50. const uint32_t PREVIOUS_FAILED = 16;
  51. /**
  52. * A cross-origin sub-resource requests an authentication.
  53. * The message presented to users must reflect that.
  54. */
  55. const uint32_t CROSS_ORIGIN_SUB_RESOURCE = 32;
  56. /* @} */
  57. /**
  58. * Flags describing this dialog. A bitwise OR of the flag values
  59. * above.
  60. *
  61. * It is possible that neither #AUTH_HOST nor #AUTH_PROXY are set.
  62. *
  63. * Auth prompts should ignore flags they don't understand; especially, they
  64. * should not throw an exception because of an unsupported flag.
  65. */
  66. readonly attribute unsigned long flags;
  67. /**
  68. * The server-supplied realm of the authentication as defined in RFC 2617.
  69. * Can be the empty string if the protocol does not support realms.
  70. * Otherwise, this is a human-readable string like "Secret files".
  71. */
  72. readonly attribute AString realm;
  73. /**
  74. * The authentication scheme used for this request, if applicable. If the
  75. * protocol for this authentication does not support schemes, this will be
  76. * the empty string. Otherwise, this will be a string such as "basic" or
  77. * "digest". This string will always be in lowercase.
  78. */
  79. readonly attribute AUTF8String authenticationScheme;
  80. /**
  81. * The initial value should be used to prefill the dialog or be shown
  82. * in some other way to the user.
  83. * On return, this parameter should contain the username entered by
  84. * the user.
  85. * This field can only be changed if the #ONLY_PASSWORD flag is not set.
  86. */
  87. attribute AString username;
  88. /**
  89. * The initial value should be used to prefill the dialog or be shown
  90. * in some other way to the user.
  91. * The password should not be shown in clear.
  92. * On return, this parameter should contain the password entered by
  93. * the user.
  94. */
  95. attribute AString password;
  96. /**
  97. * The initial value should be used to prefill the dialog or be shown
  98. * in some other way to the user.
  99. * On return, this parameter should contain the domain entered by
  100. * the user.
  101. * This attribute is only used if flags include #NEED_DOMAIN.
  102. */
  103. attribute AString domain;
  104. };