Ejemplo n.º 1
0
        public string Get(LogoutUser request, IHttpRequest req)
        {
            var token = req.Headers.Get("Authorization");

            TokenBusinessLogic.DeleteToken(token);
            return("logged out");
        }
Ejemplo n.º 2
0
 private void RegisterCommands()
 {
     _commands.Add(new Command("LoginUser", "\\login", () => LoginUser?.Invoke(this, new EventArgs())));
     _commands.Add(new Command("LogoutUser", "\\logout", () => LogoutUser?.Invoke(this, new EventArgs())));
     _commands.Add(new Command("ClearConsole", "\\clear", () => ClearConsole?.Invoke(this, new EventArgs())));
     _commands.Add(new Command("ShowUsers", "\\whois", () => ShowUsers?.Invoke(this, new EventArgs())));
     _commands.Add(new Command("JoinChat", "\\join", () => JoinChat?.Invoke(this, new EventArgs())));
 }
Ejemplo n.º 3
0
        public async Task <IActionResult> OnPostLogoutAsync(LogoutUser token)
        {
            string        json        = JsonConvert.SerializeObject(token);
            StringContent httpContent = new StringContent(json, Encoding.UTF8, "application/json");

            HttpResponseMessage response = await _client.PostAsync(_identityServiceUrl + "logout/", httpContent);

            if (response.StatusCode == HttpStatusCode.OK)
            {
                return(Ok());
            }
            else
            {
                ModelState.AddModelError(string.Empty, "Invalid logout attempt.");
                return(Unauthorized(ModelState));
            }
        }
Ejemplo n.º 4
0
        public OperationResponse <bool> Get(LogoutUser request)
        {
            OperationResponse <bool> result = new OperationResponse <bool>();

            try
            {
                var token = HttpContext.Current.Request.Headers.Get("Authorization");
                TokenBusinessLogic.DeleteToken(token);
                result.OnSuccess(true, "logged out");
                return(result);
            }
            catch (Exception e)
            {
                Log.Error(e.Message + " " + e.StackTrace);
                result.OnException("token deletion failed");
                return(result);
            }
        }
Ejemplo n.º 5
0
 public void Handle(LogoutUser c)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 6
0
 public ActionResult Logout(LogoutUser model)
 {
     _commander.Send(model);
     return(Redirect("/"));
 }
Ejemplo n.º 7
0
 public ActionResult Logout(LogoutUser logoutUser)
 {
     return(Send(logoutUser, x => RedirectToAction("Index")));
 }
Ejemplo n.º 8
0
        public ActionResult Logout(LogoutUser token)
        {
            service.Logout(token.Token);

            return(Ok());
        }