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.

199 lines
3.4 KiB

  1. #ifndef _ANONYMOUSPROVIDER_HXX_
  2. #define _ANONYMOUSPROVIDER_HXX_
  3. class AUTH_PROVIDER;
  4. class ANONYMOUS_USER_CONTEXT : public W3_USER_CONTEXT
  5. {
  6. public:
  7. ANONYMOUS_USER_CONTEXT(
  8. AUTH_PROVIDER * pProvider
  9. ) : W3_USER_CONTEXT( pProvider )
  10. {
  11. }
  12. virtual ~ANONYMOUS_USER_CONTEXT()
  13. {
  14. if ( _pCachedToken != NULL )
  15. {
  16. _pCachedToken->DereferenceCacheEntry();
  17. _pCachedToken = NULL;
  18. }
  19. }
  20. HRESULT
  21. Create(
  22. TOKEN_CACHE_ENTRY * pTokenCacheEntry
  23. );
  24. WCHAR *
  25. QueryRemoteUserName(
  26. VOID
  27. )
  28. {
  29. return L"";
  30. }
  31. WCHAR *
  32. QueryUserName(
  33. VOID
  34. )
  35. {
  36. return _strUserName.QueryStr();
  37. }
  38. HRESULT
  39. SetUserNameA(
  40. CHAR * szUserName
  41. )
  42. {
  43. return _strUserName.CopyA( szUserName );
  44. }
  45. WCHAR *
  46. QueryPassword(
  47. VOID
  48. )
  49. {
  50. return L"";
  51. }
  52. DWORD
  53. QueryAuthType(
  54. VOID
  55. )
  56. {
  57. return MD_AUTH_ANONYMOUS;
  58. }
  59. TOKEN_CACHE_ENTRY *
  60. QueryCachedToken(
  61. VOID
  62. )
  63. {
  64. return _pCachedToken;
  65. }
  66. HANDLE
  67. QueryImpersonationToken(
  68. VOID
  69. )
  70. {
  71. DBG_ASSERT( _pCachedToken != NULL );
  72. return _pCachedToken->QueryImpersonationToken();
  73. }
  74. HANDLE
  75. QueryPrimaryToken(
  76. VOID
  77. )
  78. {
  79. DBG_ASSERT( _pCachedToken != NULL );
  80. return _pCachedToken->QueryPrimaryToken();
  81. }
  82. PSID
  83. QuerySid(
  84. VOID
  85. )
  86. {
  87. DBG_ASSERT( _pCachedToken != NULL );
  88. return _pCachedToken->QuerySid();
  89. }
  90. VOID *
  91. operator new(
  92. size_t uiSize,
  93. VOID * pPlacement
  94. )
  95. {
  96. W3_MAIN_CONTEXT * pContext;
  97. pContext = (W3_MAIN_CONTEXT*) pPlacement;
  98. DBG_ASSERT( pContext != NULL );
  99. DBG_ASSERT( pContext->CheckSignature() );
  100. return pContext->ContextAlloc( (UINT)uiSize );
  101. }
  102. VOID
  103. operator delete(
  104. VOID * pContext
  105. )
  106. {
  107. UNREFERENCED_PARAMETER( pContext );
  108. }
  109. private:
  110. TOKEN_CACHE_ENTRY * _pCachedToken;
  111. STRU _strUserName;
  112. };
  113. class ANONYMOUS_AUTH_PROVIDER : public AUTH_PROVIDER
  114. {
  115. public:
  116. ANONYMOUS_AUTH_PROVIDER()
  117. {
  118. }
  119. virtual ~ANONYMOUS_AUTH_PROVIDER()
  120. {
  121. }
  122. HRESULT
  123. Initialize(
  124. DWORD dwInternalId
  125. )
  126. {
  127. SetInternalId( dwInternalId );
  128. return NO_ERROR;
  129. }
  130. VOID
  131. Terminate(
  132. VOID
  133. )
  134. {
  135. }
  136. HRESULT
  137. DoesApply(
  138. W3_MAIN_CONTEXT * pMainContext,
  139. BOOL * pfApplies
  140. );
  141. HRESULT
  142. DoAuthenticate(
  143. W3_MAIN_CONTEXT * pMainContext,
  144. BOOL * pfFilterFinished
  145. );
  146. HRESULT
  147. OnAccessDenied(
  148. W3_MAIN_CONTEXT * pMainContext
  149. )
  150. {
  151. //
  152. // No headers for anonymous
  153. //
  154. UNREFERENCED_PARAMETER( pMainContext );
  155. return NO_ERROR;
  156. }
  157. DWORD
  158. QueryAuthType(
  159. VOID
  160. )
  161. {
  162. return MD_AUTH_ANONYMOUS;
  163. }
  164. };
  165. #endif