public virtual bool SetPassword(UUID principalID, string password) { string passwordSalt = Util.Md5Hash(UUID.Random().ToString()); string md5PasswdHash = Util.Md5Hash(Util.Md5Hash(password) + ":" + passwordSalt); AuthenticationData auth = m_Database.Get(principalID); if (auth == null) { auth = new AuthenticationData(); auth.PrincipalID = principalID; auth.Data = new System.Collections.Generic.Dictionary <string, object>(); auth.Data["accountType"] = "UserAccount"; auth.Data["webLoginKey"] = UUID.Zero.ToString(); } auth.Data["passwordHash"] = md5PasswdHash; auth.Data["passwordSalt"] = passwordSalt; if (!m_Database.Store(auth)) { m_log.DebugFormat("[AUTHENTICATION DB]: Failed to store authentication data"); return(false); } m_log.InfoFormat("[AUTHENTICATION DB]: Set password for principalID {0}", principalID); return(true); }
public virtual AuthInfo GetAuthInfo(UUID principalID) { AuthenticationData data = m_Database.Get(principalID); if (data == null) { return(null); } else { AuthInfo info = new AuthInfo() { PrincipalID = data.PrincipalID, AccountType = data.Data["accountType"] as string, PasswordHash = data.Data["passwordHash"] as string, PasswordSalt = data.Data["passwordSalt"] as string, WebLoginKey = data.Data["webLoginKey"] as string }; return(info); } }
public bool CheckExists(UUID principalID, string authType) { return(m_Database.Get(principalID, authType) != null); }
public bool CheckExists(UUID principalID) { return(m_Database.Get(principalID) != null); }