// Token: 0x06000D67 RID: 3431 RVA: 0x000596D8 File Offset: 0x000578D8
        internal override MailboxSession CreateWebPartMailboxSession(IExchangePrincipal mailBoxExchangePrincipal, CultureInfo cultureInfo, HttpRequest clientRequest)
        {
            MailboxSession mailboxSession = MailboxSession.OpenWithBestAccess(mailBoxExchangePrincipal, base.CreateADOrgPersonForWebPartUserBySid(), this.clientSecurityContext, cultureInfo, "Client=OWA;Action=WebPart + Delegate + ViaProxy");

            GccUtils.SetStoreSessionClientIPEndpointsFromHttpRequest(mailboxSession, clientRequest);
            return(mailboxSession);
        }
Example #2
0
 private void ConfirmCanActAsOwner()
 {
     if (this.accessingPrincipal != null)
     {
         WindowsIdentity windowsIdentity = this.accessingPrincipal.Identity as WindowsIdentity;
         using (MailboxSession mailboxSession = MailboxSession.OpenWithBestAccess(this.mailboxToAccess, this.accessingUser, this.accessingPrincipal, CultureInfo.InvariantCulture, "Client=ELC;Action=Create Managed Folders"))
         {
             if (this.budget != null)
             {
                 mailboxSession.AccountingObject = this.budget;
             }
             if (!mailboxSession.CanActAsOwner)
             {
                 OptInFolders.Tracer.TraceDebug <string, string>((long)this.GetHashCode(), "The authenticated user does not have owner rights to the mailbox.Authenticated User: {0}, Mailbox: {1}", windowsIdentity.Name, this.mailboxToAccess.MailboxInfo.PrimarySmtpAddress.ToString());
                 throw new AccessDeniedException(ServerStrings.IsNotMailboxOwner(windowsIdentity.User, this.mailboxToAccess.Sid));
             }
             return;
         }
     }
     using (MailboxSession mailboxSession2 = MailboxSession.OpenWithBestAccess(this.mailboxToAccess, this.accessingUser, this.clientSecurityContext, CultureInfo.InvariantCulture, "Client=ELC;Action=Create Managed Folders"))
     {
         if (this.budget != null)
         {
             mailboxSession2.AccountingObject = this.budget;
         }
         if (!mailboxSession2.CanActAsOwner)
         {
             OptInFolders.Tracer.TraceDebug <SecurityIdentifier, string>((long)this.GetHashCode(), "The impersonated user does not have owner rights to the mailbox.Impersonated User Sid: {0}, Mailbox: {1}", this.clientSecurityContext.UserSid, this.mailboxToAccess.MailboxInfo.PrimarySmtpAddress.ToString());
             throw new AccessDeniedException(ServerStrings.IsNotMailboxOwner(this.clientSecurityContext.UserSid, this.mailboxToAccess.Sid));
         }
     }
 }
Example #3
0
        internal override MailboxSession CreateWebPartMailboxSession(IExchangePrincipal mailBoxExchangePrincipal, CultureInfo cultureInfo, HttpRequest clientRequest)
        {
            MailboxSession result;

            using (DisposeGuard disposeGuard = default(DisposeGuard))
            {
                MailboxSession mailboxSession = MailboxSession.OpenWithBestAccess(mailBoxExchangePrincipal, base.CreateADOrgPersonForWebPartUserBySid(), this.WindowsPrincipal, cultureInfo, "Client=OWA;Action=WebPart + Delegate");
                disposeGuard.Add <MailboxSession>(mailboxSession);
                GccUtils.SetStoreSessionClientIPEndpointsFromHttpRequest(mailboxSession, clientRequest);
                disposeGuard.Success();
                result = mailboxSession;
            }
            return(result);
        }
        internal MailboxSession CreateDelegateMailboxSession(ExchangePrincipal exchangePrincipal, CultureInfo cultureInfo, string userContextString)
        {
            ExTraceGlobals.CoreCallTracer.TraceDebug(0L, "OwaClientSecurityContextIdentity.CreateMailboxSession");
            MailboxSession result;

            try
            {
                IADOrgPerson iadorgPerson = base.CreateADRecipientBySid() as IADOrgPerson;
                if (iadorgPerson == null)
                {
                    throw new OwaExplicitLogonException("User do not have representation in current forest", null);
                }
                MailboxSession mailboxSession = MailboxSession.OpenWithBestAccess(exchangePrincipal, iadorgPerson, this.clientSecurityContext, cultureInfo, userContextString);
                result = mailboxSession;
            }
            catch (AccessDeniedException innerException)
            {
                throw new OwaExplicitLogonException("User has no access rights to the mailbox", Strings.GetLocalizedString(882888134), innerException);
            }
            return(result);
        }