コード例 #1
0
        internal static byte[] InternalTestGetFakeSerializedBlob()
        {
            ClientSessionInfo clientSessionInfo = new ClientSessionInfo
            {
                EffectiveLogonType   = LogonType.BestAccess,
                ClientInfoString     = "FakeTestSession",
                LogonUserSid         = "S-Fake-Test-SID",
                LogonUserDisplayName = "Fake User Display Name"
            };

            return(clientSessionInfo.ToBytes());
        }
コード例 #2
0
        public static byte[] WrapInfoForRemoteServer(MailboxSession session)
        {
            Util.ThrowOnNullArgument(session, "session");
            if (!session.IsRemote)
            {
                throw new InvalidOperationException("Only remote session supports ClientSessionInfo.");
            }
            if (!session.MailboxOwner.MailboxInfo.Configuration.IsMailboxAuditEnabled)
            {
                return(null);
            }
            IdentityPair      identityPair      = IdentityHelper.GetIdentityPair(session);
            ClientSessionInfo clientSessionInfo = new ClientSessionInfo
            {
                EffectiveLogonType   = COWAudit.ResolveEffectiveLogonType(session, null, null),
                ClientInfoString     = session.ClientInfoString,
                LogonUserSid         = identityPair.LogonUserSid,
                LogonUserDisplayName = identityPair.LogonUserDisplayName
            };

            return(clientSessionInfo.ToBytes());
        }
コード例 #3
0
        public static ClientSessionInfo FromBytes(byte[] blob)
        {
            if (blob == null)
            {
                return(null);
            }
            ClientSessionInfo result;

            try
            {
                BinaryFormatter binaryFormatter = ExchangeBinaryFormatterFactory.CreateBinaryFormatter(ClientSessionInfo.serializationBinder);
                using (MemoryStream memoryStream = new MemoryStream(blob))
                {
                    ClientSessionInfo clientSessionInfo = (ClientSessionInfo)binaryFormatter.Deserialize(memoryStream);
                    result = clientSessionInfo;
                }
            }
            catch (FormatException)
            {
                throw new ClientSessionInfoParseException();
            }
            return(result);
        }