Esempio n. 1
0
        /// <summary>
        /// Cancels the login process.
        /// </summary>
        private void cancelLoginProcess()
        {
            try
            {
                NameValueCollection form = Request.Form;                 // get form which has send the request

                AuthSession  authSession  = new AuthSession(form["secsignid"], form["authsessionid"], form["requestid"], null, null, null);
                SecSignIDApi secSignIDApi = new SecSignIDApi();

                // cancel auth session
                secSignIDApi.CancelAuthSession(authSession);

                // render previous page
                if (PreviousPage != null)
                {
                    Response.Redirect(PreviousPage.AppRelativeVirtualPath);
                }
                else
                {
                    Response.Redirect("Default.aspx");
                }
            }
            catch (System.Exception ex)
            {
                handleError(ex, false);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Requests the authentication session for login.
        /// </summary>
        /// <param name='secsignidString'>the secsign id the authentication session is for</param>
        private void requestAuthSessionForLogin(string secsignidString)
        {
            // request authentication session
            SecSignIDApi secSignIDApi = null;
            AuthSession  authSession  = null;

            try
            {
                secSignIDApi = new SecSignIDApi();
                authSession  = secSignIDApi.RequestAuthSession(secsignidString, "ASP.NET example how to use SecSignIDApi", Request.Url.Authority);

                // set all values
                this.secsignid.Value           = authSession.GetSecSignID();
                this.authsessionid.Value       = authSession.GetAuthSessionID();
                this.requestid.Value           = authSession.GetRequestID();
                this.servicename.Value         = authSession.GetRequestingService();
                this.serviceaddress.Value      = authSession.GetRequestingServiceAddress();
                this.authsessionicondata.Value = authSession.GetIconData();

                this.authSessionIconDisplay.Src = "data:image/png;base64," + authSession.GetIconData();
                this.authSessionIconDisplay.Alt = "SecSign ID Access Pass Icon";
            }
            catch (System.Net.WebException ex)
            {
                handleError(ex, false);
            }
            catch (System.Exception ex)
            {
                if (secSignIDApi != null && authSession != null)
                {
                    // we could get an auth session which has to be canceled now
                    try
                    {
                        secSignIDApi.CancelAuthSession(authSession);
                    }
                    catch {}
                }
                handleError(ex, false);
            }
        }