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.

109 lines
3.0 KiB

  1. //***************************************************************************
  2. //
  3. // Copyright (c) 1998-1999 Microsoft Corporation
  4. //
  5. // pxycache.h
  6. //
  7. // alanbos 22-Sep-98 Created.
  8. //
  9. // Definition of proxy cache class
  10. //
  11. //***************************************************************************
  12. #ifndef _PXYCACHE_H_
  13. #define _PXYCACHE_H_
  14. #define WBEMS_MAX_AUTHN_LEVEL 6
  15. #define WBEMS_MIN_AUTHN_LEVEL 0
  16. #define WBEMS_MAX_IMP_LEVEL 4
  17. #define WBEMS_MIN_IMP_LEVEL 1
  18. class CWbemLocatorSecurity;
  19. //***************************************************************************
  20. //
  21. // CLASS NAME:
  22. //
  23. // CSWbemProxyCache
  24. //
  25. // DESCRIPTION:
  26. //
  27. // A proxy cache for remoted CIMOM interfaces
  28. //
  29. //***************************************************************************
  30. class CSWbemProxyCache : public IUnknown
  31. {
  32. private:
  33. long m_cRef; //Object reference count
  34. CRITICAL_SECTION m_cs;
  35. // Array of proxies
  36. IUnknown *pUnkArray [WBEMS_MAX_AUTHN_LEVEL + 1 - WBEMS_MIN_AUTHN_LEVEL]
  37. [WBEMS_MAX_IMP_LEVEL + 1 - WBEMS_MIN_IMP_LEVEL];
  38. // Security data
  39. COAUTHIDENTITY *m_pCoAuthIdentity;
  40. BSTR m_bsPrincipal;
  41. BSTR m_bsAuthority;
  42. BSTR m_bsUser;
  43. BSTR m_bsPassword;
  44. bool m_bUseDefaultInfo;
  45. bool m_bUsingExplicitUserName;
  46. WbemAuthenticationLevelEnum m_dwInitialAuthnLevel;
  47. WbemImpersonationLevelEnum m_dwInitialImpLevel;
  48. void InitializeCache (IUnknown *pUnk, ISWbemSecurity *pSecurity = NULL,
  49. bool bPropagateAuthentication = true,
  50. bool bPropagateImpersonation = true);
  51. static bool DetermineBlanketOptions (IUnknown *pUnk);
  52. DWORD GetCapabilities ();
  53. void ClearCredentials ();
  54. void InitializeMembers (IUnknown *pUnk);
  55. public:
  56. CSWbemProxyCache (IUnknown *pUnk, BSTR bsAuthority, BSTR bsUser,
  57. BSTR bsPassword, CWbemLocatorSecurity *pSecurity);
  58. CSWbemProxyCache (IUnknown *pUnk, COAUTHIDENTITY *pCoAuthIdentity,
  59. BSTR bsPrincipal, BSTR bsAuthority);
  60. CSWbemProxyCache (IUnknown *pUnk, CSWbemSecurity *pSecurity);
  61. virtual ~CSWbemProxyCache ();
  62. //Non-delegating object IUnknown
  63. STDMETHODIMP QueryInterface(REFIID, LPVOID*);
  64. STDMETHODIMP_(ULONG) AddRef(void);
  65. STDMETHODIMP_(ULONG) Release(void);
  66. // Other methods
  67. IUnknown *GetProxy (WbemAuthenticationLevelEnum authnLevel,
  68. WbemImpersonationLevelEnum impLevel,
  69. bool forceResecure = false);
  70. void SecureProxy (IUnknown *pUnk,
  71. WbemAuthenticationLevelEnum authnLevel,
  72. WbemImpersonationLevelEnum impLevel);
  73. WbemAuthenticationLevelEnum GetInitialAuthnLevel () { return m_dwInitialAuthnLevel; }
  74. WbemImpersonationLevelEnum GetInitialImpLevel () { return m_dwInitialImpLevel; }
  75. COAUTHIDENTITY *GetCoAuthIdentity ();
  76. BSTR GetAuthority () { return m_bsAuthority; }
  77. BSTR GetPrincipal () { return m_bsPrincipal; }
  78. bool IsUsingExplicitUserName () { return m_bUsingExplicitUserName; }
  79. IUnknown *GetInitialProxy ()
  80. {
  81. return GetProxy (m_dwInitialAuthnLevel, m_dwInitialImpLevel);
  82. }
  83. };
  84. #endif