aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Services/LLLoginService/LLLoginService.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Services/LLLoginService/LLLoginService.cs')
-rw-r--r--OpenSim/Services/LLLoginService/LLLoginService.cs74
1 files changed, 74 insertions, 0 deletions
diff --git a/OpenSim/Services/LLLoginService/LLLoginService.cs b/OpenSim/Services/LLLoginService/LLLoginService.cs
new file mode 100644
index 0000000..2c31ed5
--- /dev/null
+++ b/OpenSim/Services/LLLoginService/LLLoginService.cs
@@ -0,0 +1,74 @@
1using System;
2using System.Collections.Generic;
3using System.Reflection;
4
5using log4net;
6using Nini.Config;
7using OpenMetaverse;
8
9using OpenSim.Framework;
10using OpenSim.Server.Base;
11using OpenSim.Services.Interfaces;
12
13namespace OpenSim.Services.LLLoginService
14{
15 public class LLLoginService : ILoginService
16 {
17 private IUserAccountService m_UserAccountService;
18 private IAuthenticationService m_AuthenticationService;
19 private IInventoryService m_InventoryService;
20 private IGridService m_GridService;
21 private IPresenceService m_PresenceService;
22
23 public LLLoginService(IConfigSource config)
24 {
25 IConfig serverConfig = config.Configs["LoginService"];
26 if (serverConfig == null)
27 throw new Exception(String.Format("No section LoginService in config file"));
28
29 string accountService = serverConfig.GetString("UserAccountService", String.Empty);
30 string authService = serverConfig.GetString("AuthenticationService", String.Empty);
31 string invService = serverConfig.GetString("InventoryService", String.Empty);
32 string gridService = serverConfig.GetString("GridService", String.Empty);
33 string presenceService = serverConfig.GetString("PresenceService", String.Empty);
34
35 // These 3 are required; the other 2 aren't
36 if (accountService == string.Empty || authService == string.Empty ||
37 invService == string.Empty)
38 throw new Exception("LoginService is missing service specifications");
39
40 Object[] args = new Object[] { config };
41 m_UserAccountService = ServerUtils.LoadPlugin<IUserAccountService>(accountService, args);
42 m_AuthenticationService = ServerUtils.LoadPlugin<IAuthenticationService>(authService, args);
43 m_InventoryService = ServerUtils.LoadPlugin<IInventoryService>(invService, args);
44 if (gridService != string.Empty)
45 m_GridService = ServerUtils.LoadPlugin<IGridService>(gridService, args);
46 if (presenceService != string.Empty)
47 m_PresenceService = ServerUtils.LoadPlugin<IPresenceService>(presenceService, args);
48
49 }
50
51 public LoginResponse Login(string firstName, string lastName, string passwd, string startLocation)
52 {
53 // Get the account and check that it exists
54 UserAccount account = m_UserAccountService.GetUserAccount(UUID.Zero, firstName, lastName);
55 if (account == null)
56 return LLFailedLoginResponse.UserProblem;
57
58 // Authenticate this user
59 string token = m_AuthenticationService.Authenticate(account.PrincipalID, passwd, 30);
60 UUID session = UUID.Zero;
61 if ((token == string.Empty) || (token != string.Empty && !UUID.TryParse(token, out session)))
62 return LLFailedLoginResponse.UserProblem;
63
64 // Get the user's inventory
65 List<InventoryFolderBase> inventorySkel = m_InventoryService.GetInventorySkeleton(account.PrincipalID);
66 if ((inventorySkel == null) || (inventorySkel != null && inventorySkel.Count == 0))
67 return LLFailedLoginResponse.InventoryProblem;
68
69 // lots of things missing... need to do the simulation service
70
71 return null;
72 }
73 }
74}