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.

176 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 "WinHttp5.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 WinHttp5.Dll<->WinHttpOpen() )
  42. );
  43. VOID
  44. PP_FreeContext(
  45. IN PP_CONTEXT hPP
  46. );
  47. //
  48. // Passport Logon Context routines
  49. //
  50. PP_LOGON_CONTEXT
  51. PP_InitLogonContext(
  52. IN PP_CONTEXT hPP,
  53. IN PCWSTR pwszPartnerInfo, // i.e. "WWW-Authenticate: Passport1.4 ..." from partner
  54. // site's 302 re-direct
  55. IN DWORD dwParentFlags
  56. );
  57. DWORD
  58. PP_Logon(
  59. IN PP_LOGON_CONTEXT hPPLogon,
  60. IN HANDLE hEvent, // biaow-todo: async
  61. IN PFN_LOGON_CALLBACK pfnLogonCallback,// biaow-todo: async
  62. IN DWORD dwContext // biaow-todo: async
  63. );
  64. // -- This method should be called when PP_Logon() returns PP_LOGON_REQUIRED
  65. // -- (i.e. 401 from a Passport DA)
  66. BOOL
  67. PP_GetChallengeInfo(
  68. IN PP_LOGON_CONTEXT hPPLogon,
  69. OUT HBITMAP** ppBitmap, // can be NULL; if not NULL, ownership of the bitmap
  70. // is not transferred to the user
  71. OUT PBOOL pfPrompt,
  72. IN PWSTR pwszCbText,
  73. IN OUT PDWORD pdwTextLen,
  74. IN PWSTR pwszRealm,
  75. IN DWORD dwMaxRealmLen
  76. );
  77. // -- if the credentials are NULL/NULL, the means the default creds will be used
  78. // -- if default creds can not be retrieved, this method will return FALSE
  79. BOOL
  80. PP_SetCredentials(
  81. IN PP_LOGON_CONTEXT hPPLogon,
  82. IN PCWSTR pwszRealm,
  83. IN PCWSTR pwszTarget, // optional if user/pass are known (not null)
  84. IN PCWSTR pwszSignIn, // can be NULL
  85. IN PCWSTR pwszPassword // can be NULL
  86. );
  87. BOOL
  88. PP_GetLogonHost(
  89. IN PP_LOGON_CONTEXT hPPLogon,
  90. IN PWSTR pwszHostName, // user supplied buffer ...
  91. IN OUT PDWORD pdwHostNameLen // ... and length (will be updated to actual length
  92. );
  93. BOOL
  94. PP_GetAuthorizationInfo(
  95. IN PP_LOGON_CONTEXT hPPLogon,
  96. IN PWSTR pwszTicket, // e.g. "from-PP = ..."
  97. IN OUT PDWORD pdwTicketLen,
  98. OUT PBOOL pfKeepVerb, // if TRUE, no data will be copied into pwszUrl
  99. IN PWSTR pwszUrl, // user supplied buffer ...
  100. IN OUT PDWORD pdwUrlLen // ... and length (will be updated to actual length
  101. // on successful return)
  102. );
  103. // -- biaow-todo: async
  104. VOID
  105. PP_AbortLogon(
  106. IN PP_LOGON_CONTEXT hPPLogon,
  107. IN DWORD dwFlags
  108. );
  109. // -- biaow-todo:
  110. VOID
  111. PP_Logout(
  112. IN PP_CONTEXT hPP,
  113. IN DWORD dwFlags
  114. );
  115. VOID
  116. PP_FreeLogonContext(
  117. IN PP_LOGON_CONTEXT hPPLogon
  118. );
  119. BOOL
  120. PP_ForceNexusLookup(
  121. IN PP_LOGON_CONTEXT hPPLogon,
  122. IN PWSTR pwszRegUrl, // user supplied buffer ...
  123. IN OUT PDWORD pdwRegUrlLen, // ... and length (will be updated to actual length
  124. // on successful return)
  125. IN PWSTR pwszDARealm, // user supplied buffer ...
  126. IN OUT PDWORD pdwDARealmLen // ... and length (will be updated to actual length
  127. // on successful return)
  128. );
  129. #ifdef PP_DEMO
  130. BOOL PP_ContactPartner(
  131. IN PP_CONTEXT hPP,
  132. IN PCWSTR pwszPartnerUrl,
  133. IN PCWSTR pwszVerb,
  134. IN PCWSTR pwszHeaders,
  135. IN PWSTR pwszData,
  136. IN OUT PDWORD pdwDataLength
  137. );
  138. #endif // PP_DEMO
  139. #endif // PASSPORT_H