aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Services/AuthenticationService/WebkeyAuthenticationService.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Services/AuthenticationService/WebkeyAuthenticationService.cs')
-rw-r--r--OpenSim/Services/AuthenticationService/WebkeyAuthenticationService.cs41
1 files changed, 36 insertions, 5 deletions
diff --git a/OpenSim/Services/AuthenticationService/WebkeyAuthenticationService.cs b/OpenSim/Services/AuthenticationService/WebkeyAuthenticationService.cs
index d1a5b0f..2344c0e 100644
--- a/OpenSim/Services/AuthenticationService/WebkeyAuthenticationService.cs
+++ b/OpenSim/Services/AuthenticationService/WebkeyAuthenticationService.cs
@@ -31,6 +31,9 @@ using OpenSim.Services.Interfaces;
31using log4net; 31using log4net;
32using Nini.Config; 32using Nini.Config;
33using System.Reflection; 33using System.Reflection;
34using OpenSim.Data;
35using OpenSim.Framework;
36using OpenSim.Framework.Console;
34 37
35namespace OpenSim.Services.AuthenticationService 38namespace OpenSim.Services.AuthenticationService
36{ 39{
@@ -43,17 +46,45 @@ namespace OpenSim.Services.AuthenticationService
43 public class WebkeyAuthenticationService : 46 public class WebkeyAuthenticationService :
44 AuthenticationServiceBase, IAuthenticationService 47 AuthenticationServiceBase, IAuthenticationService
45 { 48 {
46// private static readonly ILog m_log = 49 private static readonly ILog m_log =
47// LogManager.GetLogger( 50 LogManager.GetLogger(
48// MethodBase.GetCurrentMethod().DeclaringType); 51 MethodBase.GetCurrentMethod().DeclaringType);
49 52
50 public WebkeyAuthenticationService(IConfigSource config) : 53 public WebkeyAuthenticationService(IConfigSource config) :
51 base(config) 54 base(config)
52 { 55 {
53 } 56 }
54 57
55 public string Authenticate(UUID principalID, string password, int lifetime) 58 public string Authenticate(UUID principalID, string password, int lifetime)
56 { 59 {
60 if (new UUID(password) == UUID.Zero)
61 {
62 m_log.DebugFormat("[AUTH SERVICE]: UUID.Zero is not a valid web_login_key on PrincipalID {0}", principalID);
63 }
64 else
65 {
66 AuthenticationData data = m_Database.Get(principalID);
67 if (data != null && data.Data != null)
68 {
69 if (data.Data.ContainsKey("webLoginKey"))
70 {
71 string key = data.Data["webLoginKey"].ToString();
72 if (key == password)
73 {
74 data.Data["webLoginKey"] = UUID.Zero.ToString();
75 m_Database.Store(data);
76 return GetToken(principalID, lifetime);
77 }
78 else
79 {
80 m_log.DebugFormat("[AUTH SERVICE]: web login auth failed, got PrincipalID {0} gave {1} instead of {2}", principalID, password, key);
81 }
82 }else{
83 m_log.DebugFormat("[AUTH SERVICE]: no col webLoginKey in passwd.db");
84 }
85 }
86 m_log.DebugFormat("[AUTH SERVICE]: PrincipalID {0} or its data not found", principalID);
87 }
57 return String.Empty; 88 return String.Empty;
58 } 89 }
59 } 90 }