Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

227 lines
6.2 KiB

  1. /*++
  2. Copyright (c) 2000 Microsoft Corporation
  3. Module Name:
  4. passport.h
  5. Abstract:
  6. WinInet/WinHttp- Passport Auenthtication Package Interface.
  7. Author:
  8. Biao Wang (biaow) 01-Oct-2000
  9. --*/
  10. #ifndef PASSPORT_H
  11. #define PASSPORT_H
  12. extern BOOL g_fIgnoreCachedCredsForPassport;
  13. extern BOOL g_fCurrentProcessLoggedOn;
  14. extern WCHAR g_szUserNameLoggedOn[128]; // 128 = INTERNET_MAX_USER_NAME_LENGTH, defined in wininet.h
  15. typedef void* PP_CONTEXT;
  16. typedef void* PP_LOGON_CONTEXT;
  17. //
  18. // Passport related error codes
  19. //
  20. // generic internal error
  21. #define PP_GENERIC_ERROR -1 // biaow-todo: GetLastError() to return more specific error codes
  22. // generic async error
  23. #define PP_REQUEST_PENDING -9
  24. //
  25. // return codes from PP_Logon
  26. //
  27. #define PP_LOGON_SUCCESS 0
  28. #define PP_LOGON_FAILED 1
  29. #define PP_LOGON_REQUIRED 2
  30. //
  31. // return codes from PP_GetReturnVerbAndUrl
  32. //
  33. #define PP_RETURN_KEEP_VERB 1
  34. #define PP_RETURN_USE_GET 0
  35. #define PFN_LOGON_CALLBACK PVOID // biaow-todo: define the async callback prototype
  36. struct PRIVACY_EVENT
  37. {
  38. LIST_ENTRY List;
  39. DWORD dwStatus;
  40. PVOID lpvInfo;
  41. DWORD dwInfoLength;
  42. };
  43. //
  44. // Passport Context routines
  45. //
  46. PP_CONTEXT
  47. PP_InitContext(
  48. IN PCWSTR pwszHttpStack, // "WinInet.dll" or "WinHttp5.dll"
  49. IN HINTERNET hSession // An existing session (i.e. hInternet) returned by InternetOpen()
  50. // or WinHttpOpen(); hSession must compatible with pwszHttpStack.
  51. // (e.g.WinInet.Dll<->InternetOpen() or WinHttp5.Dll<->WinHttpOpen() )
  52. );
  53. VOID
  54. PP_FreeContext(
  55. IN PP_CONTEXT hPP
  56. );
  57. BOOL
  58. PP_GetRealm(
  59. IN PP_CONTEXT hPP,
  60. IN PWSTR pwszDARealm, // user supplied buffer ...
  61. IN OUT PDWORD pdwDARealmLen // ... and length (will be updated to actual length
  62. // on successful return)
  63. );
  64. //
  65. // Passport Logon Context routines
  66. //
  67. PP_LOGON_CONTEXT
  68. PP_InitLogonContext(
  69. IN PP_CONTEXT hPP,
  70. IN PCWSTR pwszPartnerInfo, // i.e. "WWW-Authenticate: Passport1.4 ..." from partner
  71. // site's 302 re-direct
  72. IN DWORD dwParentFlags
  73. );
  74. DWORD
  75. PP_Logon(
  76. IN PP_LOGON_CONTEXT hPPLogon,
  77. IN BOOL fAnonymous,
  78. IN HANDLE hEvent, // biaow-todo: async
  79. IN PFN_LOGON_CALLBACK pfnLogonCallback,// biaow-todo: async
  80. IN DWORD dwContext // biaow-todo: async
  81. );
  82. PLIST_ENTRY
  83. PP_GetPrivacyEvents(
  84. IN PP_LOGON_CONTEXT hPPLogon
  85. );
  86. // -- This method should be called when PP_Logon() returns PP_LOGON_REQUIRED
  87. // -- (i.e. 401 from a Passport DA)
  88. BOOL
  89. PP_GetChallengeInfo(
  90. IN PP_LOGON_CONTEXT hPPLogon,
  91. OUT HBITMAP* phBitmap, // can be NULL; if not NULL, ownership of the bitmap
  92. // is not transferred to the user
  93. OUT PBOOL pfPrompt,
  94. IN PWSTR pwszCbText,
  95. IN OUT PDWORD pdwTextLen,
  96. IN PWSTR pwszRealm,
  97. IN DWORD dwMaxRealmLen,
  98. PWSTR pwszReqUserName,
  99. PDWORD pdwReqUserNameLen
  100. );
  101. BOOL
  102. PP_GetChallengeContent(
  103. IN PP_LOGON_CONTEXT hPPLogon,
  104. IN PBYTE pContent,
  105. IN OUT PDWORD pdwContentLen
  106. );
  107. // -- if the credentials are NULL/NULL, the means the default creds will be used
  108. // -- if default creds can not be retrieved, this method will return FALSE
  109. BOOL
  110. PP_SetCredentials(
  111. IN PP_LOGON_CONTEXT hPPLogon,
  112. IN PCWSTR pwszRealm,
  113. IN PCWSTR pwszTarget, // optional if user/pass are known (not null)
  114. IN PCWSTR pwszSignIn, // can be NULL
  115. IN PCWSTR pwszPassword, // can be NULL
  116. IN PSYSTEMTIME pTimeCredsEntered // ignore if both SignIn and Pass are NULL (should be set to NULL in that case)
  117. );
  118. BOOL
  119. PP_GetLogonHost(
  120. IN PP_LOGON_CONTEXT hPPLogon,
  121. IN PWSTR pwszHostName, // user supplied buffer ...
  122. IN OUT PDWORD pdwHostNameLen // ... and length (will be updated to actual length
  123. );
  124. BOOL
  125. PP_GetAuthorizationInfo(
  126. IN PP_LOGON_CONTEXT hPPLogon,
  127. IN PWSTR pwszTicket, // e.g. "from-PP = ..."
  128. IN OUT PDWORD pdwTicketLen,
  129. OUT PBOOL pfKeepVerb, // if TRUE, no data will be copied into pwszUrl
  130. IN PWSTR pwszUrl, // user supplied buffer ...
  131. IN OUT PDWORD pdwUrlLen // ... and length (will be updated to actual length
  132. // on successful return)
  133. );
  134. // -- biaow-todo: async
  135. VOID
  136. PP_AbortLogon(
  137. IN PP_LOGON_CONTEXT hPPLogon,
  138. IN DWORD dwFlags
  139. );
  140. // -- biaow-todo:
  141. VOID
  142. PP_Logout(
  143. IN PP_LOGON_CONTEXT hPPLogon,
  144. IN DWORD dwFlags
  145. );
  146. VOID
  147. PP_FreeLogonContext(
  148. IN PP_LOGON_CONTEXT hPPLogon
  149. );
  150. BOOL
  151. PP_ForceNexusLookup(
  152. IN PP_LOGON_CONTEXT hPPLogon,
  153. IN BOOL fForce,
  154. IN PWSTR pwszRegUrl, // user supplied buffer ...
  155. IN OUT PDWORD pdwRegUrlLen, // ... and length (will be updated to actual length
  156. // on successful return)
  157. IN PWSTR pwszDARealm, // user supplied buffer ...
  158. IN OUT PDWORD pdwDARealmLen // ... and length (will be updated to actual length
  159. // on successful return)
  160. );
  161. // if either pwszUsername or pwszPassword is not NULL, it must represent a string at least
  162. // INTERNET_MAX_USER_NAME_LENGTH or INTERNET_MAX_PASSWORD_LENGTH chars long, respectively
  163. BOOL
  164. PP_GetCachedCredential(
  165. PP_LOGON_CONTEXT hPP,
  166. IN PWSTR pwszRealm,
  167. IN PWSTR pwszTarget,
  168. OUT PWSTR pwszUsername,
  169. OUT PWSTR pwszPassword
  170. );
  171. #ifdef PP_DEMO
  172. BOOL PP_ContactPartner(
  173. IN PP_CONTEXT hPP,
  174. IN PCWSTR pwszPartnerUrl,
  175. IN PCWSTR pwszVerb,
  176. IN PCWSTR pwszHeaders,
  177. IN PWSTR pwszData,
  178. IN OUT PDWORD pdwDataLength
  179. );
  180. #endif // PP_DEMO
  181. #endif // PASSPORT_H