GatekeeperService.cs 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562
  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. using System;
  28. using System.Collections.Generic;
  29. using System.Net;
  30. using System.Reflection;
  31. using System.Text.RegularExpressions;
  32. using OpenSim.Framework;
  33. using OpenSim.Services.Interfaces;
  34. using GridRegion = OpenSim.Services.Interfaces.GridRegion;
  35. using OpenSim.Server.Base;
  36. using OpenSim.Services.Connectors.Hypergrid;
  37. using OpenMetaverse;
  38. using Nini.Config;
  39. using log4net;
  40. namespace OpenSim.Services.HypergridService
  41. {
  42. public class GatekeeperService : IGatekeeperService
  43. {
  44. private static readonly ILog m_log =
  45. LogManager.GetLogger(
  46. MethodBase.GetCurrentMethod().DeclaringType);
  47. private static bool m_Initialized = false;
  48. private static IGridService m_GridService;
  49. private static IPresenceService m_PresenceService;
  50. private static IUserAccountService m_UserAccountService;
  51. private static IUserAgentService m_UserAgentService;
  52. private static ISimulationService m_SimulationService;
  53. private static IGridUserService m_GridUserService;
  54. private static IBansService m_BansService;
  55. private static string m_AllowedClients = string.Empty;
  56. private static string m_DeniedClients = string.Empty;
  57. private static bool m_ForeignAgentsAllowed = true;
  58. private static List<string> m_ForeignsAllowedExceptions = new List<string>();
  59. private static List<string> m_ForeignsDisallowedExceptions = new List<string>();
  60. private static UUID m_ScopeID;
  61. private static bool m_AllowTeleportsToAnyRegion;
  62. private static string m_ExternalName;
  63. private static Uri m_Uri;
  64. private static GridRegion m_DefaultGatewayRegion;
  65. public GatekeeperService(IConfigSource config, ISimulationService simService)
  66. {
  67. if (!m_Initialized)
  68. {
  69. m_Initialized = true;
  70. IConfig serverConfig = config.Configs["GatekeeperService"];
  71. if (serverConfig == null)
  72. throw new Exception(String.Format("No section GatekeeperService in config file"));
  73. string accountService = serverConfig.GetString("UserAccountService", String.Empty);
  74. string homeUsersService = serverConfig.GetString("UserAgentService", string.Empty);
  75. string gridService = serverConfig.GetString("GridService", String.Empty);
  76. string presenceService = serverConfig.GetString("PresenceService", String.Empty);
  77. string simulationService = serverConfig.GetString("SimulationService", String.Empty);
  78. string gridUserService = serverConfig.GetString("GridUserService", String.Empty);
  79. string bansService = serverConfig.GetString("BansService", String.Empty);
  80. // These are mandatory, the others aren't
  81. if (gridService == string.Empty || presenceService == string.Empty)
  82. throw new Exception("Incomplete specifications, Gatekeeper Service cannot function.");
  83. string scope = serverConfig.GetString("ScopeID", UUID.Zero.ToString());
  84. UUID.TryParse(scope, out m_ScopeID);
  85. //m_WelcomeMessage = serverConfig.GetString("WelcomeMessage", "Welcome to OpenSim!");
  86. m_AllowTeleportsToAnyRegion = serverConfig.GetBoolean("AllowTeleportsToAnyRegion", true);
  87. m_ExternalName = Util.GetConfigVarFromSections<string>(config, "GatekeeperURI",
  88. new string[] { "Startup", "Hypergrid", "GatekeeperService" }, String.Empty);
  89. m_ExternalName = serverConfig.GetString("ExternalName", m_ExternalName);
  90. if (m_ExternalName != string.Empty && !m_ExternalName.EndsWith("/"))
  91. m_ExternalName = m_ExternalName + "/";
  92. try
  93. {
  94. m_Uri = new Uri(m_ExternalName);
  95. }
  96. catch
  97. {
  98. m_log.WarnFormat("[GATEKEEPER SERVICE]: Malformed gatekeeper address {0}", m_ExternalName);
  99. }
  100. Object[] args = new Object[] { config };
  101. m_GridService = ServerUtils.LoadPlugin<IGridService>(gridService, args);
  102. m_PresenceService = ServerUtils.LoadPlugin<IPresenceService>(presenceService, args);
  103. if (accountService != string.Empty)
  104. m_UserAccountService = ServerUtils.LoadPlugin<IUserAccountService>(accountService, args);
  105. if (homeUsersService != string.Empty)
  106. m_UserAgentService = ServerUtils.LoadPlugin<IUserAgentService>(homeUsersService, args);
  107. if (gridUserService != string.Empty)
  108. m_GridUserService = ServerUtils.LoadPlugin<IGridUserService>(gridUserService, args);
  109. if (bansService != string.Empty)
  110. m_BansService = ServerUtils.LoadPlugin<IBansService>(bansService, args);
  111. if (simService != null)
  112. m_SimulationService = simService;
  113. else if (simulationService != string.Empty)
  114. m_SimulationService = ServerUtils.LoadPlugin<ISimulationService>(simulationService, args);
  115. string[] possibleAccessControlConfigSections = new string[] { "AccessControl", "GatekeeperService" };
  116. m_AllowedClients = Util.GetConfigVarFromSections<string>(
  117. config, "AllowedClients", possibleAccessControlConfigSections, string.Empty);
  118. m_DeniedClients = Util.GetConfigVarFromSections<string>(
  119. config, "DeniedClients", possibleAccessControlConfigSections, string.Empty);
  120. m_ForeignAgentsAllowed = serverConfig.GetBoolean("ForeignAgentsAllowed", true);
  121. LoadDomainExceptionsFromConfig(serverConfig, "AllowExcept", m_ForeignsAllowedExceptions);
  122. LoadDomainExceptionsFromConfig(serverConfig, "DisallowExcept", m_ForeignsDisallowedExceptions);
  123. if (m_GridService == null || m_PresenceService == null || m_SimulationService == null)
  124. throw new Exception("Unable to load a required plugin, Gatekeeper Service cannot function.");
  125. m_log.Debug("[GATEKEEPER SERVICE]: Starting...");
  126. }
  127. }
  128. public GatekeeperService(IConfigSource config)
  129. : this(config, null)
  130. {
  131. }
  132. protected void LoadDomainExceptionsFromConfig(IConfig config, string variable, List<string> exceptions)
  133. {
  134. string value = config.GetString(variable, string.Empty);
  135. string[] parts = value.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
  136. foreach (string s in parts)
  137. exceptions.Add(s.Trim());
  138. }
  139. public bool LinkRegion(string regionName, out UUID regionID, out ulong regionHandle, out string externalName, out string imageURL, out string reason)
  140. {
  141. regionID = UUID.Zero;
  142. regionHandle = 0;
  143. externalName = m_ExternalName + ((regionName != string.Empty) ? " " + regionName : "");
  144. imageURL = string.Empty;
  145. reason = string.Empty;
  146. GridRegion region = null;
  147. m_log.DebugFormat("[GATEKEEPER SERVICE]: Request to link to {0}", (regionName == string.Empty)? "default region" : regionName);
  148. if (!m_AllowTeleportsToAnyRegion || regionName == string.Empty)
  149. {
  150. List<GridRegion> defs = m_GridService.GetDefaultHypergridRegions(m_ScopeID);
  151. if (defs != null && defs.Count > 0)
  152. {
  153. region = defs[0];
  154. m_DefaultGatewayRegion = region;
  155. }
  156. else
  157. {
  158. reason = "Grid setup problem. Try specifying a particular region here.";
  159. m_log.DebugFormat("[GATEKEEPER SERVICE]: Unable to send information. Please specify a default region for this grid!");
  160. return false;
  161. }
  162. }
  163. else
  164. {
  165. region = m_GridService.GetRegionByName(m_ScopeID, regionName);
  166. if (region == null)
  167. {
  168. reason = "Region not found";
  169. return false;
  170. }
  171. }
  172. regionID = region.RegionID;
  173. regionHandle = region.RegionHandle;
  174. string regionimage = "regionImage" + regionID.ToString();
  175. regionimage = regionimage.Replace("-", "");
  176. imageURL = region.ServerURI + "index.php?method=" + regionimage;
  177. return true;
  178. }
  179. public GridRegion GetHyperlinkRegion(UUID regionID, UUID agentID, string agentHomeURI, out string message)
  180. {
  181. message = null;
  182. if (!m_AllowTeleportsToAnyRegion)
  183. {
  184. // Don't even check the given regionID
  185. m_log.DebugFormat(
  186. "[GATEKEEPER SERVICE]: Returning gateway region {0} {1} @ {2} to user {3}{4} as teleporting to arbitrary regions is not allowed.",
  187. m_DefaultGatewayRegion.RegionName,
  188. m_DefaultGatewayRegion.RegionID,
  189. m_DefaultGatewayRegion.ServerURI,
  190. agentID,
  191. agentHomeURI == null ? "" : " @ " + agentHomeURI);
  192. message = "Teleporting to the default region.";
  193. return m_DefaultGatewayRegion;
  194. }
  195. GridRegion region = m_GridService.GetRegionByUUID(m_ScopeID, regionID);
  196. if (region == null)
  197. {
  198. m_log.DebugFormat(
  199. "[GATEKEEPER SERVICE]: Could not find region with ID {0} as requested by user {1}{2}. Returning null.",
  200. regionID, agentID, (agentHomeURI == null) ? "" : " @ " + agentHomeURI);
  201. message = "The teleport destination could not be found.";
  202. return null;
  203. }
  204. m_log.DebugFormat(
  205. "[GATEKEEPER SERVICE]: Returning region {0} {1} @ {2} to user {3}{4}.",
  206. region.RegionName,
  207. region.RegionID,
  208. region.ServerURI,
  209. agentID,
  210. agentHomeURI == null ? "" : " @ " + agentHomeURI);
  211. return region;
  212. }
  213. #region Login Agent
  214. public bool LoginAgent(GridRegion source, AgentCircuitData aCircuit, GridRegion destination, out string reason)
  215. {
  216. reason = string.Empty;
  217. string authURL = string.Empty;
  218. if (aCircuit.ServiceURLs.ContainsKey("HomeURI"))
  219. authURL = aCircuit.ServiceURLs["HomeURI"].ToString();
  220. m_log.InfoFormat("[GATEKEEPER SERVICE]: Login request for {0} {1} @ {2} ({3}) at {4} using viewer {5}, channel {6}, IP {7}, Mac {8}, Id0 {9}, Teleport Flags: {10}. From region {11}",
  221. aCircuit.firstname, aCircuit.lastname, authURL, aCircuit.AgentID, destination.RegionID,
  222. aCircuit.Viewer, aCircuit.Channel, aCircuit.IPAddress, aCircuit.Mac, aCircuit.Id0, (TeleportFlags)aCircuit.teleportFlags,
  223. (source == null) ? "Unknown" : string.Format("{0} ({1}){2}", source.RegionName, source.RegionID, (source.RawServerURI == null) ? "" : " @ " + source.ServerURI));
  224. string curViewer = Util.GetViewerName(aCircuit);
  225. //
  226. // Check client
  227. //
  228. if (m_AllowedClients != string.Empty)
  229. {
  230. Regex arx = new Regex(m_AllowedClients);
  231. Match am = arx.Match(curViewer);
  232. if (!am.Success)
  233. {
  234. m_log.InfoFormat("[GATEKEEPER SERVICE]: Login failed, reason: client {0} is not allowed", curViewer);
  235. return false;
  236. }
  237. }
  238. if (m_DeniedClients != string.Empty)
  239. {
  240. Regex drx = new Regex(m_DeniedClients);
  241. Match dm = drx.Match(curViewer);
  242. if (dm.Success)
  243. {
  244. m_log.InfoFormat("[GATEKEEPER SERVICE]: Login failed, reason: client {0} is denied", curViewer);
  245. return false;
  246. }
  247. }
  248. //
  249. // Authenticate the user
  250. //
  251. if (!Authenticate(aCircuit))
  252. {
  253. reason = "Unable to verify identity";
  254. m_log.InfoFormat("[GATEKEEPER SERVICE]: Unable to verify identity of agent {0} {1}. Refusing service.", aCircuit.firstname, aCircuit.lastname);
  255. return false;
  256. }
  257. m_log.DebugFormat("[GATEKEEPER SERVICE]: Identity verified for {0} {1} @ {2}", aCircuit.firstname, aCircuit.lastname, authURL);
  258. //
  259. // Check for impersonations
  260. //
  261. UserAccount account = null;
  262. if (m_UserAccountService != null)
  263. {
  264. // Check to see if we have a local user with that UUID
  265. account = m_UserAccountService.GetUserAccount(m_ScopeID, aCircuit.AgentID);
  266. if (account != null)
  267. {
  268. // Make sure this is the user coming home, and not a foreign user with same UUID as a local user
  269. if (m_UserAgentService != null)
  270. {
  271. if (!m_UserAgentService.IsAgentComingHome(aCircuit.SessionID, m_ExternalName))
  272. {
  273. // Can't do, sorry
  274. reason = "Unauthorized";
  275. m_log.InfoFormat("[GATEKEEPER SERVICE]: Foreign agent {0} {1} has same ID as local user. Refusing service.",
  276. aCircuit.firstname, aCircuit.lastname);
  277. return false;
  278. }
  279. }
  280. }
  281. }
  282. //
  283. // Foreign agents allowed? Exceptions?
  284. //
  285. if (account == null)
  286. {
  287. bool allowed = m_ForeignAgentsAllowed;
  288. if (m_ForeignAgentsAllowed && IsException(aCircuit, m_ForeignsAllowedExceptions))
  289. allowed = false;
  290. if (!m_ForeignAgentsAllowed && IsException(aCircuit, m_ForeignsDisallowedExceptions))
  291. allowed = true;
  292. if (!allowed)
  293. {
  294. reason = "Destination does not allow visitors from your world";
  295. m_log.InfoFormat("[GATEKEEPER SERVICE]: Foreign agents are not permitted {0} {1} @ {2}. Refusing service.",
  296. aCircuit.firstname, aCircuit.lastname, aCircuit.ServiceURLs["HomeURI"]);
  297. return false;
  298. }
  299. }
  300. //
  301. // Is the user banned?
  302. // This uses a Ban service that's more powerful than the configs
  303. //
  304. string uui = (account != null ? aCircuit.AgentID.ToString() : Util.ProduceUserUniversalIdentifier(aCircuit));
  305. if (m_BansService != null && m_BansService.IsBanned(uui, aCircuit.IPAddress, aCircuit.Id0, authURL))
  306. {
  307. reason = "You are banned from this world";
  308. m_log.InfoFormat("[GATEKEEPER SERVICE]: Login failed, reason: user {0} is banned", uui);
  309. return false;
  310. }
  311. m_log.DebugFormat("[GATEKEEPER SERVICE]: User {0} is ok", aCircuit.Name);
  312. bool isFirstLogin = false;
  313. //
  314. // Login the presence, if it's not there yet (by the login service)
  315. //
  316. PresenceInfo presence = m_PresenceService.GetAgent(aCircuit.SessionID);
  317. if (presence != null) // it has been placed there by the login service
  318. isFirstLogin = true;
  319. else
  320. {
  321. if (!m_PresenceService.LoginAgent(aCircuit.AgentID.ToString(), aCircuit.SessionID, aCircuit.SecureSessionID))
  322. {
  323. reason = "Unable to login presence";
  324. m_log.InfoFormat("[GATEKEEPER SERVICE]: Presence login failed for foreign agent {0} {1}. Refusing service.",
  325. aCircuit.firstname, aCircuit.lastname);
  326. return false;
  327. }
  328. m_log.DebugFormat("[GATEKEEPER SERVICE]: Login presence {0} is ok", aCircuit.Name);
  329. // Also login foreigners with GridUser service
  330. if (m_GridUserService != null && account == null)
  331. {
  332. string userId = aCircuit.AgentID.ToString();
  333. string first = aCircuit.firstname, last = aCircuit.lastname;
  334. if (last.StartsWith("@"))
  335. {
  336. string[] parts = aCircuit.firstname.Split('.');
  337. if (parts.Length >= 2)
  338. {
  339. first = parts[0];
  340. last = parts[1];
  341. }
  342. }
  343. userId += ";" + aCircuit.ServiceURLs["HomeURI"] + ";" + first + " " + last;
  344. m_GridUserService.LoggedIn(userId);
  345. }
  346. }
  347. //
  348. // Get the region
  349. //
  350. destination = m_GridService.GetRegionByUUID(m_ScopeID, destination.RegionID);
  351. if (destination == null)
  352. {
  353. reason = "Destination region not found";
  354. return false;
  355. }
  356. m_log.DebugFormat(
  357. "[GATEKEEPER SERVICE]: Destination {0} is ok for {1}", destination.RegionName, aCircuit.Name);
  358. //
  359. // Adjust the visible name
  360. //
  361. if (account != null)
  362. {
  363. aCircuit.firstname = account.FirstName;
  364. aCircuit.lastname = account.LastName;
  365. }
  366. if (account == null)
  367. {
  368. if (!aCircuit.lastname.StartsWith("@"))
  369. aCircuit.firstname = aCircuit.firstname + "." + aCircuit.lastname;
  370. try
  371. {
  372. Uri uri = new Uri(aCircuit.ServiceURLs["HomeURI"].ToString());
  373. aCircuit.lastname = "@" + uri.Authority;
  374. }
  375. catch
  376. {
  377. m_log.WarnFormat("[GATEKEEPER SERVICE]: Malformed HomeURI (this should never happen): {0}", aCircuit.ServiceURLs["HomeURI"]);
  378. aCircuit.lastname = "@" + aCircuit.ServiceURLs["HomeURI"].ToString();
  379. }
  380. }
  381. //
  382. // Finally launch the agent at the destination
  383. //
  384. Constants.TeleportFlags loginFlag = isFirstLogin ? Constants.TeleportFlags.ViaLogin : Constants.TeleportFlags.ViaHGLogin;
  385. // Preserve our TeleportFlags we have gathered so-far
  386. loginFlag |= (Constants.TeleportFlags) aCircuit.teleportFlags;
  387. m_log.DebugFormat("[GATEKEEPER SERVICE]: Launching {0}, Teleport Flags: {1}", aCircuit.Name, loginFlag);
  388. string version;
  389. if (!m_SimulationService.QueryAccess(
  390. destination, aCircuit.AgentID, aCircuit.ServiceURLs["HomeURI"].ToString(),
  391. true, aCircuit.startpos, "SIMULATION/0.3", new List<UUID>(), out version, out reason))
  392. return false;
  393. return m_SimulationService.CreateAgent(source, destination, aCircuit, (uint)loginFlag, out reason);
  394. }
  395. protected bool Authenticate(AgentCircuitData aCircuit)
  396. {
  397. if (!CheckAddress(aCircuit.ServiceSessionID))
  398. return false;
  399. if (string.IsNullOrEmpty(aCircuit.IPAddress))
  400. {
  401. m_log.DebugFormat("[GATEKEEPER SERVICE]: Agent did not provide a client IP address.");
  402. return false;
  403. }
  404. string userURL = string.Empty;
  405. if (aCircuit.ServiceURLs.ContainsKey("HomeURI"))
  406. userURL = aCircuit.ServiceURLs["HomeURI"].ToString();
  407. if (userURL == string.Empty)
  408. {
  409. m_log.DebugFormat("[GATEKEEPER SERVICE]: Agent did not provide an authentication server URL");
  410. return false;
  411. }
  412. if (userURL == m_ExternalName)
  413. {
  414. return m_UserAgentService.VerifyAgent(aCircuit.SessionID, aCircuit.ServiceSessionID);
  415. }
  416. else
  417. {
  418. IUserAgentService userAgentService = new UserAgentServiceConnector(userURL);
  419. try
  420. {
  421. return userAgentService.VerifyAgent(aCircuit.SessionID, aCircuit.ServiceSessionID);
  422. }
  423. catch
  424. {
  425. m_log.DebugFormat("[GATEKEEPER SERVICE]: Unable to contact authentication service at {0}", userURL);
  426. return false;
  427. }
  428. }
  429. }
  430. // Check that the service token was generated for *this* grid.
  431. // If it wasn't then that's a fake agent.
  432. protected bool CheckAddress(string serviceToken)
  433. {
  434. string[] parts = serviceToken.Split(new char[] { ';' });
  435. if (parts.Length < 2)
  436. return false;
  437. char[] trailing_slash = new char[] { '/' };
  438. string addressee = parts[0].TrimEnd(trailing_slash);
  439. string externalname = m_ExternalName.TrimEnd(trailing_slash);
  440. m_log.DebugFormat("[GATEKEEPER SERVICE]: Verifying {0} against {1}", addressee, externalname);
  441. Uri uri;
  442. try
  443. {
  444. uri = new Uri(addressee);
  445. }
  446. catch
  447. {
  448. m_log.DebugFormat("[GATEKEEPER SERVICE]: Visitor provided malformed service address {0}", addressee);
  449. return false;
  450. }
  451. return string.Equals(uri.GetLeftPart(UriPartial.Authority), m_Uri.GetLeftPart(UriPartial.Authority), StringComparison.OrdinalIgnoreCase) ;
  452. }
  453. #endregion
  454. #region Misc
  455. private bool IsException(AgentCircuitData aCircuit, List<string> exceptions)
  456. {
  457. bool exception = false;
  458. if (exceptions.Count > 0) // we have exceptions
  459. {
  460. // Retrieve the visitor's origin
  461. string userURL = aCircuit.ServiceURLs["HomeURI"].ToString();
  462. if (!userURL.EndsWith("/"))
  463. userURL += "/";
  464. if (exceptions.Find(delegate(string s)
  465. {
  466. if (!s.EndsWith("/"))
  467. s += "/";
  468. return s == userURL;
  469. }) != null)
  470. exception = true;
  471. }
  472. return exception;
  473. }
  474. #endregion
  475. }
  476. }