From 11700ba4a4e35cf7512f7f6e8b9b8e54e812f574 Mon Sep 17 00:00:00 2001 From: Melanie Date: Fri, 4 Sep 2009 07:03:43 +0100 Subject: Implement plain password authentication partway. Tested, but no user functionality yet. --- .../PasswordAuthenticationService.cs | 28 +++++++++++++--------- 1 file changed, 17 insertions(+), 11 deletions(-) (limited to 'OpenSim/Services/AuthenticationService/PasswordAuthenticationService.cs') diff --git a/OpenSim/Services/AuthenticationService/PasswordAuthenticationService.cs b/OpenSim/Services/AuthenticationService/PasswordAuthenticationService.cs index 83ce0d0..7fdbbf6 100644 --- a/OpenSim/Services/AuthenticationService/PasswordAuthenticationService.cs +++ b/OpenSim/Services/AuthenticationService/PasswordAuthenticationService.cs @@ -56,8 +56,24 @@ namespace OpenSim.Services.AuthenticationService { } - public string Authenticate(UUID principalID, string password) + public string Authenticate(UUID principalID, string password, int lifetime) { + AuthenticationData data = m_Database.Get(principalID); + + if (!data.Data.ContainsKey("passwordHash") || + !data.Data.ContainsKey("passwordSalt")) + { + return String.Empty; + } + + string hashed = Util.Md5Hash(Util.Md5Hash(password) + ":" + + data.Data["passwordSalt"].ToString()); + + if (data.Data["passwordHash"].ToString() == hashed) + { + return GetToken(principalID, lifetime); + } + return String.Empty; } @@ -65,15 +81,5 @@ namespace OpenSim.Services.AuthenticationService { return new byte[0]; } - - public bool Verify(UUID principalID, string token) - { - return false; - } - - public bool VerifyEncrypted(byte[] cyphertext, byte[] key) - { - return false; - } } } -- cgit v1.1