aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Services/AuthenticationService/WebkeyAuthenticationService.cs
diff options
context:
space:
mode:
authorBlueWall2011-04-13 09:53:44 -0400
committerBlueWall2011-04-13 09:53:44 -0400
commitd3457eae7a33f01a8fa906c4040792cdc4a67857 (patch)
treef92e60733b8397576b86c486e05aa5219f27d034 /OpenSim/Services/AuthenticationService/WebkeyAuthenticationService.cs
parentMerge branch 'master' of /home/opensim/src/OpenSim/Core (diff)
parentMove example HttpProxy setting to OpenSim.ini.example and tidy (diff)
downloadopensim-SC_OLD-d3457eae7a33f01a8fa906c4040792cdc4a67857.zip
opensim-SC_OLD-d3457eae7a33f01a8fa906c4040792cdc4a67857.tar.gz
opensim-SC_OLD-d3457eae7a33f01a8fa906c4040792cdc4a67857.tar.bz2
opensim-SC_OLD-d3457eae7a33f01a8fa906c4040792cdc4a67857.tar.xz
Merge branch 'master' of /home/git/repo/OpenSim
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 }