コード例 #1
0
 protected override void OnLoad(EventArgs e)
 {
     base.OnLoad(e);
     try
     {
         LinkedInConfig    linkedInConfig          = this.ReadConfiguration();
         LinkedInAppConfig config                  = this.ReadAppConfiguration();
         LinkedInAppAuthorizationResponse response = new LinkedInAuthenticator(linkedInConfig, new LinkedInWebClient(config, LinkedInSetup.Tracer), LinkedInSetup.Tracer).AuthorizeApplication(base.Request.QueryString, base.Request.Cookies, base.Response.Cookies, this.GetAuthorizationCallbackUrl());
         this.ProcessAuthorizationResponse(response);
     }
     catch (ExchangeConfigurationException ex)
     {
         EcpEventLogConstants.Tuple_BadLinkedInConfiguration.LogPeriodicEvent(EcpEventLogExtensions.GetPeriodicKeyPerUser(), new object[]
         {
             EcpEventLogExtensions.GetUserNameToLog(),
             ex
         });
         ErrorHandlingUtil.TransferToErrorPage("badlinkedinconfiguration");
     }
     catch (LinkedInAuthenticationException ex2)
     {
         EcpEventLogConstants.Tuple_LinkedInAuthorizationError.LogEvent(new object[]
         {
             EcpEventLogExtensions.GetUserNameToLog(),
             ex2
         });
         ErrorHandlingUtil.TransferToErrorPage("linkedinauthorizationerror");
     }
 }
コード例 #2
0
 private void DisplayResults <T>(PowerShellResults <T> results) where T : PimSubscription
 {
     if (results.Failed)
     {
         if (results.ErrorRecords[0].Exception is ManagementObjectNotFoundException)
         {
             ErrorHandlingUtil.TransferToErrorPage("liveidmismatch");
             return;
         }
         if (results.ErrorRecords[0].Exception is ValidateSecretFailureException)
         {
             ErrorHandlingUtil.TransferToErrorPage("verificationfailed");
             return;
         }
         ErrorHandlingUtil.TransferToErrorPage("verificationprocessingerror");
         return;
     }
     else
     {
         if (results.Output.Length == 0)
         {
             ErrorHandlingUtil.TransferToErrorPage("verificationprocessingerror");
             return;
         }
         this.msgText.Text = OwaOptionStrings.VerificationSuccessText(results.Output[0].EmailAddress);
         base.Title        = OwaOptionStrings.VerificationSuccessPageTitle;
         return;
     }
 }
コード例 #3
0
        private static void Application_PostAcquireRequestState(object sender, EventArgs e)
        {
            if (!VirtualDirectoryConfiguration.EcpVirtualDirectoryAnonymousAuthenticationEnabled)
            {
                ExTraceGlobals.RBACTracer.TraceInformation(0, 0L, "Anonymous authentication must be enabled in ECP.");
                throw new ExchangeConfigurationException(Strings.AnonymousAuthenticationDisabledErrorMessage);
            }
            HttpRequest             request = HttpContext.Current.Request;
            HttpBrowserCapabilities browser = request.Browser;

            if (browser != null && browser.IsBrowser("IE") && browser.MajorVersion < 7)
            {
                ErrorHandlingUtil.TransferToErrorPage("browsernotsupported");
            }
        }
