29 using System.Collections.Generic;
30 using System.Reflection;
33 using OpenSim.Server.Base;
34 using OpenSim.Services.Interfaces;
35 using OpenSim.Framework;
36 using OpenSim.Framework.Servers.HttpServer;
37 using OpenSim.Server.Handlers.Base;
39 namespace OpenSim.Server.Handlers.
Login
43 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
50 base(config, server, String.Empty)
52 m_log.Debug(
"[LLLOGIN IN CONNECTOR]: Starting...");
53 string loginService = ReadLocalServiceFromConfig(config);
58 Object[] args =
new Object[] { config, simService, libService };
59 m_LoginService = ServerUtils.LoadPlugin<
ILoginService>(loginService, args);
61 InitializeHandlers(server);
65 base(config, server, configName)
67 string loginService = ReadLocalServiceFromConfig(config);
69 Object[] args =
new Object[] { config };
71 m_LoginService = ServerUtils.LoadPlugin<
ILoginService>(loginService, args);
73 InitializeHandlers(server);
77 this(config, server, String.Empty)
81 private string ReadLocalServiceFromConfig(IConfigSource config)
83 IConfig serverConfig = config.Configs[
"LoginService"];
84 if (serverConfig == null)
85 throw new Exception(String.Format(
"No section LoginService in config file"));
87 string loginService = serverConfig.GetString(
"LocalServiceModule", String.Empty);
88 if (loginService ==
string.Empty)
89 throw new Exception(String.Format(
"No LocalServiceModule for LoginService in config file"));
91 m_Proxy = serverConfig.GetBoolean(
"HasProxy",
false);
94 m_DosProtectionOptions.AllowXForwardedFor = serverConfig.GetBoolean(
"DOSAllowXForwardedForHeader",
false);
95 m_DosProtectionOptions.RequestTimeSpan =
96 TimeSpan.FromMilliseconds(serverConfig.GetInt(
"DOSRequestTimeFrameMS", 10000));
97 m_DosProtectionOptions.MaxRequestsInTimeframe = serverConfig.GetInt(
"DOSMaxRequestsInTimeFrame", 5);
98 m_DosProtectionOptions.ForgetTimeSpan =
99 TimeSpan.FromMilliseconds(serverConfig.GetInt(
"DOSForgiveClientAfterMS", 120000));
100 m_DosProtectionOptions.ReportingName =
"LOGINDOSPROTECTION";
106 private void InitializeHandlers(
IHttpServer server)
108 LLLoginHandlers loginHandlers =
new LLLoginHandlers(m_LoginService, m_Proxy);
109 server.AddXmlRPCHandler(
"login_to_simulator",
111 m_DosProtectionOptions).Process,
false);
112 server.AddXmlRPCHandler(
"set_login_level", loginHandlers.HandleXMLRPCSetLoginLevel,
false);
113 server.SetDefaultLLSDHandler(loginHandlers.HandleLLSDLogin);
114 server.AddWebSocketHandler(
"/WebSocket/GridLogin", loginHandlers.HandleWebSocketLoginEvents);
LLLoginServiceInConnector(IConfigSource config, IHttpServer server, IScene scene)
LLLoginServiceInConnector(IConfigSource config, IHttpServer server, string configName)
LLLoginServiceInConnector(IConfigSource config, IHttpServer server)
Interface to OpenSimulator's built in HTTP server. Use this to register handlers (http, llsd, xmlrpc, etc.) for given URLs.