예제 #1
0
 public string Delete(string token)
 {
     if (_appSettings.Value.AdminKey.Equals(token))
     {
         return(ReturnMessage.ErrorMessage("you can't delete the admin token!"));
     }
     else
     {
         TokenManager.DeleteToken(token);
         return(ReturnMessage.OkTokenMessage("token deleted", token));
     }
 }
예제 #2
0
        public UserContext Logoff(string userToken)
        {
            UserContext user = TokenManager.GetUser(userToken);

            if (user != null)
            {
                TokenManager.DeleteToken(userToken);
            }
            Action <string> afterLogoffHandler = this.AfterLogoffHandler;

            if (afterLogoffHandler != null)
            {
                afterLogoffHandler(userToken);
            }
            return(user);
        }
예제 #3
0
        /// <summary>
        /// Destroys connection between this client and server and marks this socket as free (null)
        /// </summary>
        public void Disconnect(string disconnectReason = null) //todo send disconnect reason (todo by enum)
        {
            Log.WriteLine("Disconnected", this);

            //If i was in room i disconnect. //TODO wait for reconnect if it was not intentional
            if (this.IsInRoom)
            {
                //if client was in room then wait for him to return
                RoomManager.OnClientDisconnectedSuddenly(ConnectionId);
            }

            Session = null;

            ClientManager.Disconnect(ConnectionId);
            TokenManager.DeleteToken(AuthToken);
        }
예제 #4
0
 public HttpResponseMessage SignOut()
 {
     TokenManager.DeleteToken(AccessToken);
     return(Success());
 }
 private void LogOutButton_OnClicked(object sender, EventArgs e)
 {
     TokenManager.DeleteToken();
     Application.Current.MainPage = new LoginView();
 }