Пример #1
0
 private void ProcessAuthorizationGranted(AppAuthorizationResponse response)
 {
     if (this.IsReconnect())
     {
         this.ctlSetConnectSubscription.SetFacebook          = true;
         this.ctlSetConnectSubscription.AppAuthorizationCode = response.AppAuthorizationCode;
         this.ctlSetConnectSubscription.RedirectUri          = this.GetRedirectUri();
         return;
     }
     this.ctlNewConnectSubscription.CreateFacebook       = true;
     this.ctlNewConnectSubscription.AppAuthorizationCode = response.AppAuthorizationCode;
     this.ctlNewConnectSubscription.RedirectUri          = this.GetRedirectUri();
 }
Пример #2
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");
     }
 }