aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Services/AuthenticationService
diff options
context:
space:
mode:
authorMelanie2010-01-10 01:46:56 +0000
committerMelanie2010-01-10 01:46:56 +0000
commit7403f2fd366cc96cd65ba95d7fba68dce1846982 (patch)
treed96022c04cb73cd8da0a57fe6c96589ada2819a0 /OpenSim/Services/AuthenticationService
parentFinally the region service config stuff is in. (diff)
parent* Moved command reset password from OpenSim to UserAccountService. (diff)
downloadopensim-SC_OLD-7403f2fd366cc96cd65ba95d7fba68dce1846982.zip
opensim-SC_OLD-7403f2fd366cc96cd65ba95d7fba68dce1846982.tar.gz
opensim-SC_OLD-7403f2fd366cc96cd65ba95d7fba68dce1846982.tar.bz2
opensim-SC_OLD-7403f2fd366cc96cd65ba95d7fba68dce1846982.tar.xz
Merge branch 'presence-refactor' of melanie@opensimulator.org:/var/git/opensim into presence-refactor
Diffstat (limited to 'OpenSim/Services/AuthenticationService')
-rw-r--r--OpenSim/Services/AuthenticationService/AuthenticationServiceBase.cs29
1 files changed, 26 insertions, 3 deletions
diff --git a/OpenSim/Services/AuthenticationService/AuthenticationServiceBase.cs b/OpenSim/Services/AuthenticationService/AuthenticationServiceBase.cs
index dcf090e..f6dd085 100644
--- a/OpenSim/Services/AuthenticationService/AuthenticationServiceBase.cs
+++ b/OpenSim/Services/AuthenticationService/AuthenticationServiceBase.cs
@@ -32,6 +32,7 @@ using Nini.Config;
32using System.Reflection; 32using System.Reflection;
33using OpenSim.Services.Base; 33using OpenSim.Services.Base;
34using OpenSim.Data; 34using OpenSim.Data;
35using OpenSim.Framework;
35 36
36namespace OpenSim.Services.AuthenticationService 37namespace OpenSim.Services.AuthenticationService
37{ 38{
@@ -43,9 +44,9 @@ namespace OpenSim.Services.AuthenticationService
43 // 44 //
44 public class AuthenticationServiceBase : ServiceBase 45 public class AuthenticationServiceBase : ServiceBase
45 { 46 {
46// private static readonly ILog m_log = 47 private static readonly ILog m_log =
47// LogManager.GetLogger( 48 LogManager.GetLogger(
48// MethodBase.GetCurrentMethod().DeclaringType); 49 MethodBase.GetCurrentMethod().DeclaringType);
49 50
50 protected IAuthenticationData m_Database; 51 protected IAuthenticationData m_Database;
51 52
@@ -100,6 +101,27 @@ namespace OpenSim.Services.AuthenticationService
100 return m_Database.CheckToken(principalID, token, 0); 101 return m_Database.CheckToken(principalID, token, 0);
101 } 102 }
102 103
104 public virtual bool SetPassword(UUID principalID, string password)
105 {
106 string passwordSalt = Util.Md5Hash(UUID.Random().ToString());
107 string md5PasswdHash = Util.Md5Hash(Util.Md5Hash(password) + ":" + passwordSalt);
108
109 AuthenticationData auth = new AuthenticationData();
110 auth.PrincipalID = principalID;
111 auth.Data = new System.Collections.Generic.Dictionary<string, object>();
112 auth.Data["passwordHash"] = md5PasswdHash;
113 auth.Data["passwordSalt"] = passwordSalt;
114 auth.Data["webLoginKey"] = UUID.Zero.ToString();
115 if (!m_Database.Store(auth))
116 {
117 m_log.DebugFormat("[AUTHENTICATION DB]: Failed to store authentication data");
118 return false;
119 }
120
121 m_log.InfoFormat("[AUTHENTICATION DB]: Set password for principalID {0}", principalID);
122 return true;
123 }
124
103 protected string GetToken(UUID principalID, int lifetime) 125 protected string GetToken(UUID principalID, int lifetime)
104 { 126 {
105 UUID token = UUID.Random(); 127 UUID token = UUID.Random();
@@ -109,5 +131,6 @@ namespace OpenSim.Services.AuthenticationService
109 131
110 return String.Empty; 132 return String.Empty;
111 } 133 }
134
112 } 135 }
113} 136}