public HttpResponseMessage LogOut() { try { var identity = (User.Identity as ClaimsIdentity); var clientId = identity.Claims.Where(c => c.Type == "ClientId").Select(c => c.Value).FirstOrDefault(); var refreshToken = identity.Claims.Where(c => c.Type == "RefreshToken").Select(c => c.Value).FirstOrDefault(); var command = new RemoveRefreshToken() { ClientId = clientId, RefreshToken = Guid.Parse(refreshToken) }; this.commandBus.Send(command); return new HttpResponseMessage(HttpStatusCode.OK); } catch { return new HttpResponseMessage(HttpStatusCode.BadRequest); } }
public HttpResponseMessage RemoveToken(string clientId, string refreshToken) { try { var command = new RemoveRefreshToken() { ClientId = clientId, RefreshToken = Guid.Parse(refreshToken) }; this.commandBus.Send(command); } catch { } return new HttpResponseMessage(HttpStatusCode.OK); }