From 2a8f66b221e93fb2d693c1c273c2dee85439f835 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 6 Sep 2009 04:28:42 +0100 Subject: Revising the user account data interfaces. No user functionality yet --- .../Connectors/User/UserServiceConnector.cs | 145 ++------------------- OpenSim/Services/Interfaces/IUserService.cs | 35 ++--- OpenSim/Services/UserService/UserService.cs | 14 +- 3 files changed, 30 insertions(+), 164 deletions(-) (limited to 'OpenSim/Services') diff --git a/OpenSim/Services/Connectors/User/UserServiceConnector.cs b/OpenSim/Services/Connectors/User/UserServiceConnector.cs index fb03844..d418938 100644 --- a/OpenSim/Services/Connectors/User/UserServiceConnector.cs +++ b/OpenSim/Services/Connectors/User/UserServiceConnector.cs @@ -39,7 +39,7 @@ using OpenMetaverse; namespace OpenSim.Services.Connectors { - public class UserServicesConnector : IUserAccountDataService + public class UserServicesConnector : IUserAccountService { private static readonly ILog m_log = LogManager.GetLogger( @@ -81,153 +81,34 @@ namespace OpenSim.Services.Connectors m_ServerURI = serviceURI; } - public UserAccountData GetUserAccountData(UUID scopeID, string firstName, string lastName) + public UserAccount GetUserAccount(UUID scopeID, string firstName, string lastName) { - string uri = m_ServerURI + "/users/"; - UserAccountData data = new UserAccountData(); - data.FirstName = firstName; - data.LastName = lastName; - data.ScopeID = scopeID; - data.UserID = UUID.Zero; - - try - { - data = SynchronousRestObjectRequester. - MakeRequest("POST", uri, data); - } - catch (Exception e) - { - m_log.WarnFormat("[USER CONNECTOR]: Unable to send request to user server. Reason: {1}", e.Message); - return null; - } - - if (data.UserID == UUID.Zero) - return null; - - return data; + return null; } - public UserAccountData GetUserAccountData(UUID scopeID, UUID userID) + public UserAccount GetUserAccount(UUID scopeID, UUID userID) { - string uri = m_ServerURI + "/users/"; - UserAccountData data = new UserAccountData(); - data.FirstName = String.Empty; - data.LastName = String.Empty; - data.ScopeID = scopeID; - data.UserID = userID; - - try - { - data = SynchronousRestObjectRequester. - MakeRequest("POST", uri, data); - } - catch (Exception e) - { - m_log.WarnFormat("[USER CONNECTOR]: Unable to send request to user server. Reason: {1}", e.Message); - return null; - } - - if (data.UserID == UUID.Zero) - return null; - - return data; + return null; } - public bool SetHomePosition(UserAccountData data, UUID regionID, UUID regionSecret) + public bool SetHomePosition(UserAccount data, UUID regionID, UUID regionSecret) { - string uri = m_ServerURI + "/user/"; - bool result = false; - - UserAccountDataMessage msg = new UserAccountDataMessage(); - - msg.Data = data; - msg.RegionID = regionID; - msg.RegionSecret = regionSecret; - - try - { - result = SynchronousRestObjectRequester. - MakeRequest("POST", uri, msg); - } - catch (Exception e) - { - m_log.WarnFormat("[USER CONNECTOR]: Unable to send request to user server. Reason: {1}", e.Message); - return false; - } - - return result; + return false; } - public bool SetUserAccountData(UserAccountData data, UUID principalID, UUID sessionID) + public bool SetUserAccount(UserAccount data, UUID principalID, string token) { - string uri = m_ServerURI + "/user/"; - bool result = false; - - UserAccountDataMessage msg = new UserAccountDataMessage(); - - msg.Data = data; - msg.PrincipalID = principalID; - msg.SessionID = sessionID; - - try - { - result = SynchronousRestObjectRequester. - MakeRequest("POST", uri, msg); - } - catch (Exception e) - { - m_log.WarnFormat("[USER CONNECTOR]: Unable to send request to user server. Reason: {1}", e.Message); - return false; - } - - return result; + return false; } - public bool CreateUserAccountData(UserAccountData data, UUID principalID, UUID sessionID) + public bool CreateUserAccount(UserAccount data, UUID principalID, string token) { - string uri = m_ServerURI + "/newuser/"; - bool result = false; - - UserAccountDataMessage msg = new UserAccountDataMessage(); - - msg.Data = data; - msg.PrincipalID = principalID; - msg.SessionID = sessionID; - - try - { - result = SynchronousRestObjectRequester. - MakeRequest("POST", uri, msg); - } - catch (Exception e) - { - m_log.WarnFormat("[USER CONNECTOR]: Unable to send request to user server. Reason: {1}", e.Message); - return false; - } - - return result; + return false; } - public List GetUserAccountData(UUID scopeID, string query) + public List GetUserAccount(UUID scopeID, string query) { - string uri = m_ServerURI + "/userlist/"; - UserAccountData data = new UserAccountData(); - data.FirstName = query; - data.ScopeID = scopeID; - List result; - - try - { - result = SynchronousRestObjectRequester. - MakeRequest>("POST", uri, data); - } - catch (Exception e) - { - m_log.WarnFormat("[USER CONNECTOR]: Unable to send request to user server. Reason: {1}", e.Message); - return null; - } - - return result; + return null; } } } diff --git a/OpenSim/Services/Interfaces/IUserService.cs b/OpenSim/Services/Interfaces/IUserService.cs index 35254a1..92bd8ef 100644 --- a/OpenSim/Services/Interfaces/IUserService.cs +++ b/OpenSim/Services/Interfaces/IUserService.cs @@ -30,13 +30,13 @@ using OpenMetaverse; namespace OpenSim.Services.Interfaces { - public class UserAccountData + public class UserAccount { - public UserAccountData() + public UserAccount() { } - public UserAccountData(UUID userID, UUID homeRegionID, float homePositionX, + public UserAccount(UUID userID, UUID homeRegionID, float homePositionX, float homePositionY, float homePositionZ, float homeLookAtX, float homeLookAtY, float homeLookAtZ) { @@ -78,41 +78,26 @@ namespace OpenSim.Services.Interfaces }; - public class UserAccountDataMessage + public interface IUserAccountService { - public UserAccountData Data; - - // Set to the region's ID and secret when updating home location - // - public UUID RegionID; - public UUID RegionSecret; - - // Set to the auth info of the user requesting creation/update - // - public UUID PrincipalID; - public UUID SessionID; - }; - - public interface IUserAccountDataService - { - UserAccountData GetUserAccountData(UUID scopeID, UUID userID); - UserAccountData GetUserAccountData(UUID scopeID, string FirstName, string LastName); + UserAccount GetUserAccount(UUID scopeID, UUID userID); + UserAccount GetUserAccount(UUID scopeID, string FirstName, string LastName); // Returns the list of avatars that matches both the search // criterion and the scope ID passed // - List GetUserAccountData(UUID scopeID, string query); + List GetUserAccount(UUID scopeID, string query); // This will set only the home region portion of the data! // Can't be used to set god level, flags, type or change the name! // - bool SetHomePosition(UserAccountData data, UUID RegionID, UUID RegionSecret); + bool SetHomePosition(UserAccount data, UUID RegionID, UUID RegionSecret); // Update all updatable fields // - bool SetUserAccountData(UserAccountData data, UUID PrincipalID, UUID SessionID); + bool SetUserAccount(UserAccount data, UUID PrincipalID, string token); // Creates a user data record - bool CreateUserAccountData(UserAccountData data, UUID PrincipalID, UUID SessionID); + bool CreateUserAccount(UserAccount data, UUID PrincipalID, string token); } } diff --git a/OpenSim/Services/UserService/UserService.cs b/OpenSim/Services/UserService/UserService.cs index 78793657..e8b9fc3 100644 --- a/OpenSim/Services/UserService/UserService.cs +++ b/OpenSim/Services/UserService/UserService.cs @@ -35,39 +35,39 @@ using OpenMetaverse; namespace OpenSim.Services.UserAccountService { - public class UserAccountService : UserAccountServiceBase, IUserAccountDataService + public class UserAccountService : UserAccountServiceBase, IUserAccountService { public UserAccountService(IConfigSource config) : base(config) { } - public UserAccountData GetUserAccountData(UUID scopeID, string firstName, + public UserAccount GetUserAccount(UUID scopeID, string firstName, string lastName) { return null; } - public UserAccountData GetUserAccountData(UUID scopeID, UUID userID) + public UserAccount GetUserAccount(UUID scopeID, UUID userID) { return null; } - public bool SetHomePosition(UserAccountData data, UUID regionID, UUID regionSecret) + public bool SetHomePosition(UserAccount data, UUID regionID, UUID regionSecret) { return false; } - public bool SetUserAccountData(UserAccountData data, UUID principalID, UUID sessionID) + public bool SetUserAccount(UserAccount data, UUID principalID, string token) { return false; } - public bool CreateUserAccountData(UserAccountData data, UUID principalID, UUID sessionID) + public bool CreateUserAccount(UserAccount data, UUID principalID, string token) { return false; } - public List GetUserAccountData(UUID scopeID, + public List GetUserAccount(UUID scopeID, string query) { return null; -- cgit v1.1 From bb1d4d23c4703cde5c3f7f7d2d123a8abaac3cfa Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 6 Sep 2009 04:44:08 +0100 Subject: Change the loader to actually load the user service data module --- OpenSim/Services/UserService/UserServiceBase.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'OpenSim/Services') diff --git a/OpenSim/Services/UserService/UserServiceBase.cs b/OpenSim/Services/UserService/UserServiceBase.cs index c982c1a..fea8b01 100644 --- a/OpenSim/Services/UserService/UserServiceBase.cs +++ b/OpenSim/Services/UserService/UserServiceBase.cs @@ -36,7 +36,7 @@ namespace OpenSim.Services.UserAccountService { public class UserAccountServiceBase: ServiceBase { - protected IUserDataPlugin m_Database = null; + protected IUserAccountData m_Database = null; public UserAccountServiceBase(IConfigSource config) : base(config) { @@ -53,12 +53,12 @@ namespace OpenSim.Services.UserAccountService string connString = userConfig.GetString("ConnectionString", String.Empty); - m_Database = LoadPlugin(dllName); + string realm = userConfig.GetString("Realm", "users"); + + m_Database = LoadPlugin(dllName, new Object[] {connString, realm}); if (m_Database == null) throw new Exception("Could not find a storage interface in the given module"); - - m_Database.Initialise(connString); } } } -- cgit v1.1 From dcebbc3f1b27cf01ae28cb522c5180c195729823 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 6 Sep 2009 15:55:14 +0100 Subject: Remove the encryption from the IAuthenticationService interface. That is too high up for that type of stuff. It needs to be at the connector/handler level --- .../AuthenticationServiceBase.cs | 15 --------- .../PasswordAuthenticationService.cs | 5 --- .../WebkeyAuthenticationService.cs | 5 --- .../Services/Interfaces/IAuthenticationService.cs | 36 ---------------------- 4 files changed, 61 deletions(-) (limited to 'OpenSim/Services') diff --git a/OpenSim/Services/AuthenticationService/AuthenticationServiceBase.cs b/OpenSim/Services/AuthenticationService/AuthenticationServiceBase.cs index 2ed177c..8904461 100644 --- a/OpenSim/Services/AuthenticationService/AuthenticationServiceBase.cs +++ b/OpenSim/Services/AuthenticationService/AuthenticationServiceBase.cs @@ -90,31 +90,16 @@ namespace OpenSim.Services.AuthenticationService throw new Exception("Could not find a storage interface in the given module"); } - public virtual byte[] GetPublicKey() - { - return new byte[0]; - } - public bool Verify(UUID principalID, string token, int lifetime) { return m_Database.CheckToken(principalID, token, lifetime); } - public bool VerifyEncrypted(byte[] cyphertext, byte[] key) - { - return false; - } - public virtual bool Release(UUID principalID, string token) { return m_Database.CheckToken(principalID, token, 0); } - public virtual bool ReleaseEncrypted(byte[] cyphertext, byte[] key) - { - return false; - } - protected string GetToken(UUID principalID, int lifetime) { UUID token = UUID.Random(); diff --git a/OpenSim/Services/AuthenticationService/PasswordAuthenticationService.cs b/OpenSim/Services/AuthenticationService/PasswordAuthenticationService.cs index 7fdbbf6..6c99b66 100644 --- a/OpenSim/Services/AuthenticationService/PasswordAuthenticationService.cs +++ b/OpenSim/Services/AuthenticationService/PasswordAuthenticationService.cs @@ -76,10 +76,5 @@ namespace OpenSim.Services.AuthenticationService return String.Empty; } - - public byte[] AuthenticateEncrypted(byte[] cyphertext, byte[] key) - { - return new byte[0]; - } } } diff --git a/OpenSim/Services/AuthenticationService/WebkeyAuthenticationService.cs b/OpenSim/Services/AuthenticationService/WebkeyAuthenticationService.cs index 0118c91..8831c8a 100644 --- a/OpenSim/Services/AuthenticationService/WebkeyAuthenticationService.cs +++ b/OpenSim/Services/AuthenticationService/WebkeyAuthenticationService.cs @@ -56,10 +56,5 @@ namespace OpenSim.Services.AuthenticationService { return String.Empty; } - - public byte[] AuthenticateEncrypted(byte[] cyphertext, byte[] key) - { - return new byte[0]; - } } } diff --git a/OpenSim/Services/Interfaces/IAuthenticationService.cs b/OpenSim/Services/Interfaces/IAuthenticationService.cs index b448a14..9225773 100644 --- a/OpenSim/Services/Interfaces/IAuthenticationService.cs +++ b/OpenSim/Services/Interfaces/IAuthenticationService.cs @@ -39,39 +39,12 @@ namespace OpenSim.Services.Interfaces public interface IAuthenticationService { ////////////////////////////////////////////////////// - // PKI Zone! - // - // HG2 authentication works by using a cryptographic - // exchange. - // This method must provide a public key, the other - // crypto methods must understand hoow to deal with - // messages encrypted to it. - // - // If the public key is of zero length, you will - // get NO encryption and NO security. - // - // For non-HG installations, this is not relevant - // - // Implementors who are not using PKI can treat the - // cyphertext as a string and provide a zero-length - // key. Encryptionless implementations will not - // interoperate with implementations using encryption. - // If one side uses encryption, both must do so. - // - byte[] GetPublicKey(); - - ////////////////////////////////////////////////////// // Authentication // // These methods will return a token, which can be used to access // various services. // - // The encrypted versions take the received cyphertext and - // the public key of the peer, which the connector must have - // obtained using a remote GetPublicKey call. - // string Authenticate(UUID principalID, string password, int lifetime); - byte[] AuthenticateEncrypted(byte[] cyphertext, byte[] key); ////////////////////////////////////////////////////// // Verification @@ -81,12 +54,7 @@ namespace OpenSim.Services.Interfaces // Tokens expire after 30 minutes and can be refreshed by // re-verifying. // - // If encrypted authentication was used, encrypted verification - // must be used to refresh. Unencrypted verification is still - // performed, but doesn't refresh token lifetime. - // bool Verify(UUID principalID, string token, int lifetime); - bool VerifyEncrypted(byte[] cyphertext, byte[] key); ////////////////////////////////////////////////////// // Teardown @@ -95,11 +63,7 @@ namespace OpenSim.Services.Interfaces // invalidates it and it can not subsequently be used // or refreshed. // - // Tokens created by encrypted authentication must - // be returned by encrypted release calls; - // bool Release(UUID principalID, string token); - bool ReleaseEncrypted(byte[] cyphertext, byte[] key); ////////////////////////////////////////////////////// // Grid -- cgit v1.1