Exemplo n.º 1
0
        protected void LinkButtonManageAuthorisation_Click(object sender, EventArgs e)
        {
            StartManageAuthorisationAttemptResponse response = null;
            try
            {
                using (WebSSOServiceSoapClient client = new WebSSOServiceSoapClient("WebSSOServiceSoapClient"))
                {
                    client.Open();

                    StartManageAuthorisationAttemptRequest request = new StartManageAuthorisationAttemptRequest()
                    {

                        // In this example, SuccessUri and FailureUri are set to the same value. The response
                        // to each End<X>Attempt() contains enough information to distinguish
                        // between a success result and a failure result. ManageAuthorisationsResult() illustrates
                        // how to do this.
                        SuccessUri = ConfigurationManager.AppSettings["ManageAuthorisationsResultUri"],
                        FailureUri = ConfigurationManager.AppSettings["ManageAuthorisationsResultUri"],

                        CancelAllowed = true
                    };

                    response = client.StartManageAuthorisationAttempt(request);
                }
            }
            catch (Exception ex)
            {
                LabelMessage.Text = HttpUtility.HtmlEncode(string.Format("Exception of type {0} raised when calling WebSSOService.StartManageAuthorisationAttempt(). {1}", ex.GetType().FullName, ex.Message));
            }

            if (response != null)
            {
                // The change password attempt ID is placed in the session to act as a "marker" that
                // a manage authorisations attempt is in progress. It's used later to avoid a call to
                // EndManageAuthorisationsAttempt() if no authorisation management attempt is in progress.

                Session["ManageAuthorisationsAttempt"] = response.ManageAuthorisationAttemptId;

                Response.Redirect(response.RedirectUri);
            }
        }
        public ActionResult ManageAuthorisations()
        {
            StartManageAuthorisationAttemptResponse response;
            try
            {
                using (WebSSOServiceSoapClient client = new WebSSOServiceSoapClient("WebSSOServiceSoapClient"))
                {
                    client.Open();

                    StartManageAuthorisationAttemptRequest request = new StartManageAuthorisationAttemptRequest()
                    {

                        // In this example, SuccessUri and FailureUri are set to the same value. The response
                        // to each End<X>Attempt() contains enough information to distinguish
                        // between a success result and a failure result. ManageAuthorisationsResult() illustrates
                        // how to do this.
                        SuccessUri = ManageAuthorisationsResultUri,
                        FailureUri = ManageAuthorisationsResultUri,

                        CancelAllowed = true
                    };

                    response = client.StartManageAuthorisationAttempt(request);
                }
            }
            catch (Exception ex)
            {
                Session["Message"] = HttpUtility.HtmlEncode(string.Format("Exception of type {0} raised when calling WebSSOService.StartManageAuthorisationAttempt(). {1}", ex.GetType().FullName, ex.Message));

                return SignInPageRedirect;
            }

            // The change password attempt ID is placed in the session to act as a "marker" that
            // a manage authorisations attempt is in progress. It's used later to avoid a call to
            // EndManageAuthorisationsAttempt() if no authorisation management attempt is in progress.

            Session["ManageAuthorisationsAttempt"] = response.ManageAuthorisationAttemptId;

            return Redirect(response.RedirectUri);
        }