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.

169 lines
2.9 KiB

  1. #ifndef _CERTMAPPROVIDER_HXX_
  2. #define _CERTMAPPROVIDER_HXX_
  3. /*++
  4. Copyright (c) 1999 Microsoft Corporation
  5. Module Name :
  6. certmapprovider.hxx
  7. Abstract:
  8. Active Directory Certificate Mapper provider
  9. Author:
  10. Bilal Alam (balam) 10-Jan-2000
  11. Environment:
  12. Win32 - User Mode
  13. Project:
  14. ULW3.DLL
  15. --*/
  16. class CERTMAP_AUTH_PROVIDER : public AUTH_PROVIDER
  17. {
  18. public:
  19. CERTMAP_AUTH_PROVIDER()
  20. {
  21. }
  22. virtual ~CERTMAP_AUTH_PROVIDER()
  23. {
  24. }
  25. HRESULT
  26. Initialize(
  27. DWORD dwInternalId
  28. )
  29. {
  30. SetInternalId( dwInternalId );
  31. return NO_ERROR;
  32. }
  33. VOID
  34. Terminate(
  35. VOID
  36. )
  37. {
  38. }
  39. HRESULT
  40. DoesApply(
  41. W3_MAIN_CONTEXT * pMainContext,
  42. BOOL * pfApplies
  43. );
  44. HRESULT
  45. DoAuthenticate(
  46. W3_MAIN_CONTEXT * pMainContext,
  47. BOOL * pfFilterFinished
  48. );
  49. HRESULT
  50. OnAccessDenied(
  51. W3_MAIN_CONTEXT * pMainContext
  52. );
  53. DWORD
  54. QueryAuthType(
  55. VOID
  56. )
  57. {
  58. //
  59. // This really isn't a metabase auth type.
  60. // It is important to note that
  61. // there must be no MD_AUTH_* defined that
  62. // equals to MD_ACCESS_MAP_CERT
  63. //
  64. return MD_ACCESS_MAP_CERT;
  65. }
  66. };
  67. class CERTMAP_USER_CONTEXT : public W3_USER_CONTEXT
  68. {
  69. public:
  70. CERTMAP_USER_CONTEXT( AUTH_PROVIDER * pProvider )
  71. : W3_USER_CONTEXT( pProvider )
  72. {
  73. _hPrimaryToken = NULL;
  74. _achUserName[ 0 ] = L'\0';
  75. }
  76. virtual ~CERTMAP_USER_CONTEXT()
  77. {
  78. if ( _hImpersonationToken != NULL )
  79. {
  80. CloseHandle( _hImpersonationToken );
  81. _hImpersonationToken = NULL;
  82. }
  83. if ( _hPrimaryToken != NULL )
  84. {
  85. CloseHandle( _hPrimaryToken );
  86. _hPrimaryToken = NULL;
  87. }
  88. }
  89. HRESULT
  90. Create(
  91. HANDLE hImpersonationToken
  92. );
  93. WCHAR *
  94. QueryUserName(
  95. VOID
  96. )
  97. {
  98. return _achUserName;
  99. }
  100. WCHAR *
  101. QueryPassword(
  102. VOID
  103. )
  104. {
  105. return L"";
  106. }
  107. DWORD
  108. QueryAuthType(
  109. VOID
  110. )
  111. {
  112. return MD_ACCESS_MAP_CERT;
  113. }
  114. HANDLE
  115. QueryImpersonationToken(
  116. VOID
  117. )
  118. {
  119. DBG_ASSERT( _hImpersonationToken != NULL );
  120. return _hImpersonationToken;
  121. }
  122. HANDLE
  123. QueryPrimaryToken(
  124. VOID
  125. );
  126. BOOL
  127. IsValid(
  128. VOID
  129. )
  130. {
  131. return TRUE;
  132. }
  133. private:
  134. WCHAR _achUserName[ UNLEN + 1 ];
  135. HANDLE _hImpersonationToken;
  136. HANDLE _hPrimaryToken;
  137. };
  138. #endif