diff options
author | Justin Clark-Casey (justincc) | 2011-10-24 21:34:44 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2011-10-24 21:40:36 +0100 |
commit | 4c9400e6460a73baa2d687afe73a62c6efca9f37 (patch) | |
tree | 9302270fbf46288ef5aeccbac0c0925e6f1a118b /OpenSim/Services/AuthenticationService/AuthenticationServiceBase.cs | |
parent | Comment out the uuid gatherer lines that I accidentally left in. (diff) | |
download | opensim-SC-4c9400e6460a73baa2d687afe73a62c6efca9f37.zip opensim-SC-4c9400e6460a73baa2d687afe73a62c6efca9f37.tar.gz opensim-SC-4c9400e6460a73baa2d687afe73a62c6efca9f37.tar.bz2 opensim-SC-4c9400e6460a73baa2d687afe73a62c6efca9f37.tar.xz |
Add optional getauthinfo and setauthinfo authentication service calls.
These are disabled by default, as before. Please only turn these on in secure grids, since they allow the same facilities as the existing SetPassword call (also disabled by default)
These facilities can be helpful when integrating external systems, in addition to the existing option of adapting an IAuthenticationService or using WebLoginKey
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Services/AuthenticationService/AuthenticationServiceBase.cs | 47 |
1 files changed, 46 insertions, 1 deletions
diff --git a/OpenSim/Services/AuthenticationService/AuthenticationServiceBase.cs b/OpenSim/Services/AuthenticationService/AuthenticationServiceBase.cs index edc1097..229f557 100644 --- a/OpenSim/Services/AuthenticationService/AuthenticationServiceBase.cs +++ b/OpenSim/Services/AuthenticationService/AuthenticationServiceBase.cs | |||
@@ -30,9 +30,10 @@ 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.Data; | 33 | using OpenSim.Data; |
35 | using OpenSim.Framework; | 34 | using OpenSim.Framework; |
35 | using OpenSim.Services.Base; | ||
36 | using OpenSim.Services.Interfaces; | ||
36 | 37 | ||
37 | namespace OpenSim.Services.AuthenticationService | 38 | namespace OpenSim.Services.AuthenticationService |
38 | { | 39 | { |
@@ -126,6 +127,50 @@ namespace OpenSim.Services.AuthenticationService | |||
126 | m_log.InfoFormat("[AUTHENTICATION DB]: Set password for principalID {0}", principalID); | 127 | m_log.InfoFormat("[AUTHENTICATION DB]: Set password for principalID {0}", principalID); |
127 | return true; | 128 | return true; |
128 | } | 129 | } |
130 | |||
131 | public virtual AuthInfo GetAuthInfo(UUID principalID) | ||
132 | { | ||
133 | AuthenticationData data = m_Database.Get(principalID); | ||
134 | |||
135 | if (data == null) | ||
136 | { | ||
137 | return null; | ||
138 | } | ||
139 | else | ||
140 | { | ||
141 | AuthInfo info | ||
142 | = new AuthInfo() | ||
143 | { | ||
144 | PrincipalID = data.PrincipalID, | ||
145 | AccountType = data.Data["accountType"] as string, | ||
146 | PasswordHash = data.Data["passwordHash"] as string, | ||
147 | PasswordSalt = data.Data["passwordSalt"] as string, | ||
148 | WebLoginKey = data.Data["webLoginKey"] as string | ||
149 | }; | ||
150 | |||
151 | return info; | ||
152 | } | ||
153 | } | ||
154 | |||
155 | public virtual bool SetAuthInfo(AuthInfo info) | ||
156 | { | ||
157 | AuthenticationData auth = new AuthenticationData(); | ||
158 | auth.PrincipalID = info.PrincipalID; | ||
159 | auth.Data = new System.Collections.Generic.Dictionary<string, object>(); | ||
160 | auth.Data["accountType"] = info.AccountType; | ||
161 | auth.Data["webLoginKey"] = info.WebLoginKey; | ||
162 | auth.Data["passwordHash"] = info.PasswordHash; | ||
163 | auth.Data["passwordSalt"] = info.PasswordSalt; | ||
164 | |||
165 | if (!m_Database.Store(auth)) | ||
166 | { | ||
167 | m_log.ErrorFormat("[AUTHENTICATION DB]: Failed to store authentication info."); | ||
168 | return false; | ||
169 | } | ||
170 | |||
171 | m_log.DebugFormat("[AUTHENTICATION DB]: Set authentication info for principalID {0}", info.PrincipalID); | ||
172 | return true; | ||
173 | } | ||
129 | 174 | ||
130 | protected string GetToken(UUID principalID, int lifetime) | 175 | protected string GetToken(UUID principalID, int lifetime) |
131 | { | 176 | { |