public string GetUsername(Guid key) { if (!KeyToUser.ContainsKey(key)) { return(""); } return(KeyToUser[key].ToString()); }
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); }
public bool CheckAjaxAuthKey(Guid key) { return(KeyToUser.ContainsKey(key)); }