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