コード例 #4
0
        private void Application_PostAuthenticateRequest(object sender, EventArgs e)
        {
            HttpContext httpContext = HttpContext.Current;
            string      text        = httpContext.Request.Headers["msExchProxyUri"];

            if (!string.IsNullOrEmpty(text))
            {
                Uri    uri   = new Uri(text);
                string text2 = (uri.Segments.Length > 1) ? uri.Segments[1].TrimEnd(new char[]
                {
                    '/'
                }) : string.Empty;
                if (text2.Equals(RbacModule.ecpAppPath.Value, StringComparison.OrdinalIgnoreCase) && !text2.Equals(RbacModule.ecpAppPath.Value))
                {
                    string url = "/" + RbacModule.ecpAppPath + uri.PathAndQuery.Substring(RbacModule.ecpAppPath.Value.Length + 1);
                    httpContext.Response.Redirect(url, true);
                    return;
                }
            }
            if (httpContext.Request.HttpMethod == "GET" && !RbacModule.bypassXFrameOptions && !RbacModule.xFrameOptionsExceptionList.Contains(httpContext.Request.AppRelativeCurrentExecutionFilePath))
            {
                httpContext.Response.Headers.Set("X-Frame-Options", "SameOrigin");
            }
            AuthenticationSettings authenticationSettings = new AuthenticationSettings(httpContext);

            httpContext.User = authenticationSettings.Session;
            authenticationSettings.Session.SetCurrentThreadPrincipal();
            if (!httpContext.IsAcsOAuthRequest())
            {
                httpContext.CheckCanary();
            }
            authenticationSettings.Session.RequestReceived();
            if (authenticationSettings.Session is RbacPrincipal)
            {
                if (!OAuthHelper.IsWebRequestAllowed(httpContext))
                {
                    ErrorHandlingUtil.TransferToErrorPage("notavailableforpartner");
                }
                if (!LoginUtil.CheckUrlAccess(httpContext.Request.FilePath))
                {
                    ErrorHandlingUtil.TransferToErrorPage("noroles");
                    return;
                }
                this.FlightRewrite(httpContext);
            }
        }
コード例 #5
0
        private InboxRule GetMessageInfo(string messageId)
        {
            InboxRules inboxRules = base.RuleService as InboxRules;
            PowerShellResults <InboxRule> mailMessage = inboxRules.GetMailMessage(new NewInboxRule
            {
                FromMessageId = new Identity(messageId, messageId),
                ValidateOnly  = new bool?(true),
                AllowExceuteThruHttpGetRequest = true
            });

            if (mailMessage.Failed)
            {
                string cause = (mailMessage.ErrorRecords[0].Exception is ManagementObjectNotFoundException) ? "messagenotfound" : "unexpected";
                ErrorHandlingUtil.TransferToErrorPage(cause);
            }
            return(mailMessage.Value);
        }
コード例 #6
0
        protected override void OnLoad(EventArgs e)
        {
            string subscriptionTypeParam = this.Context.Request.QueryString["st"];
            string subscriptionGuidParam = this.Context.Request.QueryString["su"];
            string text = this.Context.Request.QueryString["ss"];
            AggregationSubscriptionType aggregationSubscriptionType;
            Guid   subscriptionId;
            string queryParam;

            if (!this.ValidateUrlParameters(subscriptionTypeParam, subscriptionGuidParam, text, out aggregationSubscriptionType, out subscriptionId, out queryParam))
            {
                throw new BadQueryParameterException(queryParam);
            }
            ADObjectId executingUserId = RbacPrincipal.Current.ExecutingUserId;
            AggregationSubscriptionIdentity    subId = new AggregationSubscriptionIdentity(executingUserId, subscriptionId);
            AggregationSubscriptionIdParameter aggregationSubscriptionIdParameter = new AggregationSubscriptionIdParameter(subId);
            string text2 = aggregationSubscriptionIdParameter.ToString();

            if (text2 == null)
            {
                ErrorHandlingUtil.TransferToErrorPage("unexpected");
                return;
            }
            if (aggregationSubscriptionType == AggregationSubscriptionType.Pop)
            {
                PopSubscriptions   popSubscriptions   = new PopSubscriptions();
                SetPopSubscription setPopSubscription = new SetPopSubscription();
                setPopSubscription.ValidateSecret = text;
                setPopSubscription.AllowExceuteThruHttpGetRequest = true;
                Identity identity = new Identity(text2, text2);
                PowerShellResults <PopSubscription> results = popSubscriptions.SetObject(identity, setPopSubscription);
                this.DisplayResults <PopSubscription>(results);
                return;
            }
            ImapSubscriptions   imapSubscriptions   = new ImapSubscriptions();
            SetImapSubscription setImapSubscription = new SetImapSubscription();

            setImapSubscription.ValidateSecret = text;
            setImapSubscription.AllowExceuteThruHttpGetRequest = true;
            Identity identity2 = new Identity(text2, text2);
            PowerShellResults <ImapSubscription> results2 = imapSubscriptions.SetObject(identity2, setImapSubscription);

            this.DisplayResults <ImapSubscription>(results2);
        }
