Source code of Windows XP (NT5)
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.

181 lines
2.9 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. DWORD dwLogonMethod
  24. );
  25. WCHAR *
  26. QueryUserName(
  27. VOID
  28. )
  29. {
  30. return L"";
  31. }
  32. BOOL
  33. QueryDelegatable(
  34. VOID
  35. )
  36. {
  37. return _fDelegatable;
  38. }
  39. WCHAR *
  40. QueryPassword(
  41. VOID
  42. )
  43. {
  44. return L"";
  45. }
  46. DWORD
  47. QueryAuthType(
  48. VOID
  49. )
  50. {
  51. return MD_AUTH_ANONYMOUS;
  52. }
  53. HANDLE
  54. QueryImpersonationToken(
  55. VOID
  56. )
  57. {
  58. DBG_ASSERT( _pCachedToken != NULL );
  59. return _pCachedToken->QueryImpersonationToken();
  60. }
  61. HANDLE
  62. QueryPrimaryToken(
  63. VOID
  64. )
  65. {
  66. DBG_ASSERT( _pCachedToken != NULL );
  67. return _pCachedToken->QueryPrimaryToken();
  68. }
  69. PSID
  70. QuerySid(
  71. VOID
  72. )
  73. {
  74. DBG_ASSERT( _pCachedToken != NULL );
  75. return _pCachedToken->QuerySid();
  76. }
  77. VOID *
  78. operator new(
  79. size_t uiSize,
  80. VOID * pPlacement
  81. )
  82. {
  83. W3_MAIN_CONTEXT * pContext;
  84. pContext = (W3_MAIN_CONTEXT*) pPlacement;
  85. DBG_ASSERT( pContext != NULL );
  86. DBG_ASSERT( pContext->CheckSignature() );
  87. return pContext->ContextAlloc( (UINT)uiSize );
  88. }
  89. VOID
  90. operator delete(
  91. VOID * pContext
  92. )
  93. {
  94. }
  95. private:
  96. TOKEN_CACHE_ENTRY * _pCachedToken;
  97. BOOL _fDelegatable;
  98. };
  99. class ANONYMOUS_AUTH_PROVIDER : public AUTH_PROVIDER
  100. {
  101. public:
  102. ANONYMOUS_AUTH_PROVIDER()
  103. {
  104. }
  105. virtual ~ANONYMOUS_AUTH_PROVIDER()
  106. {
  107. }
  108. HRESULT
  109. Initialize(
  110. DWORD dwInternalId
  111. )
  112. {
  113. SetInternalId( dwInternalId );
  114. return NO_ERROR;
  115. }
  116. VOID
  117. Terminate(
  118. VOID
  119. )
  120. {
  121. }
  122. HRESULT
  123. DoesApply(
  124. W3_MAIN_CONTEXT * pMainContext,
  125. BOOL * pfApplies
  126. );
  127. HRESULT
  128. DoAuthenticate(
  129. W3_MAIN_CONTEXT * pMainContext
  130. );
  131. HRESULT
  132. OnAccessDenied(
  133. W3_MAIN_CONTEXT * pMainContext
  134. )
  135. {
  136. //
  137. // No headers for anonymous
  138. //
  139. return NO_ERROR;
  140. }
  141. DWORD
  142. QueryAuthType(
  143. VOID
  144. )
  145. {
  146. return MD_AUTH_ANONYMOUS;
  147. }
  148. };
  149. #endif