Implement plain password authentication partway. Tested, but no user

functionality yet.
This commit is contained in:
Melanie
2009-09-04 07:03:43 +01:00
parent c9a24ece54
commit 11700ba4a4
8 changed files with 299 additions and 26 deletions

View File

@@ -95,6 +95,16 @@ namespace OpenSim.Services.AuthenticationService
return new byte[0];
}
public bool Verify(UUID principalID, string token, int lifetime)
{
return false;
}
public bool VerifyEncrypted(byte[] cyphertext, byte[] key)
{
return false;
}
public virtual bool Release(UUID principalID, string token)
{
return false;
@@ -104,5 +114,10 @@ namespace OpenSim.Services.AuthenticationService
{
return false;
}
protected string GetToken(UUID principalID, int lifetime)
{
return "OK";
}
}
}

View File

@@ -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;
}
}
}

View File

@@ -52,7 +52,7 @@ namespace OpenSim.Services.AuthenticationService
{
}
public string Authenticate(UUID principalID, string password)
public string Authenticate(UUID principalID, string password, int lifetime)
{
return String.Empty;
}
@@ -61,15 +61,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;
}
}
}

View File

@@ -70,7 +70,7 @@ namespace OpenSim.Services.Interfaces
// the public key of the peer, which the connector must have
// obtained using a remote GetPublicKey call.
//
string Authenticate(UUID principalID, string password);
string Authenticate(UUID principalID, string password, int lifetime);
byte[] AuthenticateEncrypted(byte[] cyphertext, byte[] key);
//////////////////////////////////////////////////////
@@ -85,7 +85,7 @@ namespace OpenSim.Services.Interfaces
// must be used to refresh. Unencrypted verification is still
// performed, but doesn't refresh token lifetime.
//
bool Verify(UUID principalID, string token);
bool Verify(UUID principalID, string token, int lifetime);
bool VerifyEncrypted(byte[] cyphertext, byte[] key);
//////////////////////////////////////////////////////