コード例 #7
0
        protected override void OnLoad(EventArgs e)
        {
            string a;

            if ((a = this.Provider.ToLowerInvariant()) != null)
            {
                if (a == "facebook")
                {
                    base.Server.Transfer("~/Connect/FacebookSetup.aspx");
                    return;
                }
                if (a == "linkedin")
                {
                    base.Server.Transfer("~/Connect/LinkedInSetup.aspx");
                    return;
                }
            }
            ErrorHandlingUtil.TransferToErrorPage("badrequesttopeopleconnectmainbadproviderparameter");
        }
コード例 #8
0
 protected override void OnLoad(EventArgs e)
 {
     base.OnLoad(e);
     try
     {
         this.ctlUserConsentForm.Visible = false;
         FacebookAuthenticatorConfig config = this.ReadConfiguration();
         FacebookAuthenticator       facebookAuthenticator = new FacebookAuthenticator(config);
         AppAuthorizationResponse    response = FacebookAuthenticator.ParseAppAuthorizationResponse(base.Request.QueryString);
         if (!FacebookAuthenticator.IsRedirectFromFacebook(response))
         {
             string text = facebookAuthenticator.GetAppAuthorizationUri().ToString();
             if (this.IsReconnect())
             {
                 base.Response.Redirect(text);
             }
             else
             {
                 this.ctlUserConsentForm.Visible          = true;
                 this.ctlUserConsentForm.AuthorizationUrl = text;
             }
         }
         else if (facebookAuthenticator.IsAuthorizationGranted(response))
         {
             this.ProcessAuthorizationGranted(response);
         }
         else
         {
             this.ProcessAuthorizationDenied();
         }
     }
     catch (ExchangeConfigurationException ex)
     {
         EcpEventLogConstants.Tuple_BadFacebookConfiguration.LogPeriodicEvent(EcpEventLogExtensions.GetPeriodicKeyPerUser(), new object[]
         {
             EcpEventLogExtensions.GetUserNameToLog(),
             ex
         });
         ErrorHandlingUtil.TransferToErrorPage("badfacebookconfiguration");
     }
 }
コード例 #9
0
 protected override void OnInit(EventArgs e)
 {
     base.OnInit(e);
     this.InstallMarketplaceAssetID = this.Context.Request.QueryString["AssetID"];
     this.MarketplaceQueryMarket    = this.Context.Request.QueryString["LC"];
     this.Scope        = this.Context.Request.QueryString["Scope"];
     this.DeploymentId = this.Context.Request.QueryString["DeployId"];
     this.Etoken       = this.GetClientTokenParameter(this.Context.Request.RawUrl);
     if (!string.IsNullOrWhiteSpace(this.InstallMarketplaceAssetID) && !string.IsNullOrWhiteSpace(this.MarketplaceQueryMarket))
     {
         return;
     }
     EcpEventLogConstants.Tuple_MissingRequiredParameterDetected.LogPeriodicEvent(EcpEventLogExtensions.GetPeriodicKeyPerUser(), new object[]
     {
         EcpEventLogExtensions.GetUserNameToLog(),
         this.Context.GetRequestUrlForLog(),
         (this.InstallMarketplaceAssetID != null) ? this.InstallMarketplaceAssetID : string.Empty,
         (this.MarketplaceQueryMarket != null) ? this.MarketplaceQueryMarket : string.Empty
     });
     ErrorHandlingUtil.TransferToErrorPage("badofficecallback");
 }