Example #1
0
        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 bool SetAuthInfo(AuthInfo info)
        {
            AuthenticationData auth = new AuthenticationData();

            auth.PrincipalID          = info.PrincipalID;
            auth.Data                 = new System.Collections.Generic.Dictionary <string, object>();
            auth.Data["accountType"]  = info.AccountType;
            auth.Data["webLoginKey"]  = info.WebLoginKey;
            auth.Data["passwordHash"] = info.PasswordHash;
            auth.Data["passwordSalt"] = info.PasswordSalt;

            if (!m_Database.Store(auth))
            {
                m_log.ErrorFormat("[AUTHENTICATION DB]: Failed to store authentication info.");
                return(false);
            }

            m_log.DebugFormat("[AUTHENTICATION DB]: Set authentication info for principalID {0}", info.PrincipalID);
            return(true);
        }
Example #3
0
        bool SaveAuth(AuthData auth, UUID principalID)
        {
            if (!m_Database.Store(auth))
            {
                MainConsole.Instance.DebugFormat("[Authentication DB]: Failed to store authentication data");
                return(false);
            }

            MainConsole.Instance.InfoFormat("[Authentication DB]: Set password for principalID {0}", principalID);
            return(true);
        }
        public virtual bool SetPassword(UUID principalID, string authType, string password)
        {
            string passwordSalt  = Util.Md5Hash(UUID.Random().ToString());
            string md5PasswdHash = Util.Md5Hash(Util.Md5Hash(password) + ":" + passwordSalt);

            AuthData auth = m_Database.Get(principalID, authType);

            if (auth == null)
            {
                auth = new AuthData {
                    PrincipalID = principalID, AccountType = authType
                };
            }
            auth.PasswordHash = md5PasswdHash;
            auth.PasswordSalt = passwordSalt;
            if (!m_Database.Store(auth))
            {
                MainConsole.Instance.DebugFormat("[AUTHENTICATION DB]: Failed to store authentication data");
                return(false);
            }

            MainConsole.Instance.InfoFormat("[AUTHENTICATION DB]: Set password for principalID {0}", principalID);
            return(true);
        }