aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Services/Connectors/SimianGrid/SimianAuthenticationServiceConnector.cs
diff options
context:
space:
mode:
authorMelanie2010-03-30 21:34:27 +0100
committerMelanie2010-03-30 21:34:27 +0100
commit5693870fe26fae35a28f2d5103780434f4f40e57 (patch)
tree0e070fb6f11ab8763ac4f1f9a851a0061101d4d6 /OpenSim/Services/Connectors/SimianGrid/SimianAuthenticationServiceConnector.cs
parentMerge branch 'careminster-presence-refactor' of ssh://3dhosting.de/var/git/ca... (diff)
parentminor: commented out code removal (diff)
downloadopensim-SC-5693870fe26fae35a28f2d5103780434f4f40e57.zip
opensim-SC-5693870fe26fae35a28f2d5103780434f4f40e57.tar.gz
opensim-SC-5693870fe26fae35a28f2d5103780434f4f40e57.tar.bz2
opensim-SC-5693870fe26fae35a28f2d5103780434f4f40e57.tar.xz
Merge branch 'master' into careminster-presence-refactor
Diffstat (limited to '')
-rw-r--r--OpenSim/Services/Connectors/SimianGrid/SimianAuthenticationServiceConnector.cs57
1 files changed, 47 insertions, 10 deletions
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianAuthenticationServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianAuthenticationServiceConnector.cs
index cc53d6c..e78429d 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianAuthenticationServiceConnector.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianAuthenticationServiceConnector.cs
@@ -78,14 +78,14 @@ namespace OpenSim.Services.Connectors.SimianGrid
78 IConfig assetConfig = source.Configs["AuthenticationService"]; 78 IConfig assetConfig = source.Configs["AuthenticationService"];
79 if (assetConfig == null) 79 if (assetConfig == null)
80 { 80 {
81 m_log.Error("[AUTH CONNECTOR]: AuthenticationService missing from OpenSim.ini"); 81 m_log.Error("[SIMIAN AUTH CONNECTOR]: AuthenticationService missing from OpenSim.ini");
82 throw new Exception("Authentication connector init error"); 82 throw new Exception("Authentication connector init error");
83 } 83 }
84 84
85 string serviceURI = assetConfig.GetString("AuthenticationServerURI"); 85 string serviceURI = assetConfig.GetString("AuthenticationServerURI");
86 if (String.IsNullOrEmpty(serviceURI)) 86 if (String.IsNullOrEmpty(serviceURI))
87 { 87 {
88 m_log.Error("[AUTH CONNECTOR]: No Server URI named in section AuthenticationService"); 88 m_log.Error("[SIMIAN AUTH CONNECTOR]: No Server URI named in section AuthenticationService");
89 throw new Exception("Authentication connector init error"); 89 throw new Exception("Authentication connector init error");
90 } 90 }
91 91
@@ -114,17 +114,17 @@ namespace OpenSim.Services.Connectors.SimianGrid
114 { 114 {
115 string credential = identity["Credential"].AsString(); 115 string credential = identity["Credential"].AsString();
116 116
117 if (password == credential || Utils.MD5String(password) == credential) 117 if (password == credential || "$1$" + Utils.MD5String(password) == credential)
118 return Authorize(principalID); 118 return Authorize(principalID);
119 } 119 }
120 } 120 }
121 } 121 }
122 122
123 m_log.Warn("[AUTH CONNECTOR]: Authentication failed for " + principalID); 123 m_log.Warn("[SIMIAN AUTH CONNECTOR]: Authentication failed for " + principalID);
124 } 124 }
125 else 125 else
126 { 126 {
127 m_log.Warn("[AUTH CONNECTOR]: Failed to retrieve identities for " + principalID + ": " + 127 m_log.Warn("[SIMIAN AUTH CONNECTOR]: Failed to retrieve identities for " + principalID + ": " +
128 response["Message"].AsString()); 128 response["Message"].AsString());
129 } 129 }
130 130
@@ -146,7 +146,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
146 } 146 }
147 else 147 else
148 { 148 {
149 m_log.Warn("[AUTH CONNECTOR]: Could not verify session for " + principalID + ": " + 149 m_log.Warn("[SIMIAN AUTH CONNECTOR]: Could not verify session for " + principalID + ": " +
150 response["Message"].AsString()); 150 response["Message"].AsString());
151 } 151 }
152 152
@@ -168,7 +168,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
168 } 168 }
169 else 169 else
170 { 170 {
171 m_log.Warn("[AUTH CONNECTOR]: Failed to remove session for " + principalID + ": " + 171 m_log.Warn("[SIMIAN AUTH CONNECTOR]: Failed to remove session for " + principalID + ": " +
172 response["Message"].AsString()); 172 response["Message"].AsString());
173 } 173 }
174 174
@@ -177,9 +177,46 @@ namespace OpenSim.Services.Connectors.SimianGrid
177 177
178 public bool SetPassword(UUID principalID, string passwd) 178 public bool SetPassword(UUID principalID, string passwd)
179 { 179 {
180 // TODO: Use GetIdentities to find the md5hash identity for principalID 180 // Fetch the user name first
181 // and then update it with AddIdentity 181 NameValueCollection requestArgs = new NameValueCollection
182 m_log.Error("[AUTH CONNECTOR]: Changing passwords is not implemented yet"); 182 {
183 { "RequestMethod", "GetUser" },
184 { "UserID", principalID.ToString() }
185 };
186
187 OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs);
188 if (response["Success"].AsBoolean() && response["User"] is OSDMap)
189 {
190 OSDMap userMap = (OSDMap)response["User"];
191 string identifier = userMap["Name"].AsString();
192
193 if (!String.IsNullOrEmpty(identifier))
194 {
195 // Add/update the md5hash identity
196 requestArgs = new NameValueCollection
197 {
198 { "RequestMethod", "AddIdentity" },
199 { "Identifier", identifier },
200 { "Credential", "$1$" + Utils.MD5String(passwd) },
201 { "Type", "md5hash" },
202 { "UserID", principalID.ToString() }
203 };
204
205 response = WebUtil.PostToService(m_serverUrl, requestArgs);
206 bool success = response["Success"].AsBoolean();
207
208 if (!success)
209 m_log.WarnFormat("[SIMIAN AUTH CONNECTOR]: Failed to set password for {0} ({1})", identifier, principalID);
210
211 return success;
212 }
213 }
214 else
215 {
216 m_log.Warn("[SIMIAN AUTH CONNECTOR]: Failed to retrieve identities for " + principalID + ": " +
217 response["Message"].AsString());
218 }
219
183 return false; 220 return false;
184 } 221 }
185 222