nsIAuthModule.idl 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. /* vim:set ts=4 sw=4 et cindent: */
  2. /* This Source Code Form is subject to the terms of the Mozilla Public
  3. * License, v. 2.0. If a copy of the MPL was not distributed with this
  4. * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  5. #include "nsISupports.idl"
  6. [uuid(6e35dbc0-49ef-4e2c-b1ea-b72ec64450a2)]
  7. interface nsIAuthModule : nsISupports
  8. {
  9. /**
  10. * Default behavior.
  11. */
  12. const unsigned long REQ_DEFAULT = 0;
  13. /**
  14. * Client and server will be authenticated.
  15. */
  16. const unsigned long REQ_MUTUAL_AUTH = (1 << 0);
  17. /**
  18. * The server is allowed to impersonate the client. The REQ_MUTUAL_AUTH
  19. * flag may also need to be specified in order for this flag to take
  20. * effect.
  21. */
  22. const unsigned long REQ_DELEGATE = (1 << 1);
  23. /**
  24. * The authentication is required for a proxy connection.
  25. */
  26. const unsigned long REQ_PROXY_AUTH = (1 << 2);
  27. /**
  28. * Flags used for telemetry.
  29. */
  30. const unsigned long NTLM_MODULE_SAMBA_AUTH_PROXY = 0;
  31. const unsigned long NTLM_MODULE_SAMBA_AUTH_DIRECT = 1;
  32. const unsigned long NTLM_MODULE_WIN_API_PROXY = 2;
  33. const unsigned long NTLM_MODULE_WIN_API_DIRECT = 3;
  34. const unsigned long NTLM_MODULE_GENERIC_PROXY = 4;
  35. const unsigned long NTLM_MODULE_GENERIC_DIRECT = 5;
  36. const unsigned long NTLM_MODULE_KERBEROS_PROXY = 6;
  37. const unsigned long NTLM_MODULE_KERBEROS_DIRECT = 7;
  38. /** Other flags may be defined in the future */
  39. /**
  40. * Called to initialize an auth module. The other methods cannot be called
  41. * unless this method succeeds.
  42. *
  43. * @param aServiceName
  44. * the service name, which may be null if not applicable (e.g., for
  45. * NTLM, this parameter should be null).
  46. * @param aServiceFlags
  47. * a bitwise-or of the REQ_ flags defined above (pass REQ_DEFAULT
  48. * for default behavior).
  49. * @param aDomain
  50. * the authentication domain, which may be null if not applicable.
  51. * @param aUsername
  52. * the user's login name
  53. * @param aPassword
  54. * the user's password
  55. */
  56. void init(in string aServiceName,
  57. in unsigned long aServiceFlags,
  58. in wstring aDomain,
  59. in wstring aUsername,
  60. in wstring aPassword);
  61. /**
  62. * Called to get the next token in a sequence of authentication steps.
  63. *
  64. * @param aInToken
  65. * A buffer containing the input token (e.g., a challenge from a
  66. * server). This may be null.
  67. * @param aInTokenLength
  68. * The length of the input token.
  69. * @param aOutToken
  70. * If getNextToken succeeds, then aOutToken will point to a buffer
  71. * to be sent in response to the server challenge. The length of
  72. * this buffer is given by aOutTokenLength. The buffer at aOutToken
  73. * must be recycled with a call to free.
  74. * @param aOutTokenLength
  75. * If getNextToken succeeds, then aOutTokenLength contains the
  76. * length of the buffer (number of bytes) pointed to by aOutToken.
  77. */
  78. void getNextToken([const] in voidPtr aInToken,
  79. in unsigned long aInTokenLength,
  80. out voidPtr aOutToken,
  81. out unsigned long aOutTokenLength);
  82. /**
  83. * Once a security context has been established through calls to GetNextToken()
  84. * it may be used to protect data exchanged between client and server. Calls
  85. * to Wrap() are used to protect items of data to be sent to the server.
  86. *
  87. * @param aInToken
  88. * A buffer containing the data to be sent to the server
  89. * @param aInTokenLength
  90. * The length of the input token
  91. * @param confidential
  92. * If set to true, Wrap() will encrypt the data, otherwise data will
  93. * just be integrity protected (checksummed)
  94. * @param aOutToken
  95. * A buffer containing the resulting data to be sent to the server
  96. * @param aOutTokenLength
  97. * The length of the output token buffer
  98. *
  99. * Wrap() may return NS_ERROR_NOT_IMPLEMENTED, if the underlying authentication
  100. * mechanism does not support security layers.
  101. */
  102. void wrap([const] in voidPtr aInToken,
  103. in unsigned long aInTokenLength,
  104. in boolean confidential,
  105. out voidPtr aOutToken,
  106. out unsigned long aOutTokenLength);
  107. /**
  108. * Unwrap() is used to unpack, decrypt, and verify the checksums on data
  109. * returned by a server when security layers are in use.
  110. *
  111. * @param aInToken
  112. * A buffer containing the data received from the server
  113. * @param aInTokenLength
  114. * The length of the input token
  115. * @param aOutToken
  116. * A buffer containing the plaintext data from the server
  117. * @param aOutTokenLength
  118. * The length of the output token buffer
  119. *
  120. * Unwrap() may return NS_ERROR_NOT_IMPLEMENTED, if the underlying
  121. * authentication mechanism does not support security layers.
  122. */
  123. void unwrap([const] in voidPtr aInToken,
  124. in unsigned long aInTokenLength,
  125. out voidPtr aOutToken,
  126. out unsigned long aOutTokenLength);
  127. };
  128. %{C++
  129. /**
  130. * nsIAuthModule implementations are registered under the following contract
  131. * ID prefix:
  132. */
  133. #define NS_AUTH_MODULE_CONTRACTID_PREFIX \
  134. "@mozilla.org/network/auth-module;1?name="
  135. %}