diff options
author | Diva Canto | 2010-01-10 16:20:59 -0800 |
---|---|---|
committer | Diva Canto | 2010-01-10 16:20:59 -0800 |
commit | 53e83e5dbb3590cb9c858aa301665357d1511b30 (patch) | |
tree | 732c828f49c3c54dc49bcd6eec86153ab76bc8ae /OpenSim/Grid/UserServer | |
parent | Some typos fixed related to master avie removal (diff) | |
download | opensim-SC-53e83e5dbb3590cb9c858aa301665357d1511b30.zip opensim-SC-53e83e5dbb3590cb9c858aa301665357d1511b30.tar.gz opensim-SC-53e83e5dbb3590cb9c858aa301665357d1511b30.tar.bz2 opensim-SC-53e83e5dbb3590cb9c858aa301665357d1511b30.tar.xz |
* Starting to clean the house...
* Fixed circular dependency
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Grid/UserServer.Modules/UserLoginAuthService.cs | 225 | ||||
-rw-r--r-- | OpenSim/Grid/UserServer/Main.cs | 7 |
2 files changed, 0 insertions, 232 deletions
diff --git a/OpenSim/Grid/UserServer.Modules/UserLoginAuthService.cs b/OpenSim/Grid/UserServer.Modules/UserLoginAuthService.cs deleted file mode 100644 index 77caf47..0000000 --- a/OpenSim/Grid/UserServer.Modules/UserLoginAuthService.cs +++ /dev/null | |||
@@ -1,225 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Reflection; | ||
32 | using System.Text.RegularExpressions; | ||
33 | using log4net; | ||
34 | using Nwc.XmlRpc; | ||
35 | using OpenMetaverse; | ||
36 | using OpenSim.Data; | ||
37 | using OpenSim.Framework; | ||
38 | using OpenSim.Framework.Communications; | ||
39 | using OpenSim.Framework.Communications.Services; | ||
40 | using OpenSim.Framework.Communications.Cache; | ||
41 | using OpenSim.Framework.Capabilities; | ||
42 | using OpenSim.Framework.Servers; | ||
43 | using OpenSim.Framework.Servers.HttpServer; | ||
44 | |||
45 | namespace OpenSim.Grid.UserServer.Modules | ||
46 | { | ||
47 | |||
48 | /// <summary> | ||
49 | /// Hypergrid login service used in grid mode. | ||
50 | /// </summary> | ||
51 | public class UserLoginAuthService : HGLoginAuthService | ||
52 | { | ||
53 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
54 | |||
55 | public UserConfig m_config; | ||
56 | private readonly IRegionProfileRouter m_regionProfileService; | ||
57 | |||
58 | protected BaseHttpServer m_httpServer; | ||
59 | |||
60 | public UserLoginAuthService( | ||
61 | UserManagerBase userManager, IInterServiceInventoryServices inventoryService, | ||
62 | LibraryRootFolder libraryRootFolder, | ||
63 | UserConfig config, string welcomeMess, IRegionProfileRouter regionProfileService) | ||
64 | : base(userManager, welcomeMess, inventoryService, null, true, libraryRootFolder, null) | ||
65 | { | ||
66 | m_config = config; | ||
67 | m_defaultHomeX = m_config.DefaultX; | ||
68 | m_defaultHomeY = m_config.DefaultY; | ||
69 | m_interInventoryService = inventoryService; | ||
70 | m_regionProfileService = regionProfileService; | ||
71 | |||
72 | NetworkServersInfo serversinfo = new NetworkServersInfo(1000, 1000); | ||
73 | serversinfo.GridRecvKey = m_config.GridRecvKey; | ||
74 | serversinfo.GridSendKey = m_config.GridSendKey; | ||
75 | serversinfo.GridURL = m_config.GridServerURL.ToString(); | ||
76 | serversinfo.InventoryURL = m_config.InventoryUrl.ToString(); | ||
77 | serversinfo.UserURL = m_config.AuthUrl.ToString(); | ||
78 | SetServersInfo(serversinfo); | ||
79 | } | ||
80 | |||
81 | public void RegisterHandlers(BaseHttpServer httpServer) | ||
82 | { | ||
83 | m_httpServer = httpServer; | ||
84 | |||
85 | httpServer.AddXmlRPCHandler("hg_login", XmlRpcLoginMethod); | ||
86 | httpServer.AddXmlRPCHandler("hg_new_auth_key", XmlRpcGenerateKeyMethod); | ||
87 | httpServer.AddXmlRPCHandler("hg_verify_auth_key", XmlRpcVerifyKeyMethod); | ||
88 | } | ||
89 | |||
90 | |||
91 | public override void LogOffUser(UserProfileData theUser, string message) | ||
92 | { | ||
93 | RegionProfileData SimInfo; | ||
94 | try | ||
95 | { | ||
96 | SimInfo = m_regionProfileService.RequestSimProfileData( | ||
97 | theUser.CurrentAgent.Handle, m_config.GridServerURL, | ||
98 | m_config.GridSendKey, m_config.GridRecvKey); | ||
99 | |||
100 | if (SimInfo == null) | ||
101 | { | ||
102 | m_log.Error("[GRID]: Region user was in isn't currently logged in"); | ||
103 | return; | ||
104 | } | ||
105 | } | ||
106 | catch (Exception) | ||
107 | { | ||
108 | m_log.Error("[GRID]: Unable to look up region to log user off"); | ||
109 | return; | ||
110 | } | ||
111 | |||
112 | // Prepare notification | ||
113 | Hashtable SimParams = new Hashtable(); | ||
114 | SimParams["agent_id"] = theUser.ID.ToString(); | ||
115 | SimParams["region_secret"] = theUser.CurrentAgent.SecureSessionID.ToString(); | ||
116 | SimParams["region_secret2"] = SimInfo.regionSecret; | ||
117 | //m_log.Info(SimInfo.regionSecret); | ||
118 | SimParams["regionhandle"] = theUser.CurrentAgent.Handle.ToString(); | ||
119 | SimParams["message"] = message; | ||
120 | ArrayList SendParams = new ArrayList(); | ||
121 | SendParams.Add(SimParams); | ||
122 | |||
123 | m_log.InfoFormat( | ||
124 | "[ASSUMED CRASH]: Telling region {0} @ {1},{2} ({3}) that their agent is dead: {4}", | ||
125 | SimInfo.regionName, SimInfo.regionLocX, SimInfo.regionLocY, SimInfo.httpServerURI, | ||
126 | theUser.FirstName + " " + theUser.SurName); | ||
127 | |||
128 | try | ||
129 | { | ||
130 | XmlRpcRequest GridReq = new XmlRpcRequest("logoff_user", SendParams); | ||
131 | XmlRpcResponse GridResp = GridReq.Send(SimInfo.httpServerURI, 6000); | ||
132 | |||
133 | if (GridResp.IsFault) | ||
134 | { | ||
135 | m_log.ErrorFormat( | ||
136 | "[LOGIN]: XMLRPC request for {0} failed, fault code: {1}, reason: {2}, This is likely an old region revision.", | ||
137 | SimInfo.httpServerURI, GridResp.FaultCode, GridResp.FaultString); | ||
138 | } | ||
139 | } | ||
140 | catch (Exception) | ||
141 | { | ||
142 | m_log.Error("[LOGIN]: Error telling region to logout user!"); | ||
143 | } | ||
144 | |||
145 | // Prepare notification | ||
146 | SimParams = new Hashtable(); | ||
147 | SimParams["agent_id"] = theUser.ID.ToString(); | ||
148 | SimParams["region_secret"] = SimInfo.regionSecret; | ||
149 | //m_log.Info(SimInfo.regionSecret); | ||
150 | SimParams["regionhandle"] = theUser.CurrentAgent.Handle.ToString(); | ||
151 | SimParams["message"] = message; | ||
152 | SendParams = new ArrayList(); | ||
153 | SendParams.Add(SimParams); | ||
154 | |||
155 | m_log.InfoFormat( | ||
156 | "[ASSUMED CRASH]: Telling region {0} @ {1},{2} ({3}) that their agent is dead: {4}", | ||
157 | SimInfo.regionName, SimInfo.regionLocX, SimInfo.regionLocY, SimInfo.httpServerURI, | ||
158 | theUser.FirstName + " " + theUser.SurName); | ||
159 | |||
160 | try | ||
161 | { | ||
162 | XmlRpcRequest GridReq = new XmlRpcRequest("logoff_user", SendParams); | ||
163 | XmlRpcResponse GridResp = GridReq.Send(SimInfo.httpServerURI, 6000); | ||
164 | |||
165 | if (GridResp.IsFault) | ||
166 | { | ||
167 | m_log.ErrorFormat( | ||
168 | "[LOGIN]: XMLRPC request for {0} failed, fault code: {1}, reason: {2}, This is likely an old region revision.", | ||
169 | SimInfo.httpServerURI, GridResp.FaultCode, GridResp.FaultString); | ||
170 | } | ||
171 | } | ||
172 | catch (Exception) | ||
173 | { | ||
174 | m_log.Error("[LOGIN]: Error telling region to logout user!"); | ||
175 | } | ||
176 | //base.LogOffUser(theUser); | ||
177 | } | ||
178 | |||
179 | protected override RegionInfo RequestClosestRegion(string region) | ||
180 | { | ||
181 | RegionProfileData profileData = m_regionProfileService.RequestSimProfileData(region, | ||
182 | m_config.GridServerURL, m_config.GridSendKey, m_config.GridRecvKey); | ||
183 | |||
184 | if (profileData != null) | ||
185 | { | ||
186 | return profileData.ToRegionInfo(); | ||
187 | } | ||
188 | else | ||
189 | { | ||
190 | return null; | ||
191 | } | ||
192 | } | ||
193 | |||
194 | protected override RegionInfo GetRegionInfo(ulong homeRegionHandle) | ||
195 | { | ||
196 | RegionProfileData profileData = m_regionProfileService.RequestSimProfileData(homeRegionHandle, | ||
197 | m_config.GridServerURL, m_config.GridSendKey, | ||
198 | m_config.GridRecvKey); | ||
199 | if (profileData != null) | ||
200 | { | ||
201 | return profileData.ToRegionInfo(); | ||
202 | } | ||
203 | else | ||
204 | { | ||
205 | return null; | ||
206 | } | ||
207 | } | ||
208 | |||
209 | protected override RegionInfo GetRegionInfo(UUID homeRegionId) | ||
210 | { | ||
211 | RegionProfileData profileData = m_regionProfileService.RequestSimProfileData(homeRegionId, | ||
212 | m_config.GridServerURL, m_config.GridSendKey, | ||
213 | m_config.GridRecvKey); | ||
214 | if (profileData != null) | ||
215 | { | ||
216 | return profileData.ToRegionInfo(); | ||
217 | } | ||
218 | else | ||
219 | { | ||
220 | return null; | ||
221 | } | ||
222 | } | ||
223 | |||
224 | } | ||
225 | } | ||
diff --git a/OpenSim/Grid/UserServer/Main.cs b/OpenSim/Grid/UserServer/Main.cs index 286076d7..5bf728a 100644 --- a/OpenSim/Grid/UserServer/Main.cs +++ b/OpenSim/Grid/UserServer/Main.cs | |||
@@ -64,7 +64,6 @@ namespace OpenSim.Grid.UserServer | |||
64 | protected UserServerFriendsModule m_friendsModule; | 64 | protected UserServerFriendsModule m_friendsModule; |
65 | 65 | ||
66 | public UserLoginService m_loginService; | 66 | public UserLoginService m_loginService; |
67 | public UserLoginAuthService m_loginAuthService; | ||
68 | public MessageServersConnector m_messagesService; | 67 | public MessageServersConnector m_messagesService; |
69 | 68 | ||
70 | protected GridInfoServiceModule m_gridInfoService; | 69 | protected GridInfoServiceModule m_gridInfoService; |
@@ -245,9 +244,6 @@ namespace OpenSim.Grid.UserServer | |||
245 | m_loginService = new UserLoginService( | 244 | m_loginService = new UserLoginService( |
246 | m_userDataBaseService, inventoryService, new LibraryRootFolder(Cfg.LibraryXmlfile), Cfg, Cfg.DefaultStartupMsg, new RegionProfileServiceProxy()); | 245 | m_userDataBaseService, inventoryService, new LibraryRootFolder(Cfg.LibraryXmlfile), Cfg, Cfg.DefaultStartupMsg, new RegionProfileServiceProxy()); |
247 | 246 | ||
248 | if (Cfg.EnableHGLogin) | ||
249 | m_loginAuthService = new UserLoginAuthService(m_userDataBaseService, inventoryService, new LibraryRootFolder(Cfg.LibraryXmlfile), | ||
250 | Cfg, Cfg.DefaultStartupMsg, new RegionProfileServiceProxy()); | ||
251 | } | 247 | } |
252 | 248 | ||
253 | protected virtual void PostInitialiseModules() | 249 | protected virtual void PostInitialiseModules() |
@@ -266,9 +262,6 @@ namespace OpenSim.Grid.UserServer | |||
266 | { | 262 | { |
267 | m_loginService.RegisterHandlers(m_httpServer, Cfg.EnableLLSDLogin, true); | 263 | m_loginService.RegisterHandlers(m_httpServer, Cfg.EnableLLSDLogin, true); |
268 | 264 | ||
269 | if (m_loginAuthService != null) | ||
270 | m_loginAuthService.RegisterHandlers(m_httpServer); | ||
271 | |||
272 | m_userManager.RegisterHandlers(m_httpServer); | 265 | m_userManager.RegisterHandlers(m_httpServer); |
273 | m_friendsModule.RegisterHandlers(m_httpServer); | 266 | m_friendsModule.RegisterHandlers(m_httpServer); |
274 | m_avatarAppearanceModule.RegisterHandlers(m_httpServer); | 267 | m_avatarAppearanceModule.RegisterHandlers(m_httpServer); |