From b5c8925fdf17db87df6118449f2f84adb1326225 Mon Sep 17 00:00:00 2001 From: Rob Smart Date: Thu, 10 Sep 2009 20:15:50 +0100 Subject: added AuthorizationRequest and AuthorizationResponse objects for passing Authorization messages over http. Added handling code for these in the AuthorizationServerConnector and AuthorizationServicesConnector --- .../Authorization/AuthorizationServiceConnector.cs | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'OpenSim/Services') diff --git a/OpenSim/Services/Connectors/Authorization/AuthorizationServiceConnector.cs b/OpenSim/Services/Connectors/Authorization/AuthorizationServiceConnector.cs index 151d96a..d65afc6 100644 --- a/OpenSim/Services/Connectors/Authorization/AuthorizationServiceConnector.cs +++ b/OpenSim/Services/Connectors/Authorization/AuthorizationServiceConnector.cs @@ -90,26 +90,27 @@ namespace OpenSim.Services.Connectors public bool isAuthorizedForRegion(UserProfileData user, RegionInfo region) { - // this should be a remote call to the authorization server specified in the AuthorizationServerURI - m_log.Info("[AUTHORIZATION CONNECTOR]: isAuthorizedForRegion is not yet implemented. Returning true, the user is authorized "); + // do a remote call to the authorization server specified in the AuthorizationServerURI + m_log.InfoFormat("[AUTHORIZATION CONNECTOR]: isAuthorizedForRegion checking {0} {1} at remote server {2}",user.FirstName,user.SurName, m_ServerURI); - string uri = m_ServerURI + "?uuid="+user.ID + "&firstname="+user.FirstName+"&lastname="+user.SurName+"®ion="+region.RegionName+"®ionid="+region.RegionID+"&email="+user.Email; + string uri = m_ServerURI; - string result = string.Empty; + AuthorizationRequest req = new AuthorizationRequest(user.ID.ToString(),user.FirstName,user.SurName,user.Email,region.RegionName,region.RegionID.ToString()); + AuthorizationResponse response; try { - result = SynchronousRestObjectRequester. - MakeRequest("POST", uri, user); + response = SynchronousRestObjectRequester.MakeRequest("POST", uri, req); } catch (Exception e) { m_log.WarnFormat("[AUTHORIZATION CONNECTOR]: Unable to send authorize {0} {1} for region {2} error thrown during comms with remote server. Reason: {3}", user.FirstName,user.SurName,region.RegionName, e.Message); + m_log.WarnFormat("Inner Exception is {0}",e.InnerException); return m_ResponseOnFailure; } - m_log.DebugFormat("[AUTHORIZATION CONNECTOR] response from remote service was {0}",result); - if(result.Contains("success")) + m_log.DebugFormat("[AUTHORIZATION CONNECTOR] response from remote service was {0}",response.Message); + if(response.IsAuthorized) return true; else return false; -- cgit v1.1