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.

138 lines
2.2 KiB

  1. #ifndef _DIGESTPROVIDER_HXX_
  2. #define _DIGESTPROVIDER_HXX_
  3. class DIGEST_AUTH_PROVIDER : public SSPI_AUTH_PROVIDER
  4. {
  5. public:
  6. DIGEST_AUTH_PROVIDER(
  7. DWORD _dwAuthType
  8. ) : SSPI_AUTH_PROVIDER( _dwAuthType )
  9. {
  10. }
  11. virtual ~DIGEST_AUTH_PROVIDER()
  12. {
  13. }
  14. HRESULT
  15. Initialize(
  16. DWORD dwInternalId
  17. );
  18. VOID
  19. Terminate(
  20. VOID
  21. );
  22. HRESULT
  23. DoesApply(
  24. W3_MAIN_CONTEXT * pMainContext,
  25. BOOL * pfApplies
  26. );
  27. HRESULT
  28. DoAuthenticate(
  29. W3_MAIN_CONTEXT * pMainContext
  30. );
  31. HRESULT
  32. OnAccessDenied(
  33. W3_MAIN_CONTEXT * pMainContext
  34. );
  35. HRESULT
  36. SetDigestHeader(
  37. IN W3_MAIN_CONTEXT * pMainContext,
  38. IN BOOL fStale
  39. );
  40. };
  41. class DIGEST_SECURITY_CONTEXT : public SSPI_SECURITY_CONTEXT
  42. {
  43. public:
  44. DIGEST_SECURITY_CONTEXT(
  45. SSPI_CREDENTIAL * pCredential
  46. )
  47. : SSPI_SECURITY_CONTEXT ( pCredential ),
  48. _fStale ( FALSE )
  49. {
  50. }
  51. virtual ~DIGEST_SECURITY_CONTEXT()
  52. {
  53. }
  54. VOID *
  55. operator new(
  56. size_t size
  57. )
  58. {
  59. DBG_ASSERT( size == sizeof( DIGEST_SECURITY_CONTEXT ) );
  60. DBG_ASSERT( sm_pachDIGESTSecContext != NULL );
  61. return sm_pachDIGESTSecContext->Alloc();
  62. }
  63. VOID
  64. operator delete(
  65. VOID * pDIGESTSecContext
  66. )
  67. {
  68. DBG_ASSERT( pDIGESTSecContext != NULL );
  69. DBG_ASSERT( sm_pachDIGESTSecContext != NULL );
  70. DBG_REQUIRE( sm_pachDIGESTSecContext->Free( pDIGESTSecContext ) );
  71. }
  72. BOOL
  73. Cleanup(
  74. VOID
  75. )
  76. {
  77. delete this;
  78. return TRUE;
  79. }
  80. static
  81. HRESULT
  82. Initialize(
  83. VOID
  84. );
  85. static
  86. VOID
  87. Terminate(
  88. VOID
  89. );
  90. VOID
  91. SetStale(
  92. BOOL fStale
  93. )
  94. {
  95. _fStale = fStale;
  96. }
  97. BOOL
  98. QueryStale(
  99. VOID
  100. )
  101. {
  102. return _fStale;
  103. }
  104. private:
  105. //
  106. // Is the nonce value stale
  107. //
  108. BOOL _fStale;
  109. static ALLOC_CACHE_HANDLER * sm_pachDIGESTSecContext;
  110. };
  111. #endif