29 using System.Collections;
30 using System.Collections.Generic;
33 using System.Reflection;
34 using System.Text.RegularExpressions;
40 using OpenSim.Framework;
41 using OpenSim.Framework.Console;
42 using OpenSim.Server.Base;
43 using OpenSim.Services.Interfaces;
46 using OpenSim.Services.Connectors.Hypergrid;
48 namespace OpenSim.Services.LLLoginService
52 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
53 private static readonly
string LogHeader =
"[LLOGIN SERVICE]";
55 private static bool Initialized =
false;
93 IConfig m_LoginServerConfig;
98 m_LoginServerConfig = config.Configs[
"LoginService"];
99 if (m_LoginServerConfig == null)
100 throw new Exception(String.Format(
"No section LoginService in config file"));
102 string accountService = m_LoginServerConfig.GetString(
"UserAccountService", String.Empty);
103 string gridUserService = m_LoginServerConfig.GetString(
"GridUserService", String.Empty);
104 string agentService = m_LoginServerConfig.GetString(
"UserAgentService", String.Empty);
105 string authService = m_LoginServerConfig.GetString(
"AuthenticationService", String.Empty);
106 string invService = m_LoginServerConfig.GetString(
"InventoryService", String.Empty);
107 string gridService = m_LoginServerConfig.GetString(
"GridService", String.Empty);
108 string presenceService = m_LoginServerConfig.GetString(
"PresenceService", String.Empty);
109 string libService = m_LoginServerConfig.GetString(
"LibraryService", String.Empty);
110 string friendsService = m_LoginServerConfig.GetString(
"FriendsService", String.Empty);
111 string avatarService = m_LoginServerConfig.GetString(
"AvatarService", String.Empty);
112 string simulationService = m_LoginServerConfig.GetString(
"SimulationService", String.Empty);
114 m_DefaultRegionName = m_LoginServerConfig.GetString(
"DefaultRegion", String.Empty);
115 m_WelcomeMessage = m_LoginServerConfig.GetString(
"WelcomeMessage",
"Welcome to OpenSim!");
116 m_RequireInventory = m_LoginServerConfig.GetBoolean(
"RequireInventory",
true);
117 m_AllowRemoteSetLoginLevel = m_LoginServerConfig.GetBoolean(
"AllowRemoteSetLoginLevel",
false);
118 m_MinLoginLevel = m_LoginServerConfig.GetInt(
"MinLoginLevel", 0);
119 m_GatekeeperURL = Util.GetConfigVarFromSections<
string>(config,
"GatekeeperURI",
120 new string[] {
"Startup",
"Hypergrid",
"LoginService" }, String.Empty);
121 m_MapTileURL = m_LoginServerConfig.GetString(
"MapTileURL", string.Empty);
122 m_ProfileURL = m_LoginServerConfig.GetString(
"ProfileServerURL", string.Empty);
123 m_OpenIDURL = m_LoginServerConfig.GetString(
"OpenIDServerURL", String.Empty);
124 m_SearchURL = m_LoginServerConfig.GetString(
"SearchURL", string.Empty);
125 m_Currency = m_LoginServerConfig.GetString(
"Currency", string.Empty);
126 m_ClassifiedFee = m_LoginServerConfig.GetString(
"ClassifiedFee", string.Empty);
127 m_DestinationGuide = m_LoginServerConfig.GetString (
"DestinationGuide", string.Empty);
128 m_AvatarPicker = m_LoginServerConfig.GetString (
"AvatarPicker", string.Empty);
130 string[] possibleAccessControlConfigSections =
new string[] {
"AccessControl",
"LoginService" };
131 m_AllowedClients = Util.GetConfigVarFromSections<
string>(
132 config,
"AllowedClients", possibleAccessControlConfigSections, string.Empty);
133 m_DeniedClients = Util.GetConfigVarFromSections<
string>(
134 config,
"DeniedClients", possibleAccessControlConfigSections, string.Empty);
136 m_MessageUrl = m_LoginServerConfig.GetString(
"MessageUrl", string.Empty);
137 m_DSTZone = m_LoginServerConfig.GetString(
"DSTZone",
"America/Los_Angeles;Pacific Standard Time");
139 IConfig groupConfig = config.Configs[
"Groups"];
140 if (groupConfig != null)
141 m_MaxAgentGroups = groupConfig.GetInt(
"MaxAgentGroups", 42);
145 if (m_MapTileURL != String.Empty)
147 m_MapTileURL = m_MapTileURL.Trim();
148 if (!m_MapTileURL.EndsWith(
"/"))
149 m_MapTileURL = m_MapTileURL +
"/";
153 if (accountService ==
string.Empty || authService ==
string.Empty)
154 throw new Exception(
"LoginService is missing service specifications");
157 m_WelcomeMessage = m_WelcomeMessage.Replace(
"\\n",
"\n");
159 Object[] args =
new Object[] { config };
161 m_GridUserService = ServerUtils.LoadPlugin<
IGridUserService>(gridUserService, args);
162 Object[] authArgs =
new Object[] { config, m_UserAccountService };
164 m_InventoryService = ServerUtils.LoadPlugin<
IInventoryService>(invService, args);
166 if (gridService !=
string.Empty)
167 m_GridService = ServerUtils.LoadPlugin<
IGridService>(gridService, args);
168 if (presenceService !=
string.Empty)
169 m_PresenceService = ServerUtils.LoadPlugin<
IPresenceService>(presenceService, args);
170 if (avatarService !=
string.Empty)
171 m_AvatarService = ServerUtils.LoadPlugin<
IAvatarService>(avatarService, args);
172 if (friendsService !=
string.Empty)
173 m_FriendsService = ServerUtils.LoadPlugin<
IFriendsService>(friendsService, args);
174 if (simulationService !=
string.Empty)
175 m_RemoteSimulationService = ServerUtils.LoadPlugin<
ISimulationService>(simulationService, args);
176 if (agentService !=
string.Empty)
177 m_UserAgentService = ServerUtils.LoadPlugin<
IUserAgentService>(agentService, args);
180 string hgInvServicePlugin = m_LoginServerConfig.GetString(
"HGInventoryServicePlugin", String.Empty);
181 if (hgInvServicePlugin !=
string.Empty)
183 string hgInvServiceArg = m_LoginServerConfig.GetString(
"HGInventoryServiceConstructorArg", String.Empty);
184 Object[] args2 =
new Object[] { config, hgInvServiceArg };
185 m_HGInventoryService = ServerUtils.LoadPlugin<
IInventoryService>(hgInvServicePlugin, args2);
191 m_LocalSimulationService = simService;
192 if (libraryService != null)
194 m_log.DebugFormat(
"[LLOGIN SERVICE]: Using LibraryService given as argument");
195 m_LibraryService = libraryService;
197 else if (libService !=
string.Empty)
199 m_log.DebugFormat(
"[LLOGIN SERVICE]: Using instantiated LibraryService");
200 m_LibraryService = ServerUtils.LoadPlugin<
ILibraryService>(libService, args);
211 m_log.DebugFormat(
"[LLOGIN SERVICE]: Starting...");
219 public Hashtable
SetLevel(
string firstName,
string lastName,
string passwd,
int level, IPEndPoint clientIP)
221 Hashtable response =
new Hashtable();
222 response[
"success"] =
"false";
224 if (!m_AllowRemoteSetLoginLevel)
229 UserAccount account = m_UserAccountService.GetUserAccount(UUID.Zero, firstName, lastName);
232 m_log.InfoFormat(
"[LLOGIN SERVICE]: Set Level failed, user {0} {1} not found", firstName, lastName);
238 m_log.InfoFormat(
"[LLOGIN SERVICE]: Set Level failed, reason: user level too low");
247 string token = m_AuthenticationService.Authenticate(account.PrincipalID, passwd, 30);
248 UUID secureSession = UUID.Zero;
249 if ((token ==
string.Empty) || (token != string.Empty && !UUID.TryParse(token, out secureSession)))
251 m_log.InfoFormat(
"[LLOGIN SERVICE]: SetLevel failed, reason: authentication failed");
257 m_log.Error(
"[LLOGIN SERVICE]: SetLevel failed, exception " + e.ToString());
261 m_MinLoginLevel = level;
262 m_log.InfoFormat(
"[LLOGIN SERVICE]: Login level set to {0} by {1} {2}", level, firstName, lastName);
264 response[
"success"] =
true;
268 public LoginResponse Login(
string firstName,
string lastName,
string passwd,
string startLocation, UUID scopeID,
269 string clientVersion,
string channel,
string mac,
string id0, IPEndPoint clientIP,
bool LibOMVclient)
271 bool success =
false;
272 UUID session = UUID.Random();
274 string processedMessage;
276 if (clientVersion.Contains(
"Radegast"))
277 LibOMVclient =
false;
279 m_log.InfoFormat(
"[LLOGIN SERVICE]: Login request for {0} {1} at {2} using viewer {3}, channel {4}, IP {5}, Mac {6}, Id0 {7}, Possible LibOMVGridProxy: {8} ",
280 firstName, lastName, startLocation, clientVersion, channel, clientIP.Address.ToString(), mac, id0, LibOMVclient.ToString());
287 if (m_AllowedClients !=
string.Empty)
289 Regex arx =
new Regex(m_AllowedClients);
290 Match am = arx.Match(clientVersion);
295 "[LLOGIN SERVICE]: Login failed for {0} {1}, reason: client {2} is not allowed",
296 firstName, lastName, clientVersion);
297 return LLFailedLoginResponse.LoginBlockedProblem;
301 if (m_DeniedClients !=
string.Empty)
303 Regex drx =
new Regex(m_DeniedClients);
304 Match dm = drx.Match(clientVersion);
309 "[LLOGIN SERVICE]: Login failed for {0} {1}, reason: client {2} is denied",
310 firstName, lastName, clientVersion);
311 return LLFailedLoginResponse.LoginBlockedProblem;
318 UserAccount account = m_UserAccountService.GetUserAccount(scopeID, firstName, lastName);
322 "[LLOGIN SERVICE]: Login failed for {0} {1}, reason: user not found", firstName, lastName);
323 return LLFailedLoginResponse.UserProblem;
329 "[LLOGIN SERVICE]: Login failed for {0} {1}, reason: user level is {2} but minimum login level is {3}",
330 firstName, lastName, account.UserLevel, m_MinLoginLevel);
331 return LLFailedLoginResponse.LoginBlockedProblem;
337 if (scopeID != UUID.Zero)
342 "[LLOGIN SERVICE]: Login failed, reason: user {0} {1} not found", firstName, lastName);
343 return LLFailedLoginResponse.UserProblem;
348 scopeID = account.ScopeID;
354 if (!passwd.StartsWith(
"$1$"))
355 passwd =
"$1$" + Util.Md5Hash(passwd);
356 passwd = passwd.Remove(0, 3);
358 string token = m_AuthenticationService.Authenticate(account.PrincipalID, passwd, 30, out realID);
359 UUID secureSession = UUID.Zero;
360 if ((token ==
string.Empty) || (token != string.Empty && !UUID.TryParse(token, out secureSession)))
363 "[LLOGIN SERVICE]: Login failed for {0} {1}, reason: authentication failed",
364 firstName, lastName);
365 return LLFailedLoginResponse.UserProblem;
371 if (m_RequireInventory && m_InventoryService == null)
374 "[LLOGIN SERVICE]: Login failed for {0} {1}, reason: inventory service not set up",
375 firstName, lastName);
376 return LLFailedLoginResponse.InventoryProblem;
379 if (m_HGInventoryService != null)
383 m_HGInventoryService.GetRootFolder(account.PrincipalID);
386 List<InventoryFolderBase> inventorySkel = m_InventoryService.GetInventorySkeleton(account.PrincipalID);
387 if (m_RequireInventory && ((inventorySkel == null) || (inventorySkel != null && inventorySkel.Count == 0)))
390 "[LLOGIN SERVICE]: Login failed, for {0} {1}, reason: unable to retrieve user inventory",
391 firstName, lastName);
392 return LLFailedLoginResponse.InventoryProblem;
396 List<InventoryItemBase> gestures = m_InventoryService.GetActiveGestures(account.PrincipalID);
402 if (m_PresenceService != null)
404 success = m_PresenceService.LoginAgent(account.PrincipalID.ToString(), session, secureSession);
409 "[LLOGIN SERVICE]: Login failed for {0} {1}, reason: could not login presence",
410 firstName, lastName);
411 return LLFailedLoginResponse.GridProblem;
419 GridUserInfo guinfo = m_GridUserService.LoggedIn(account.PrincipalID.ToString());
425 if (guinfo.
HomeRegionID == UUID.Zero && startLocation ==
"home")
428 "[LLOGIN SERVICE]: User {0} tried to login to a 'home' start location but they have none set",
431 else if (m_GridService != null)
433 home = m_GridService.GetRegionByUUID(scopeID, guinfo.HomeRegionID);
435 if (home == null && startLocation ==
"home")
438 "[LLOGIN SERVICE]: User {0} tried to login to a 'home' start location with ID {1} but this was not found.",
439 account.Name, guinfo.HomeRegionID);
446 m_log.DebugFormat(
"{0} Failed to fetch GridUserInfo. Creating empty GridUserInfo as home", LogHeader);
448 guinfo.LastPosition = guinfo.HomePosition =
new Vector3(128, 128, 30);
454 string where = string.Empty;
455 Vector3 position = Vector3.Zero;
456 Vector3 lookAt = Vector3.Zero;
459 GridRegion destination = FindDestination(account, scopeID, guinfo, session, startLocation, home, out gatekeeper, out where, out position, out lookAt, out flags);
460 if (destination == null)
462 m_PresenceService.LogoutAgent(session);
465 "[LLOGIN SERVICE]: Login failed for {0} {1}, reason: destination not found",
466 firstName, lastName);
467 return LLFailedLoginResponse.GridProblem;
472 "[LLOGIN SERVICE]: Found destination {0}, endpoint {1} for {2} {3}",
473 destination.RegionName, destination.ExternalEndPoint, firstName, lastName);
477 flags |= TeleportFlags.Godlike;
482 if (m_AvatarService != null)
484 avatar = m_AvatarService.GetAppearance(account.PrincipalID);
490 string reason = string.Empty;
492 AgentCircuitData aCircuit = LaunchAgentAtGrid(gatekeeper, destination, account, avatar, session, secureSession, position, where,
493 clientVersion, channel, mac, id0, clientIP, flags, out where, out reason, out dest);
495 if (aCircuit == null)
497 m_PresenceService.LogoutAgent(session);
498 m_log.InfoFormat(
"[LLOGIN SERVICE]: Login failed for {0} {1}, reason: {2}", firstName, lastName, reason);
504 if (m_FriendsService != null)
506 friendsList = m_FriendsService.GetFriends(account.PrincipalID);
513 if (m_MessageUrl != String.Empty)
515 WebClient client =
new WebClient();
516 processedMessage = client.DownloadString(m_MessageUrl);
520 processedMessage = m_WelcomeMessage;
522 processedMessage = processedMessage.Replace(
"\\n",
"\n").Replace(
"<USERNAME>", firstName +
" " + lastName);
526 account, aCircuit, guinfo, destination, inventorySkel, friendsList, m_LibraryService,
527 where, startLocation, position, lookAt, gestures, processedMessage, home, clientIP,
528 m_MapTileURL, m_ProfileURL, m_OpenIDURL, m_SearchURL, m_Currency, m_DSTZone,
529 m_DestinationGuide, m_AvatarPicker, realID, m_ClassifiedFee,m_MaxAgentGroups);
531 m_log.DebugFormat(
"[LLOGIN SERVICE]: All clear. Sending login response to {0} {1}", firstName, lastName);
537 m_log.WarnFormat(
"[LLOGIN SERVICE]: Exception processing login for {0} {1}: {2} {3}", firstName, lastName, e.ToString(), e.StackTrace);
538 if (m_PresenceService != null)
539 m_PresenceService.LogoutAgent(session);
540 return LLFailedLoginResponse.InternalError;
547 out
string where, out Vector3 position, out Vector3 lookAt, out
TeleportFlags flags)
549 flags = TeleportFlags.ViaLogin;
552 "[LLOGIN SERVICE]: Finding destination matching start location {0} for {1}",
553 startLocation, account.Name);
557 position =
new Vector3(128, 128, 0);
558 lookAt =
new Vector3(0, 1, 0);
560 if (m_GridService == null)
563 if (startLocation.Equals(
"home"))
571 bool tryDefaults =
false;
581 position = pinfo.HomePosition;
582 lookAt = pinfo.HomeLookAt;
583 flags |= TeleportFlags.ViaHome;
588 List<GridRegion> defaults = m_GridService.GetDefaultRegions(scopeID);
589 if (defaults != null && defaults.Count > 0)
591 region = defaults[0];
596 m_log.WarnFormat(
"[LLOGIN SERVICE]: User {0} {1} does not have a valid home and this grid does not have default locations. Attempting to find random region",
597 account.FirstName, account.LastName);
598 region = FindAlternativeRegion(scopeID);
606 else if (startLocation.Equals(
"last"))
616 if (pinfo.
LastRegionID.Equals(UUID.Zero) || (region = m_GridService.GetRegionByUUID(scopeID, pinfo.LastRegionID)) == null)
618 List<GridRegion> defaults = m_GridService.GetDefaultRegions(scopeID);
619 if (defaults != null && defaults.Count > 0)
621 region = defaults[0];
626 m_log.Info(
"[LLOGIN SERVICE]: Last Region Not Found Attempting to find random region");
627 region = FindAlternativeRegion(scopeID);
635 position = pinfo.LastPosition;
636 lookAt = pinfo.LastLookAt;
643 flags |= TeleportFlags.ViaRegionID;
649 Regex reURI =
new Regex(
@"^uri:(?<region>[^&]+)&(?<x>\d+[.]?\d*)&(?<y>\d+[.]?\d*)&(?<z>\d+[.]?\d*)$");
650 Match uriMatch = reURI.Match(startLocation);
651 if (uriMatch == null)
653 m_log.InfoFormat(
"[LLLOGIN SERVICE]: Got Custom Login URI {0}, but can't process it", startLocation);
660 float.Parse(uriMatch.Groups[
"z"].Value, Culture.NumberFormatInfo));
662 string regionName = uriMatch.Groups[
"region"].ToString();
663 if (regionName != null)
665 if (!regionName.Contains(
"@"))
667 List<GridRegion> regions = m_GridService.GetRegionsByName(scopeID, regionName, 1);
668 if ((regions == null) || (regions != null && regions.Count == 0))
670 m_log.InfoFormat(
"[LLLOGIN SERVICE]: Got Custom Login URI {0}, can't locate region {1}. Trying defaults.", startLocation, regionName);
671 regions = m_GridService.GetDefaultRegions(scopeID);
672 if (regions != null && regions.Count > 0)
679 m_log.Info(
"[LLOGIN SERVICE]: Last Region Not Found Attempting to find random region");
680 region = FindAlternativeRegion(scopeID);
688 m_log.InfoFormat(
"[LLLOGIN SERVICE]: Got Custom Login URI {0}, Grid does not provide default regions and no alternative found.", startLocation);
697 if (m_UserAgentService == null)
699 m_log.WarnFormat(
"[LLLOGIN SERVICE]: This llogin service is not running a user agent service, as such it can't lauch agents at foreign grids");
702 string[] parts = regionName.Split(
new char[] {
'@' });
703 if (parts.Length < 2)
705 m_log.InfoFormat(
"[LLLOGIN SERVICE]: Got Custom Login URI {0}, can't locate region {1}", startLocation, regionName);
710 regionName = parts[0];
711 string domainLocator = parts[1];
712 parts = domainLocator.Split(
new char[] {
':'});
713 string domainName = parts[0];
715 if (parts.Length > 1)
716 UInt32.TryParse(parts[1], out port);
718 region = FindForeignRegion(domainName, port, regionName, account, out gatekeeper);
724 List<GridRegion> defaults = m_GridService.GetDefaultRegions(scopeID);
725 if (defaults != null && defaults.Count > 0)
742 private GridRegion FindAlternativeRegion(UUID scopeID)
744 List<GridRegion> hyperlinks = null;
745 List<GridRegion> regions = m_GridService.GetFallbackRegions(scopeID, (int)Util.RegionToWorldLoc(1000), (int)Util.RegionToWorldLoc(1000));
746 if (regions != null && regions.Count > 0)
748 hyperlinks = m_GridService.GetHyperlinks(scopeID);
750 if (availableRegions.Count() > 0)
751 return availableRegions.ElementAt(0);
755 regions = m_GridService.GetRegionsByName(scopeID,
"", 10);
756 if (regions != null && regions.Count > 0)
758 if (hyperlinks == null)
759 hyperlinks = m_GridService.GetHyperlinks(scopeID);
761 if (availableRegions.Count() > 0)
762 return availableRegions.ElementAt(0);
769 m_log.Debug(
"[LLLOGIN SERVICE]: attempting to findforeignregion " + domainName +
":" + port.ToString() +
":" + regionName);
771 gatekeeper.ExternalHostName = domainName;
772 gatekeeper.HttpPort = port;
773 gatekeeper.RegionName = regionName;
774 gatekeeper.InternalEndPoint =
new IPEndPoint(IPAddress.Parse(
"0.0.0.0"), 0);
778 string imageURL = string.Empty, reason = string.Empty;
780 if (m_GatekeeperConnector.LinkRegion(gatekeeper, out regionID, out handle, out domainName, out imageURL, out reason))
782 string homeURI = null;
783 if (account.ServiceURLs != null && account.ServiceURLs.ContainsKey(
"HomeURI"))
784 homeURI = (
string)account.ServiceURLs[
"HomeURI"];
786 GridRegion destination = m_GatekeeperConnector.GetHyperlinkRegion(gatekeeper, regionID, account.PrincipalID, homeURI, out message);
793 private string hostName = string.Empty;
794 private int port = 0;
796 private void SetHostAndPort(
string url)
800 Uri uri =
new Uri(url);
806 m_log.WarnFormat(
"[LLLogin SERVICE]: Unable to parse GatekeeperURL {0}", url);
811 UUID session, UUID secureSession, Vector3 position,
string currentWhere,
string viewer,
string channel,
string mac,
string id0,
814 where = currentWhere;
816 reason = string.Empty;
817 uint circuitCode = 0;
820 if (m_UserAgentService == null)
825 if (m_LocalSimulationService != null)
826 simConnector = m_LocalSimulationService;
827 else if (m_RemoteSimulationService != null)
828 simConnector = m_RemoteSimulationService;
832 if (gatekeeper == null)
834 if (hostName ==
string.Empty)
835 SetHostAndPort(m_GatekeeperURL);
838 gatekeeper.ExternalHostName = hostName;
839 gatekeeper.HttpPort = (uint)port;
840 gatekeeper.ServerURI = m_GatekeeperURL;
842 m_log.Debug(
"[LLLOGIN SERVICE]: no gatekeeper detected..... using " + m_GatekeeperURL);
845 bool success =
false;
847 if (m_UserAgentService == null && simConnector != null)
849 circuitCode = (uint)Util.RandomClass.Next(); ;
850 aCircuit = MakeAgent(destination, account, avatar, session, secureSession, circuitCode, position, clientIP.Address.
ToString(), viewer, channel, mac, id0);
851 success = LaunchAgentDirectly(simConnector, destination, aCircuit, flags, out reason);
852 if (!success && m_GridService != null)
855 List<GridRegion> fallbacks = m_GridService.GetFallbackRegions(account.ScopeID, destination.RegionLocX, destination.RegionLocY);
856 if (fallbacks != null)
860 success = LaunchAgentDirectly(simConnector, r, aCircuit, flags |
TeleportFlags.ViaRegionID, out reason);
872 if (m_UserAgentService != null)
874 circuitCode = (uint)Util.RandomClass.Next(); ;
875 aCircuit = MakeAgent(destination, account, avatar, session, secureSession, circuitCode, position, clientIP.Address.
ToString(), viewer, channel, mac, id0);
876 aCircuit.teleportFlags |= (uint)flags;
877 success = LaunchAgentIndirectly(gatekeeper, destination, aCircuit, clientIP, out reason);
878 if (!success && m_GridService != null)
881 List<GridRegion> fallbacks = m_GridService.GetFallbackRegions(account.ScopeID, destination.RegionLocX, destination.RegionLocY);
882 if (fallbacks != null)
886 success = LaunchAgentIndirectly(gatekeeper, r, aCircuit, clientIP, out reason);
905 AvatarAppearance avatar, UUID session, UUID secureSession, uint circuit, Vector3 position,
906 string ipaddress,
string viewer,
string channel,
string mac,
string id0)
910 aCircuit.AgentID = account.PrincipalID;
917 aCircuit.CapsPath = CapsUtil.GetRandomCapsObjectPath();
918 aCircuit.child =
false;
919 aCircuit.ChildrenCapSeeds =
new Dictionary<ulong, string>();
920 aCircuit.circuitcode = circuit;
921 aCircuit.firstname = account.FirstName;
923 aCircuit.lastname = account.LastName;
924 aCircuit.SecureSessionID = secureSession;
925 aCircuit.SessionID = session;
926 aCircuit.startpos = position;
927 aCircuit.IPAddress = ipaddress;
928 aCircuit.Viewer = viewer;
929 aCircuit.Channel = channel;
932 SetServiceURLs(aCircuit, account);
939 aCircuit.ServiceURLs =
new Dictionary<string, object>();
944 foreach (KeyValuePair<string, object> kvp
in account.
ServiceURLs)
946 if (kvp.Value != null)
948 aCircuit.ServiceURLs[kvp.Key] = kvp.Value;
950 if (!aCircuit.
ServiceURLs[kvp.Key].ToString().EndsWith(
"/"))
951 aCircuit.ServiceURLs[kvp.Key] = aCircuit.ServiceURLs[kvp.Key] +
"/";
956 string[] keys = m_LoginServerConfig.GetKeys();
960 bool newUrls =
false;
962 foreach (
string serviceKey
in serviceKeys)
964 string keyName = serviceKey.Replace(
"SRV_",
"");
965 string keyValue = m_LoginServerConfig.GetString(serviceKey, string.Empty);
966 if (!keyValue.EndsWith(
"/"))
967 keyValue = keyValue +
"/";
969 if (!account.
ServiceURLs.ContainsKey(keyName) || (account.ServiceURLs.ContainsKey(keyName) && (
string)account.ServiceURLs[keyName] != keyValue))
971 account.ServiceURLs[keyName] = keyValue;
974 aCircuit.ServiceURLs[keyName] = keyValue;
976 m_log.DebugFormat(
"[LLLOGIN SERVICE]: found new key {0} {1}", keyName, aCircuit.ServiceURLs[keyName]);
979 if (!account.
ServiceURLs.ContainsKey(
"GatekeeperURI") && !string.IsNullOrEmpty(m_GatekeeperURL))
981 m_log.DebugFormat(
"[LLLOGIN SERVICE]: adding gatekeeper uri {0}", m_GatekeeperURL);
982 account.ServiceURLs[
"GatekeeperURI"] = m_GatekeeperURL;
989 m_UserAccountService.StoreUserAccount(account);
999 region, aCircuit.
AgentID, null,
true, aCircuit.
startpos,
new List<UUID>(), ctx, out reason))
1002 return simConnector.CreateAgent(null, region, aCircuit, (uint)flags, ctx, out reason);
1007 m_log.Debug(
"[LLOGIN SERVICE]: Launching agent at " + destination.RegionName);
1009 if (m_UserAgentService.LoginAgentToGrid(null, aCircuit, gatekeeper, destination,
true, out reason))
1014 #region Console Commands
1015 private void RegisterCommands()
1018 MainConsole.Instance.Commands.AddCommand(
"Users",
false,
"login level",
1019 "login level <level>",
1020 "Set the minimum user level to log in", HandleLoginCommand);
1022 MainConsole.Instance.Commands.AddCommand(
"Users",
false,
"login reset",
1024 "Reset the login level to allow all users",
1025 HandleLoginCommand);
1027 MainConsole.Instance.Commands.AddCommand(
"Users",
false,
"login text",
1028 "login text <text>",
1029 "Set the text users will see on login", HandleLoginCommand);
1033 private void HandleLoginCommand(
string module,
string[] cmd)
1035 string subcommand = cmd[1];
1046 if (Int32.TryParse(cmd[2], out m_MinLoginLevel))
1049 MainConsole.Instance.OutputFormat(
"ERROR: {0} is not a valid login level", cmd[2]);
1054 m_MinLoginLevel = 0;
1055 MainConsole.Instance.OutputFormat(
"Reset min login level to {0}", m_MinLoginLevel);
1061 m_WelcomeMessage = cmd[2];
1062 MainConsole.Instance.OutputFormat(
"Login welcome message set to '{0}'", m_WelcomeMessage);
override String ToString()
void OutputFormat(string format, params object[] components)
static NumberFormatInfo NumberFormatInfo
IUserAccountService m_UserAccountService
OpenSim.Framework.Constants.TeleportFlags TeleportFlags
GridRegion FindDestination(UserAccount account, UUID scopeID, GridUserInfo pinfo, UUID sessionID, string startLocation, GridRegion home, out GridRegion gatekeeper, out string where, out Vector3 position, out Vector3 lookAt, out TeleportFlags flags)
LLLoginService(IConfigSource config, ISimulationService simService, ILibraryService libraryService)
IAvatarService m_AvatarService
Contains the Avatar's Appearance and methods to manipulate the appearance.
IUserAgentService m_UserAgentService
Vector3 startpos
Position the Agent's Avatar starts in the region
IInventoryService m_InventoryService
bool QueryAccess(GridRegion destination, UUID agentID, string agentHomeURI, bool viaTeleport, Vector3 position, List< UUID > features, EntityTransferContext ctx, out string reason)
Returns whether a propspective user is allowed to visit the region.
Dictionary< string, object > ServiceURLs
OpenSim.Services.Interfaces.FriendInfo FriendInfo
LoginResponse Login(string firstName, string lastName, string passwd, string startLocation, UUID scopeID, string clientVersion, string channel, string mac, string id0, IPEndPoint clientIP, bool LibOMVclient)
ISimulationService m_RemoteSimulationService
Records user information specific to a grid but which is not part of a user's account.
GatekeeperServiceConnector m_GatekeeperConnector
ILibraryService m_LibraryService
string m_DestinationGuide
Hashtable SetLevel(string firstName, string lastName, string passwd, int level, IPEndPoint clientIP)
IPresenceService m_PresenceService
Circuit data for an agent. Connection information shared between regions that accept UDP connections ...
static ICommandConsole Instance
string m_DefaultRegionName
LLLoginService(IConfigSource config)
OpenSim.Services.Interfaces.GridRegion GridRegion
System.Collections.IEnumerable IEnumerable
IGridService m_GridService
bool m_AllowRemoteSetLoginLevel
Dictionary< string, object > ServiceURLs
IInventoryService m_HGInventoryService
UUID AgentID
Avatar Unique Agent Identifier
ISimulationService m_LocalSimulationService
IGridUserService m_GridUserService
AgentCircuitData LaunchAgentAtGrid(GridRegion gatekeeper, GridRegion destination, UserAccount account, AvatarAppearance avatar, UUID session, UUID secureSession, Vector3 position, string currentWhere, string viewer, string channel, string mac, string id0, IPEndPoint clientIP, TeleportFlags flags, out string where, out string reason, out GridRegion dest)
A class to handle LL login response.
IAuthenticationService m_AuthenticationService
IFriendsService m_FriendsService