aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Server/Handlers/Authentication
diff options
context:
space:
mode:
authorDavid Walter Seikel2016-11-03 21:44:39 +1000
committerDavid Walter Seikel2016-11-03 21:44:39 +1000
commit134f86e8d5c414409631b25b8c6f0ee45fbd8631 (patch)
tree216b89d3fb89acfb81be1e440c25c41ab09fa96d /OpenSim/Server/Handlers/Authentication
parentMore changing to production grid. Double oops. (diff)
downloadopensim-SC_OLD-134f86e8d5c414409631b25b8c6f0ee45fbd8631.zip
opensim-SC_OLD-134f86e8d5c414409631b25b8c6f0ee45fbd8631.tar.gz
opensim-SC_OLD-134f86e8d5c414409631b25b8c6f0ee45fbd8631.tar.bz2
opensim-SC_OLD-134f86e8d5c414409631b25b8c6f0ee45fbd8631.tar.xz
Initial update to OpenSim 0.8.2.1 source code.
Diffstat (limited to 'OpenSim/Server/Handlers/Authentication')
-rw-r--r--OpenSim/Server/Handlers/Authentication/AuthenticationServerConnector.cs5
-rw-r--r--OpenSim/Server/Handlers/Authentication/AuthenticationServerPostHandler.cs27
-rw-r--r--OpenSim/Server/Handlers/Authentication/OpenIdServerHandler.cs30
3 files changed, 24 insertions, 38 deletions
diff --git a/OpenSim/Server/Handlers/Authentication/AuthenticationServerConnector.cs b/OpenSim/Server/Handlers/Authentication/AuthenticationServerConnector.cs
index 848a037..c9a8dce 100644
--- a/OpenSim/Server/Handlers/Authentication/AuthenticationServerConnector.cs
+++ b/OpenSim/Server/Handlers/Authentication/AuthenticationServerConnector.cs
@@ -29,6 +29,7 @@ using System;
29using Nini.Config; 29using Nini.Config;
30using OpenSim.Server.Base; 30using OpenSim.Server.Base;
31using OpenSim.Services.Interfaces; 31using OpenSim.Services.Interfaces;
32using OpenSim.Framework.ServiceAuth;
32using OpenSim.Framework.Servers.HttpServer; 33using OpenSim.Framework.Servers.HttpServer;
33using OpenSim.Server.Handlers.Base; 34using OpenSim.Server.Handlers.Base;
34 35
@@ -58,7 +59,9 @@ namespace OpenSim.Server.Handlers.Authentication
58 Object[] args = new Object[] { config }; 59 Object[] args = new Object[] { config };
59 m_AuthenticationService = ServerUtils.LoadPlugin<IAuthenticationService>(authenticationService, args); 60 m_AuthenticationService = ServerUtils.LoadPlugin<IAuthenticationService>(authenticationService, args);
60 61
61 server.AddStreamHandler(new AuthenticationServerPostHandler(m_AuthenticationService, serverConfig)); 62 IServiceAuth auth = ServiceAuth.Create(config, m_ConfigName);
63
64 server.AddStreamHandler(new AuthenticationServerPostHandler(m_AuthenticationService, serverConfig, auth));
62 } 65 }
63 } 66 }
64} 67}
diff --git a/OpenSim/Server/Handlers/Authentication/AuthenticationServerPostHandler.cs b/OpenSim/Server/Handlers/Authentication/AuthenticationServerPostHandler.cs
index 6b93cd9..6ee98b3 100644
--- a/OpenSim/Server/Handlers/Authentication/AuthenticationServerPostHandler.cs
+++ b/OpenSim/Server/Handlers/Authentication/AuthenticationServerPostHandler.cs
@@ -39,6 +39,7 @@ using System.Collections.Generic;
39using OpenSim.Server.Base; 39using OpenSim.Server.Base;
40using OpenSim.Services.Interfaces; 40using OpenSim.Services.Interfaces;
41using OpenSim.Framework; 41using OpenSim.Framework;
42using OpenSim.Framework.ServiceAuth;
42using OpenSim.Framework.Servers.HttpServer; 43using OpenSim.Framework.Servers.HttpServer;
43using OpenMetaverse; 44using OpenMetaverse;
44 45
@@ -55,10 +56,10 @@ namespace OpenSim.Server.Handlers.Authentication
55 private bool m_AllowSetPassword = false; 56 private bool m_AllowSetPassword = false;
56 57
57 public AuthenticationServerPostHandler(IAuthenticationService service) : 58 public AuthenticationServerPostHandler(IAuthenticationService service) :
58 this(service, null) {} 59 this(service, null, null) {}
59 60
60 public AuthenticationServerPostHandler(IAuthenticationService service, IConfig config) : 61 public AuthenticationServerPostHandler(IAuthenticationService service, IConfig config, IServiceAuth auth) :
61 base("POST", "/auth") 62 base("POST", "/auth", auth)
62 { 63 {
63 m_AuthenticationService = service; 64 m_AuthenticationService = service;
64 65
@@ -70,9 +71,10 @@ namespace OpenSim.Server.Handlers.Authentication
70 } 71 }
71 } 72 }
72 73
73 public override byte[] Handle(string path, Stream request, 74 protected override byte[] ProcessRequest(string path, Stream request,
74 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) 75 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
75 { 76 {
77// m_log.Error("[XXX]: Authenticating...");
76 string[] p = SplitParams(path); 78 string[] p = SplitParams(path);
77 79
78 if (p.Length > 0) 80 if (p.Length > 0)
@@ -207,7 +209,7 @@ namespace OpenSim.Server.Handlers.Authentication
207 209
208 rootElement.AppendChild(result); 210 rootElement.AppendChild(result);
209 211
210 return DocToBytes(doc); 212 return Util.DocToBytes(doc);
211 } 213 }
212 214
213 byte[] GetAuthInfo(UUID principalID) 215 byte[] GetAuthInfo(UUID principalID)
@@ -277,7 +279,7 @@ namespace OpenSim.Server.Handlers.Authentication
277 279
278 rootElement.AppendChild(result); 280 rootElement.AppendChild(result);
279 281
280 return DocToBytes(doc); 282 return Util.DocToBytes(doc);
281 } 283 }
282 284
283 private byte[] SuccessResult(string token) 285 private byte[] SuccessResult(string token)
@@ -304,18 +306,7 @@ namespace OpenSim.Server.Handlers.Authentication
304 306
305 rootElement.AppendChild(t); 307 rootElement.AppendChild(t);
306 308
307 return DocToBytes(doc); 309 return Util.DocToBytes(doc);
308 }
309
310 private byte[] DocToBytes(XmlDocument doc)
311 {
312 MemoryStream ms = new MemoryStream();
313 XmlTextWriter xw = new XmlTextWriter(ms, null);
314 xw.Formatting = Formatting.Indented;
315 doc.WriteTo(xw);
316 xw.Flush();
317
318 return ms.GetBuffer();
319 } 310 }
320 311
321 private byte[] ResultToBytes(Dictionary<string, object> result) 312 private byte[] ResultToBytes(Dictionary<string, object> result)
diff --git a/OpenSim/Server/Handlers/Authentication/OpenIdServerHandler.cs b/OpenSim/Server/Handlers/Authentication/OpenIdServerHandler.cs
index 18cef15..b201dc7 100644
--- a/OpenSim/Server/Handlers/Authentication/OpenIdServerHandler.cs
+++ b/OpenSim/Server/Handlers/Authentication/OpenIdServerHandler.cs
@@ -147,7 +147,7 @@ namespace OpenSim.Server.Handlers.Authentication
147 #endregion 147 #endregion
148 } 148 }
149 149
150 public class OpenIdStreamHandler : IStreamHandler 150 public class OpenIdStreamHandler : BaseOutputStreamHandler, IStreamHandler
151 { 151 {
152 #region HTML 152 #region HTML
153 153
@@ -191,42 +191,34 @@ For more information, see <a href='http://openid.net/'>http://openid.net/</a>.
191 191
192 #endregion HTML 192 #endregion HTML
193 193
194 public string Name { get { return "OpenId"; } }
195 public string Description { get { return null; } }
196 public string ContentType { get { return m_contentType; } }
197 public string HttpMethod { get { return m_httpMethod; } }
198 public string Path { get { return m_path; } }
199
200 string m_contentType;
201 string m_httpMethod;
202 string m_path;
203 IAuthenticationService m_authenticationService; 194 IAuthenticationService m_authenticationService;
204 IUserAccountService m_userAccountService; 195 IUserAccountService m_userAccountService;
205 ProviderMemoryStore m_openidStore = new ProviderMemoryStore(); 196 ProviderMemoryStore m_openidStore = new ProviderMemoryStore();
206 197
198 public override string ContentType { get { return "text/html"; } }
199
207 /// <summary> 200 /// <summary>
208 /// Constructor 201 /// Constructor
209 /// </summary> 202 /// </summary>
210 public OpenIdStreamHandler(string httpMethod, string path, IUserAccountService userService, IAuthenticationService authService) 203 public OpenIdStreamHandler(
204 string httpMethod, string path, IUserAccountService userService, IAuthenticationService authService)
205 : base(httpMethod, path, "OpenId", "OpenID stream handler")
211 { 206 {
212 m_authenticationService = authService; 207 m_authenticationService = authService;
213 m_userAccountService = userService; 208 m_userAccountService = userService;
214 m_httpMethod = httpMethod;
215 m_path = path;
216
217 m_contentType = "text/html";
218 } 209 }
219 210
220 /// <summary> 211 /// <summary>
221 /// Handles all GET and POST requests for OpenID identifier pages and endpoint 212 /// Handles all GET and POST requests for OpenID identifier pages and endpoint
222 /// server communication 213 /// server communication
223 /// </summary> 214 /// </summary>
224 public void Handle(string path, Stream request, Stream response, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) 215 protected override void ProcessRequest(
216 string path, Stream request, Stream response, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
225 { 217 {
226 Uri providerEndpoint = new Uri(String.Format("{0}://{1}{2}", httpRequest.Url.Scheme, httpRequest.Url.Authority, httpRequest.Url.AbsolutePath)); 218 Uri providerEndpoint = new Uri(String.Format("{0}://{1}{2}", httpRequest.Url.Scheme, httpRequest.Url.Authority, httpRequest.Url.AbsolutePath));
227 219
228 // Defult to returning HTML content 220 // Defult to returning HTML content
229 m_contentType = "text/html"; 221 httpResponse.ContentType = ContentType;
230 222
231 try 223 try
232 { 224 {
@@ -276,7 +268,7 @@ For more information, see <a href='http://openid.net/'>http://openid.net/</a>.
276 268
277 string[] contentTypeValues = provider.Request.Response.Headers.GetValues("Content-Type"); 269 string[] contentTypeValues = provider.Request.Response.Headers.GetValues("Content-Type");
278 if (contentTypeValues != null && contentTypeValues.Length == 1) 270 if (contentTypeValues != null && contentTypeValues.Length == 1)
279 m_contentType = contentTypeValues[0]; 271 httpResponse.ContentType = contentTypeValues[0];
280 272
281 // Set the response code and document body based on the OpenID result 273 // Set the response code and document body based on the OpenID result
282 httpResponse.StatusCode = (int)provider.Request.Response.Code; 274 httpResponse.StatusCode = (int)provider.Request.Response.Code;
@@ -344,4 +336,4 @@ For more information, see <a href='http://openid.net/'>http://openid.net/</a>.
344 return false; 336 return false;
345 } 337 }
346 } 338 }
347} 339} \ No newline at end of file