aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Services
diff options
context:
space:
mode:
authorMelanie2011-10-25 03:26:09 +0100
committerMelanie2011-10-25 03:26:09 +0100
commit4e9457ca0c8669a0d47341c651d5f439fda1eb8d (patch)
tree002620738b62275e4dca20a56b701b5ac8b7642d /OpenSim/Services
parentMerge commit 'b868328d519cfb3db597f684fd1f947912fc2222' into bigmerge (diff)
parentAdd optional getauthinfo and setauthinfo authentication service calls. (diff)
downloadopensim-SC_OLD-4e9457ca0c8669a0d47341c651d5f439fda1eb8d.zip
opensim-SC_OLD-4e9457ca0c8669a0d47341c651d5f439fda1eb8d.tar.gz
opensim-SC_OLD-4e9457ca0c8669a0d47341c651d5f439fda1eb8d.tar.bz2
opensim-SC_OLD-4e9457ca0c8669a0d47341c651d5f439fda1eb8d.tar.xz
Merge commit '4c9400e6460a73baa2d687afe73a62c6efca9f37' into bigmerge
Conflicts: OpenSim/Services/AuthenticationService/AuthenticationServiceBase.cs
Diffstat (limited to 'OpenSim/Services')
-rw-r--r--OpenSim/Services/AuthenticationService/AuthenticationServiceBase.cs46
-rw-r--r--OpenSim/Services/Connectors/Authentication/AuthenticationServiceConnector.cs12
-rw-r--r--OpenSim/Services/Connectors/SimianGrid/SimianAuthenticationServiceConnector.cs10
-rw-r--r--OpenSim/Services/Interfaces/IAuthenticationService.cs26
4 files changed, 93 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;
30using log4net; 30using log4net;
31using Nini.Config; 31using Nini.Config;
32using System.Reflection; 32using System.Reflection;
33using OpenSim.Services.Base;
34using OpenSim.Server.Base; 33using OpenSim.Server.Base;
35using OpenSim.Services.Interfaces; 34using OpenSim.Services.Interfaces;
36using OpenSim.Data; 35using OpenSim.Data;
37using OpenSim.Framework; 36using OpenSim.Framework;
37using OpenSim.Services.Base;
38 38
39namespace OpenSim.Services.AuthenticationService 39namespace 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 {
diff --git a/OpenSim/Services/Connectors/Authentication/AuthenticationServiceConnector.cs b/OpenSim/Services/Connectors/Authentication/AuthenticationServiceConnector.cs
index c04e7a4..2b77154 100644
--- a/OpenSim/Services/Connectors/Authentication/AuthenticationServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Authentication/AuthenticationServiceConnector.cs
@@ -151,5 +151,17 @@ namespace OpenSim.Services.Connectors
151 // nope, we don't do this 151 // nope, we don't do this
152 return false; 152 return false;
153 } 153 }
154
155 public AuthInfo GetAuthInfo(UUID principalID)
156 {
157 // not done from remote simulators
158 return null;
159 }
160
161 public bool SetAuthInfo(AuthInfo info)
162 {
163 // not done from remote simulators
164 return false;
165 }
154 } 166 }
155} 167}
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianAuthenticationServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianAuthenticationServiceConnector.cs
index 51a09f8..69f6ed2 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianAuthenticationServiceConnector.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianAuthenticationServiceConnector.cs
@@ -236,6 +236,16 @@ namespace OpenSim.Services.Connectors.SimianGrid
236 return false; 236 return false;
237 } 237 }
238 238
239 public AuthInfo GetAuthInfo(UUID principalID)
240 {
241 throw new NotImplementedException();
242 }
243
244 public bool SetAuthInfo(AuthInfo info)
245 {
246 throw new NotImplementedException();
247 }
248
239 private bool CheckPassword(UUID userID, string password, string simianGridCredential, out string authorizeResult) 249 private bool CheckPassword(UUID userID, string password, string simianGridCredential, out string authorizeResult)
240 { 250 {
241 if (simianGridCredential.Contains(":")) 251 if (simianGridCredential.Contains(":"))
diff --git a/OpenSim/Services/Interfaces/IAuthenticationService.cs b/OpenSim/Services/Interfaces/IAuthenticationService.cs
index 9de261b..cee8bc0 100644
--- a/OpenSim/Services/Interfaces/IAuthenticationService.cs
+++ b/OpenSim/Services/Interfaces/IAuthenticationService.cs
@@ -26,10 +26,32 @@
26 */ 26 */
27 27
28using System; 28using System;
29using System.Collections.Generic;
29using OpenMetaverse; 30using OpenMetaverse;
30 31
31namespace OpenSim.Services.Interfaces 32namespace OpenSim.Services.Interfaces
32{ 33{
34 public class AuthInfo
35 {
36 public UUID PrincipalID { get; set; }
37 public string AccountType { get; set; }
38 public string PasswordHash { get; set; }
39 public string PasswordSalt { get; set; }
40 public string WebLoginKey { get; set; }
41
42 public Dictionary<string, object> ToKeyValuePairs()
43 {
44 Dictionary<string, object> result = new Dictionary<string, object>();
45 result["PrincipalID"] = PrincipalID;
46 result["AccountType"] = AccountType;
47 result["PasswordHash"] = PasswordHash;
48 result["PasswordSalt"] = PasswordSalt;
49 result["WebLoginKey"] = WebLoginKey;
50
51 return result;
52 }
53 }
54
33 // Generic Authentication service used for identifying 55 // Generic Authentication service used for identifying
34 // and authenticating principals. 56 // and authenticating principals.
35 // Principals may be clients acting on users' behalf, 57 // Principals may be clients acting on users' behalf,
@@ -76,6 +98,10 @@ namespace OpenSim.Services.Interfaces
76 // 98 //
77 bool SetPassword(UUID principalID, string passwd); 99 bool SetPassword(UUID principalID, string passwd);
78 100
101 AuthInfo GetAuthInfo(UUID principalID);
102
103 bool SetAuthInfo(AuthInfo info);
104
79 ////////////////////////////////////////////////////// 105 //////////////////////////////////////////////////////
80 // Grid 106 // Grid
81 // 107 //