示例#1
0
        public static IdentityPair GetIdentityPair(MailboxSession session)
        {
            Util.ThrowOnNullArgument(session, "session");
            IdentityPair result = default(IdentityPair);

            if (session.AuxiliaryIdentity != null)
            {
                if (session.AuxiliaryIdentity is GenericSidIdentity)
                {
                    result.LogonUserSid = ((GenericSidIdentity)session.AuxiliaryIdentity).Sid.Value;
                }
                else
                {
                    result.LogonUserDisplayName = session.AuxiliaryIdentity.Name;
                }
            }
            else
            {
                result.LogonUserSid = IdentityHelper.SidFromLogonIdentity(session.Identity).Value;
            }
            return(result);
        }
示例#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());
        }