Exemplo n.º 1
0
 public string GetUsername(Guid key)
 {
     if (!KeyToUser.ContainsKey(key))
     {
         return("");
     }
     return(KeyToUser[key].ToString());
 }
Exemplo n.º 2
0
        public Guid StoreAjaxAuthKey(string username)
        {
            Guid key = Guid.NewGuid();                 //new unique key for the user

            KeyToUser.Add(key, username);              //add the new key to the list
            if (UserToKey.ContainsKey(username))       //if an existing login for this user exists, remove it
            {
                KeyToUser.Remove(UserToKey[username]); //only one login window at a time, please
                UserToKey.Remove(username);            //remove the old username-to-key mapping
            }
            UserToKey.Add(username, key);              //add a new username-to-key mapping

            if (OnAjaxAuthKeyStored != null)
            {
                OnAjaxAuthKeyStored(username, key);
            }

            return(key);
        }
Exemplo n.º 3
0
 public bool CheckAjaxAuthKey(Guid key)
 {
     return(KeyToUser.ContainsKey(key));
 }