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.

155 lines
2.5 KiB

  1. #ifndef _CERTMAPPROVIDER_HXX_
  2. #define _CERTMAPPROVIDER_HXX_
  3. class CERTMAP_AUTH_PROVIDER : public AUTH_PROVIDER
  4. {
  5. public:
  6. CERTMAP_AUTH_PROVIDER()
  7. {
  8. }
  9. virtual ~CERTMAP_AUTH_PROVIDER()
  10. {
  11. }
  12. HRESULT
  13. Initialize(
  14. DWORD dwInternalId
  15. )
  16. {
  17. SetInternalId( dwInternalId );
  18. return NO_ERROR;
  19. }
  20. VOID
  21. Terminate(
  22. VOID
  23. )
  24. {
  25. }
  26. HRESULT
  27. DoesApply(
  28. W3_MAIN_CONTEXT * pMainContext,
  29. BOOL * pfApplies
  30. );
  31. HRESULT
  32. DoAuthenticate(
  33. W3_MAIN_CONTEXT * pMainContext
  34. );
  35. HRESULT
  36. OnAccessDenied(
  37. W3_MAIN_CONTEXT * pMainContext
  38. );
  39. DWORD
  40. QueryAuthType(
  41. VOID
  42. )
  43. {
  44. //
  45. // Yah Yah Yah. This really isn't a metabase auth type.
  46. //
  47. return MD_ACCESS_MAP_CERT;
  48. }
  49. };
  50. class CERTMAP_USER_CONTEXT : public W3_USER_CONTEXT
  51. {
  52. public:
  53. CERTMAP_USER_CONTEXT( AUTH_PROVIDER * pProvider )
  54. : W3_USER_CONTEXT( pProvider )
  55. {
  56. _fDelegatable = FALSE;
  57. _hPrimaryToken = NULL;
  58. _achUserName[ 0 ] = L'\0';
  59. }
  60. virtual ~CERTMAP_USER_CONTEXT()
  61. {
  62. if ( _hImpersonationToken != NULL )
  63. {
  64. CloseHandle( _hImpersonationToken );
  65. _hImpersonationToken = NULL;
  66. }
  67. if ( _hPrimaryToken != NULL )
  68. {
  69. CloseHandle( _hPrimaryToken );
  70. _hPrimaryToken = NULL;
  71. }
  72. }
  73. HRESULT
  74. Create(
  75. HANDLE hImpersonationToken,
  76. BOOL fDelegatable
  77. );
  78. WCHAR *
  79. QueryUserName(
  80. VOID
  81. )
  82. {
  83. return _achUserName;
  84. }
  85. BOOL
  86. QueryDelegatable(
  87. VOID
  88. )
  89. {
  90. return _fDelegatable;
  91. }
  92. WCHAR *
  93. QueryPassword(
  94. VOID
  95. )
  96. {
  97. return L"";
  98. }
  99. DWORD
  100. QueryAuthType(
  101. VOID
  102. )
  103. {
  104. return MD_ACCESS_MAP_CERT;
  105. }
  106. HANDLE
  107. QueryImpersonationToken(
  108. VOID
  109. )
  110. {
  111. DBG_ASSERT( _hImpersonationToken != NULL );
  112. return _hImpersonationToken;
  113. }
  114. HANDLE
  115. QueryPrimaryToken(
  116. VOID
  117. );
  118. BOOL
  119. IsValid(
  120. VOID
  121. )
  122. {
  123. return TRUE;
  124. }
  125. private:
  126. BOOL _fDelegatable;
  127. WCHAR _achUserName[ UNLEN + 1 ];
  128. HANDLE _hImpersonationToken;
  129. HANDLE _hPrimaryToken;
  130. };
  131. #endif