diff options
-rw-r--r-- | OpenSim/Services/AuthenticationService/WebkeyAuthenticationService.cs | 40 |
1 files changed, 35 insertions, 5 deletions
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; | |||
31 | using log4net; | 31 | using log4net; |
32 | using Nini.Config; | 32 | using Nini.Config; |
33 | using System.Reflection; | 33 | using System.Reflection; |
34 | using OpenSim.Data; | ||
35 | using OpenSim.Framework; | ||
36 | using OpenSim.Framework.Console; | ||
34 | 37 | ||
35 | namespace OpenSim.Services.AuthenticationService | 38 | namespace OpenSim.Services.AuthenticationService |
36 | { | 39 | { |
@@ -43,17 +46,44 @@ 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 | m_log.InfoFormat("[Authenticate]: Trying a web key authenticate"); | ||
61 | if (new UUID(password) == UUID.Zero) | ||
62 | { | ||
63 | m_log.InfoFormat("[Authenticate]: NULL_KEY is not a valid web_login_key"); | ||
64 | } | ||
65 | else | ||
66 | { | ||
67 | AuthenticationData data = m_Database.Get(principalID); | ||
68 | if (data != null && data.Data != null) | ||
69 | { | ||
70 | if (data.Data.ContainsKey("webLoginKey")) | ||
71 | { | ||
72 | m_log.InfoFormat("[Authenticate]: Trying a web key authentication"); | ||
73 | string key = data.Data["webLoginKey"].ToString(); | ||
74 | m_log.DebugFormat("[WEB LOGIN AUTH]: got {0} for key in db vs {1}", key, password); | ||
75 | if (key == password) | ||
76 | { | ||
77 | data.Data["webLoginKey"] = UUID.Zero.ToString(); | ||
78 | m_Database.Store(data); | ||
79 | return GetToken(principalID, lifetime); | ||
80 | } | ||
81 | }else{ | ||
82 | m_log.InfoFormat("[Authenticate]: no col webLoginKey in passwd.db"); | ||
83 | } | ||
84 | } | ||
85 | m_log.DebugFormat("[AUTH SERVICE]: PrincipalID {0} or its data not found", principalID); | ||
86 | } | ||
57 | return String.Empty; | 87 | return String.Empty; |
58 | } | 88 | } |
59 | } | 89 | } |