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.

119 lines
3.9 KiB

  1. /**********************************************************************/
  2. /** Microsoft Passport **/
  3. /** Copyright(c) Microsoft Corporation, 1999 - 2001 **/
  4. /**********************************************************************/
  5. /*
  6. ticket.h
  7. Define class for passport ticket
  8. FILE HISTORY:
  9. */
  10. // Ticket.h : Declaration of the CTicket
  11. #ifndef __TICKET_H_
  12. #define __TICKET_H_
  13. #include "resource.h" // main symbols
  14. /////////////////////////////////////////////////////////////////////////////
  15. // CTicket
  16. class ATL_NO_VTABLE CTicket :
  17. public CComObjectRootEx<CComMultiThreadModel>,
  18. public CComCoClass<CTicket, &CLSID_Ticket>,
  19. public ISupportErrorInfo,
  20. public IDispatchImpl<IPassportTicket2, &IID_IPassportTicket2, &LIBID_PASSPORTLib>
  21. {
  22. public:
  23. CTicket() : m_raw(NULL), m_lastSignInTime(0),
  24. m_ticketTime(0), m_valid(FALSE),
  25. m_bSecureCheckSucceeded(FALSE), m_schemaDrivenOffset(INVALID_OFFSET),
  26. m_passportFlags(0)
  27. {
  28. ZeroMemory(m_memberId, sizeof(m_memberId));
  29. }
  30. ~CTicket()
  31. {
  32. if (m_raw)
  33. SysFreeString(m_raw);
  34. }
  35. public:
  36. DECLARE_REGISTRY_RESOURCEID(IDR_TICKET)
  37. DECLARE_PROTECT_FINAL_CONSTRUCT()
  38. BEGIN_COM_MAP(CTicket)
  39. COM_INTERFACE_ENTRY(IPassportTicket2)
  40. COM_INTERFACE_ENTRY(IPassportTicket)
  41. COM_INTERFACE_ENTRY(IDispatch)
  42. COM_INTERFACE_ENTRY(ISupportErrorInfo)
  43. END_COM_MAP()
  44. // ISupportsErrorInfo
  45. STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid);
  46. // IPassportTicket
  47. public:
  48. STDMETHOD(DoSecureCheck)(/*[in]*/ BSTR bstrSec);
  49. STDMETHOD(DoSecureCheckInTicket)(/* [in] */ BOOL fSecureTransported);
  50. BOOL IsSecure();
  51. ULONG GetPassportFlags();
  52. STDMETHOD(get_TicketTime)(/*[out, retval]*/ long *pVal);
  53. STDMETHOD(get_SignInTime)(/*[out, retval]*/ long *pVal);
  54. STDMETHOD(get_SignInServer)(/*[out, retval]*/ BSTR *pVal);
  55. STDMETHOD(get_HasSavedPassword)(/*[out, retval]*/ VARIANT_BOOL *pVal);
  56. STDMETHOD(get_MemberIdHigh)(/*[out, retval]*/ int *pVal);
  57. STDMETHOD(get_MemberIdLow)(/*[out, retval]*/ int *pVal);
  58. STDMETHOD(get_MemberId)(/*[out, retval]*/ BSTR *pVal);
  59. STDMETHOD(get_TimeSinceSignIn)(/*[out, retval]*/ int *pVal);
  60. STDMETHOD(get_TicketAge)(/*[out, retval]*/ int *pVal);
  61. STDMETHOD(get_IsAuthenticated)(/*[in]*/ ULONG timeWindow, /*[in]*/ VARIANT_BOOL forceLogin, /*[in,optional]*/ VARIANT CheckSecure, /*[out, retval]*/ VARIANT_BOOL *pVal);
  62. STDMETHOD(get_unencryptedTicket)(/*[out, retval]*/ BSTR *pVal);
  63. STDMETHOD(put_unencryptedTicket)(/*[in]*/ BSTR newVal);
  64. STDMETHOD(get_Error)(/*[out,retval]*/ long *pVal);
  65. // IPassportTicket2
  66. STDMETHOD(GetProperty)(/*[in]*/ BSTR propName, /*[out, retval]*/ VARIANT* pVal);
  67. STDMETHOD(SetTertiaryConsent)(BSTR bstrConsent);
  68. STDMETHOD(ConsentStatus)(/*[in]*/VARIANT_BOOL bRequireConsentCookie, /*out*/ULONG* pStatus, /*[out, retval]*/ ConsentStatusEnum* pNeedConsent);
  69. // none COM functions
  70. enum{
  71. MSPAuth = 1,
  72. MSPSecAuth,
  73. MSPConsent
  74. };
  75. // flags parameter is reserved for future use, must be 0 for this version
  76. STDMETHOD(get_unencryptedCookie)(/*in*/ ULONG cookieType, /*in*/ ULONG flags, /*[out, retval]*/ BSTR* pVal);
  77. protected:
  78. BSTR m_raw;
  79. BOOL m_valid;
  80. BOOL m_savedPwd;
  81. WCHAR m_memberId[20];
  82. int m_mIdLow;
  83. int m_mIdHigh;
  84. long m_flags;
  85. time_t m_ticketTime;
  86. time_t m_lastSignInTime;
  87. CComBSTR m_bstrTertiaryConsent;
  88. void parse(LPCOLESTR raw, DWORD dwByteLen, DWORD* pcParsed);
  89. private:
  90. // the bag for the schema driven fields
  91. CTicketPropertyBag m_PropBag;
  92. DWORD m_schemaDrivenOffset; // the offset of schema driven data -- the data introduced after 1.3x
  93. ULONG m_passportFlags;
  94. BOOL m_bSecureCheckSucceeded;
  95. };
  96. #endif //__TICKET_H_