diff options
Diffstat (limited to 'OpenSim/Services/AuthenticationService/AuthenticationServiceBase.cs')
-rw-r--r-- | OpenSim/Services/AuthenticationService/AuthenticationServiceBase.cs | 46 |
1 files changed, 45 insertions, 1 deletions
diff --git a/OpenSim/Services/AuthenticationService/AuthenticationServiceBase.cs b/OpenSim/Services/AuthenticationService/AuthenticationServiceBase.cs index 5980f0c..e42f9a0 100644 --- a/OpenSim/Services/AuthenticationService/AuthenticationServiceBase.cs +++ b/OpenSim/Services/AuthenticationService/AuthenticationServiceBase.cs | |||
@@ -30,11 +30,11 @@ using OpenMetaverse; | |||
30 | using log4net; | 30 | using log4net; |
31 | using Nini.Config; | 31 | using Nini.Config; |
32 | using System.Reflection; | 32 | using System.Reflection; |
33 | using OpenSim.Services.Base; | ||
34 | using OpenSim.Server.Base; | 33 | using OpenSim.Server.Base; |
35 | using OpenSim.Services.Interfaces; | 34 | using OpenSim.Services.Interfaces; |
36 | using OpenSim.Data; | 35 | using OpenSim.Data; |
37 | using OpenSim.Framework; | 36 | using OpenSim.Framework; |
37 | using OpenSim.Services.Base; | ||
38 | 38 | ||
39 | namespace OpenSim.Services.AuthenticationService | 39 | namespace OpenSim.Services.AuthenticationService |
40 | { | 40 | { |
@@ -134,6 +134,50 @@ namespace OpenSim.Services.AuthenticationService | |||
134 | m_log.InfoFormat("[AUTHENTICATION DB]: Set password for principalID {0}", principalID); | 134 | m_log.InfoFormat("[AUTHENTICATION DB]: Set password for principalID {0}", principalID); |
135 | return true; | 135 | return true; |
136 | } | 136 | } |
137 | |||
138 | public virtual AuthInfo GetAuthInfo(UUID principalID) | ||
139 | { | ||
140 | AuthenticationData data = m_Database.Get(principalID); | ||
141 | |||
142 | if (data == null) | ||
143 | { | ||
144 | return null; | ||
145 | } | ||
146 | else | ||
147 | { | ||
148 | AuthInfo info | ||
149 | = new AuthInfo() | ||
150 | { | ||
151 | PrincipalID = data.PrincipalID, | ||
152 | AccountType = data.Data["accountType"] as string, | ||
153 | PasswordHash = data.Data["passwordHash"] as string, | ||
154 | PasswordSalt = data.Data["passwordSalt"] as string, | ||
155 | WebLoginKey = data.Data["webLoginKey"] as string | ||
156 | }; | ||
157 | |||
158 | return info; | ||
159 | } | ||
160 | } | ||
161 | |||
162 | public virtual bool SetAuthInfo(AuthInfo info) | ||
163 | { | ||
164 | AuthenticationData auth = new AuthenticationData(); | ||
165 | auth.PrincipalID = info.PrincipalID; | ||
166 | auth.Data = new System.Collections.Generic.Dictionary<string, object>(); | ||
167 | auth.Data["accountType"] = info.AccountType; | ||
168 | auth.Data["webLoginKey"] = info.WebLoginKey; | ||
169 | auth.Data["passwordHash"] = info.PasswordHash; | ||
170 | auth.Data["passwordSalt"] = info.PasswordSalt; | ||
171 | |||
172 | if (!m_Database.Store(auth)) | ||
173 | { | ||
174 | m_log.ErrorFormat("[AUTHENTICATION DB]: Failed to store authentication info."); | ||
175 | return false; | ||
176 | } | ||
177 | |||
178 | m_log.DebugFormat("[AUTHENTICATION DB]: Set authentication info for principalID {0}", info.PrincipalID); | ||
179 | return true; | ||
180 | } | ||
137 | 181 | ||
138 | protected string GetToken(UUID principalID, int lifetime) | 182 | protected string GetToken(UUID principalID, int lifetime) |
139 | { | 183 | { |