Esempio n. 1
0
        protected async void Page_Load(object sender, EventArgs e)
        {
            try

            {
                if (("log_out").Equals(Request.QueryString["mode"]))
                {
                    if (HttpContext.Current.Application["AccessToken"] != null)
                    {
                        AmazonCognitoIdentityProviderClient provider = new AmazonCognitoIdentityProviderClient(new Amazon.Runtime.AnonymousAWSCredentials());
                        GlobalSignOutRequest globalSignOutRequest    = new GlobalSignOutRequest()
                        {
                            AccessToken = HttpContext.Current.Application["AccessToken"].ToString()
                        };
                        await provider.GlobalSignOutAsync(globalSignOutRequest);

                        HttpContext.Current.Application["AccessToken"] = null;
                        Response.Redirect("Default.aspx");
                    }
                    else
                    {
                        ScriptManager.RegisterClientScriptBlock(this.Page, this.Page.GetType(), "alert", "alert('Token not detected');" +
                                                                "window.location.href='Login.aspx';", true);
                    }
                }
            }
            catch (Exception ex)
            {
                var message = new JavaScriptSerializer().Serialize(ex.Message.ToString());
                var script  = string.Format("alert({0});", message);
                this.Page.ClientScript.RegisterStartupScript(this.GetType(), "ex", script, true);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Sign-out from all devices associated with this user using an asynchronous call
        /// </summary>
        public virtual Task GlobalSignOutAsync()
        {
            EnsureUserAuthenticated();

            GlobalSignOutRequest globalSignOutRequest = new GlobalSignOutRequest()
            {
                AccessToken = SessionTokens.AccessToken
            };

            SessionTokens = null;
            return(Provider.GlobalSignOutAsync(globalSignOutRequest));
        }
Esempio n. 3
0
        /// <summary>
        /// Sign-out from all devices associated with this user using an asynchronous call
        /// </summary>
        public void GlobalSignOutAsync(AsyncCallback callback = null)
        {
            EnsureUserAuthenticated();

            GlobalSignOutRequest globalSignOutRequest = new GlobalSignOutRequest()
            {
                AccessToken = SessionTokens.AccessToken
            };

            SessionTokens = null;
            Provider.GlobalSignOutAsync(globalSignOutRequest, r => callback?.Invoke(new AsyncResult(r.Exception)));
        }
        public async Task SignOut(SignOutRequest request, CancellationToken cancellationToken = default)
        {
            Check.NotNull(request, nameof(request));

            request.EnsureIsValid();

            var signOutRequest = new GlobalSignOutRequest
            {
                AccessToken = request.AccessToken
            };

            try
            {
                await base.CreateDefaultRetryAsyncPolicy().ExecuteAsync(async() =>
                                                                        await CognitoidentityProvider.GlobalSignOutAsync(signOutRequest, cancellationToken));
            }
            catch (Exception ex)
            {
                throw CatchException(ex);
            }
        }
 public void GlobalSignOutAsync(GlobalSignOutRequest request, AmazonServiceCallback <GlobalSignOutRequest, GlobalSignOutResponse> callback, AsyncOptions options = null)
 {
     throw new System.NotImplementedException();
 }