From 482686daab055d4d2d878b238059b442e64122f4 Mon Sep 17 00:00:00 2001 From: SignpostMarv Martin Date: Tue, 15 Mar 2011 10:29:24 +0000 Subject: WebkeyAuthenticationService is now no longer a stub! Signed-off-by: SignpostMarv Martin --- .../WebkeyAuthenticationService.cs | 40 +++++++++++++++++++--- 1 file changed, 35 insertions(+), 5 deletions(-) (limited to 'OpenSim/Services/AuthenticationService/WebkeyAuthenticationService.cs') diff --git a/OpenSim/Services/AuthenticationService/WebkeyAuthenticationService.cs b/OpenSim/Services/AuthenticationService/WebkeyAuthenticationService.cs index d1a5b0f..a072958 100644 --- a/OpenSim/Services/AuthenticationService/WebkeyAuthenticationService.cs +++ b/OpenSim/Services/AuthenticationService/WebkeyAuthenticationService.cs @@ -31,6 +31,9 @@ using OpenSim.Services.Interfaces; using log4net; using Nini.Config; using System.Reflection; +using OpenSim.Data; +using OpenSim.Framework; +using OpenSim.Framework.Console; namespace OpenSim.Services.AuthenticationService { @@ -43,17 +46,44 @@ namespace OpenSim.Services.AuthenticationService public class WebkeyAuthenticationService : AuthenticationServiceBase, IAuthenticationService { -// private static readonly ILog m_log = -// LogManager.GetLogger( -// MethodBase.GetCurrentMethod().DeclaringType); - + private static readonly ILog m_log = + LogManager.GetLogger( + MethodBase.GetCurrentMethod().DeclaringType); + public WebkeyAuthenticationService(IConfigSource config) : - base(config) + base(config) { } public string Authenticate(UUID principalID, string password, int lifetime) { + m_log.InfoFormat("[Authenticate]: Trying a web key authenticate"); + if (new UUID(password) == UUID.Zero) + { + m_log.InfoFormat("[Authenticate]: NULL_KEY is not a valid web_login_key"); + } + else + { + AuthenticationData data = m_Database.Get(principalID); + if (data != null && data.Data != null) + { + if (data.Data.ContainsKey("webLoginKey")) + { + m_log.InfoFormat("[Authenticate]: Trying a web key authentication"); + string key = data.Data["webLoginKey"].ToString(); + m_log.DebugFormat("[WEB LOGIN AUTH]: got {0} for key in db vs {1}", key, password); + if (key == password) + { + data.Data["webLoginKey"] = UUID.Zero.ToString(); + m_Database.Store(data); + return GetToken(principalID, lifetime); + } + }else{ + m_log.InfoFormat("[Authenticate]: no col webLoginKey in passwd.db"); + } + } + m_log.DebugFormat("[AUTH SERVICE]: PrincipalID {0} or its data not found", principalID); + } return String.Empty; } } -- cgit v1.1 From 0e808950fbb54271d478d29669bf035949731114 Mon Sep 17 00:00:00 2001 From: SignpostMarv Martin Date: Mon, 21 Mar 2011 14:47:10 +0000 Subject: InfoFormat > DebugFormat Signed-off-by: SignpostMarv Martin --- OpenSim/Services/AuthenticationService/WebkeyAuthenticationService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Services/AuthenticationService/WebkeyAuthenticationService.cs') diff --git a/OpenSim/Services/AuthenticationService/WebkeyAuthenticationService.cs b/OpenSim/Services/AuthenticationService/WebkeyAuthenticationService.cs index a072958..5924026 100644 --- a/OpenSim/Services/AuthenticationService/WebkeyAuthenticationService.cs +++ b/OpenSim/Services/AuthenticationService/WebkeyAuthenticationService.cs @@ -79,7 +79,7 @@ namespace OpenSim.Services.AuthenticationService return GetToken(principalID, lifetime); } }else{ - m_log.InfoFormat("[Authenticate]: no col webLoginKey in passwd.db"); + m_log.DebugFormat("[Authenticate]: no col webLoginKey in passwd.db"); } } m_log.DebugFormat("[AUTH SERVICE]: PrincipalID {0} or its data not found", principalID); -- cgit v1.1 From 3f4be42a87f77d5da7e6cafd4fb98ff6a502636d Mon Sep 17 00:00:00 2001 From: SignpostMarv Martin Date: Thu, 24 Mar 2011 16:46:21 +0000 Subject: Altering log feedback --- .../WebkeyAuthenticationService.cs | 23 +++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) (limited to 'OpenSim/Services/AuthenticationService/WebkeyAuthenticationService.cs') diff --git a/OpenSim/Services/AuthenticationService/WebkeyAuthenticationService.cs b/OpenSim/Services/AuthenticationService/WebkeyAuthenticationService.cs index 5924026..2344c0e 100644 --- a/OpenSim/Services/AuthenticationService/WebkeyAuthenticationService.cs +++ b/OpenSim/Services/AuthenticationService/WebkeyAuthenticationService.cs @@ -57,10 +57,9 @@ namespace OpenSim.Services.AuthenticationService public string Authenticate(UUID principalID, string password, int lifetime) { - m_log.InfoFormat("[Authenticate]: Trying a web key authenticate"); if (new UUID(password) == UUID.Zero) { - m_log.InfoFormat("[Authenticate]: NULL_KEY is not a valid web_login_key"); + m_log.DebugFormat("[AUTH SERVICE]: UUID.Zero is not a valid web_login_key on PrincipalID {0}", principalID); } else { @@ -69,17 +68,19 @@ namespace OpenSim.Services.AuthenticationService { if (data.Data.ContainsKey("webLoginKey")) { - m_log.InfoFormat("[Authenticate]: Trying a web key authentication"); string key = data.Data["webLoginKey"].ToString(); - m_log.DebugFormat("[WEB LOGIN AUTH]: got {0} for key in db vs {1}", key, password); - if (key == password) - { - data.Data["webLoginKey"] = UUID.Zero.ToString(); - m_Database.Store(data); - return GetToken(principalID, lifetime); - } + if (key == password) + { + data.Data["webLoginKey"] = UUID.Zero.ToString(); + m_Database.Store(data); + return GetToken(principalID, lifetime); + } + else + { + m_log.DebugFormat("[AUTH SERVICE]: web login auth failed, got PrincipalID {0} gave {1} instead of {2}", principalID, password, key); + } }else{ - m_log.DebugFormat("[Authenticate]: no col webLoginKey in passwd.db"); + m_log.DebugFormat("[AUTH SERVICE]: no col webLoginKey in passwd.db"); } } m_log.DebugFormat("[AUTH SERVICE]: PrincipalID {0} or its data not found", principalID); -- cgit v1.1