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.

177 lines
4.7 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. typedef void* PP_CONTEXT;
  13. typedef void* PP_LOGON_CONTEXT;
  14. //
  15. // Passport related error codes
  16. //
  17. // generic internal error
  18. #define PP_GENERIC_ERROR -1 // biaow-todo: GetLastError() to return more specific error codes
  19. // generic async error
  20. #define PP_REQUEST_PENDING -9
  21. //
  22. // return codes from PP_Logon
  23. //
  24. #define PP_LOGON_SUCCESS 0
  25. #define PP_LOGON_FAILED 1
  26. #define PP_LOGON_REQUIRED 2
  27. //
  28. // return codes from PP_GetReturnVerbAndUrl
  29. //
  30. #define PP_RETURN_KEEP_VERB 1
  31. #define PP_RETURN_USE_GET 0
  32. #define PFN_LOGON_CALLBACK PVOID // biaow-todo: define the async callback prototype
  33. //
  34. // Passport Context routines
  35. //
  36. PP_CONTEXT
  37. PP_InitContext(
  38. IN PCWSTR pwszHttpStack, // "WinInet.dll" or "WinHttp.dll"
  39. IN HINTERNET hSession, // An existing session (i.e. hInternet) returned by InternetOpen()
  40. // or WinHttpOpen(); hSession must compatible with pwszHttpStack.
  41. // (e.g.WinInet.Dll<->InternetOpen() or WinHttp.Dll<->WinHttpOpen() )
  42. PCWSTR pwszProxyUser,
  43. PCWSTR pwszProxyPass
  44. );
  45. VOID
  46. PP_FreeContext(
  47. IN PP_CONTEXT hPP
  48. );
  49. //
  50. // Passport Logon Context routines
  51. //
  52. BOOL
  53. PP_GetRealm(
  54. IN PP_CONTEXT hPP,
  55. IN PWSTR pwszDARealm, // user supplied buffer ...
  56. IN OUT PDWORD pdwDARealmLen // ... and length (will be updated to actual length
  57. // on successful return)
  58. );
  59. PP_LOGON_CONTEXT
  60. PP_InitLogonContext(
  61. IN PP_CONTEXT hPP,
  62. IN PCWSTR pwszPartnerInfo, // i.e. "WWW-Authenticate: Passport1.4 ..." from partner
  63. // site's 302 re-direct
  64. IN DWORD dwParentFlags,
  65. IN PCWSTR pwszProxyUser,
  66. IN PCWSTR pwszProxyPass
  67. );
  68. DWORD
  69. PP_Logon(
  70. IN PP_LOGON_CONTEXT hPPLogon,
  71. IN BOOL fAnonymous,
  72. IN HANDLE hEvent, // biaow-todo: async
  73. IN PFN_LOGON_CALLBACK pfnLogonCallback,// biaow-todo: async
  74. IN DWORD dwContext // biaow-todo: async
  75. );
  76. // -- This method should be called when PP_Logon() returns PP_LOGON_REQUIRED
  77. // -- (i.e. 401 from a Passport DA)
  78. BOOL
  79. PP_GetChallengeInfo(
  80. IN PP_LOGON_CONTEXT hPPLogon,
  81. OUT PBOOL pfPrompt,
  82. IN PWSTR pwszCbUrl,
  83. IN OUT PDWORD pdwCbUrlLen,
  84. IN PWSTR pwszCbText,
  85. IN OUT PDWORD pdwTextLen,
  86. IN PWSTR pwszRealm,
  87. IN DWORD dwMaxRealmLen
  88. );
  89. BOOL
  90. PP_GetChallengeContent(
  91. IN PP_LOGON_CONTEXT hPPLogon,
  92. IN PBYTE pContent,
  93. IN OUT PDWORD pdwContentLen
  94. );
  95. // -- if the credentials are NULL/NULL, the means the default creds will be used
  96. // -- if default creds can not be retrieved, this method will return FALSE
  97. BOOL
  98. PP_SetCredentials(
  99. IN PP_LOGON_CONTEXT hPPLogon,
  100. IN PCWSTR pwszRealm,
  101. IN PCWSTR pwszTarget, // optional if user/pass are known (not null)
  102. IN PCWSTR pwszSignIn, // can be NULL
  103. IN PCWSTR pwszPassword, // can be NULL
  104. IN PSYSTEMTIME pTimeCredsEntered // ignore if both SignIn and Pass are NULL (should be set to NULL in that case)
  105. );
  106. BOOL
  107. PP_GetLogonHost(
  108. IN PP_LOGON_CONTEXT hPPLogon,
  109. IN PWSTR pwszHostName, // user supplied buffer ...
  110. IN OUT PDWORD pdwHostNameLen // ... and length (will be updated to actual length
  111. );
  112. BOOL PP_GetEffectiveDAHost(
  113. IN PP_CONTEXT hPP,
  114. IN PWSTR pwszDAUrl, // user supplied buffer ...
  115. IN OUT PDWORD pdwDAUrlLen // ... and length (will be updated to actual length
  116. );
  117. BOOL
  118. PP_GetAuthorizationInfo(
  119. IN PP_LOGON_CONTEXT hPPLogon,
  120. IN PWSTR pwszTicket, // e.g. "from-PP = ..."
  121. IN OUT PDWORD pdwTicketLen,
  122. OUT PBOOL pfKeepVerb, // if TRUE, no data will be copied into pwszUrl
  123. IN PWSTR pwszUrl, // user supplied buffer ...
  124. IN OUT PDWORD pdwUrlLen // ... and length (will be updated to actual length
  125. // on successful return)
  126. );
  127. // -- biaow-todo: async
  128. VOID
  129. PP_AbortLogon(
  130. IN PP_LOGON_CONTEXT hPPLogon,
  131. IN DWORD dwFlags
  132. );
  133. VOID
  134. PP_Logout(
  135. IN PP_CONTEXT hPP,
  136. IN DWORD dwFlags
  137. );
  138. VOID
  139. PP_FreeLogonContext(
  140. IN PP_LOGON_CONTEXT hPPLogon
  141. );
  142. #endif // PASSPORT_H