diff options
author | Rob Smart | 2009-09-10 20:15:50 +0100 |
---|---|---|
committer | Diva Canto | 2009-09-10 17:53:05 -0700 |
commit | b5c8925fdf17db87df6118449f2f84adb1326225 (patch) | |
tree | 6e332f052221028039c7f80d919227d1b4d95289 /OpenSim/Services/Connectors | |
parent | adding in working functionality for the remote connector (diff) | |
download | opensim-SC_OLD-b5c8925fdf17db87df6118449f2f84adb1326225.zip opensim-SC_OLD-b5c8925fdf17db87df6118449f2f84adb1326225.tar.gz opensim-SC_OLD-b5c8925fdf17db87df6118449f2f84adb1326225.tar.bz2 opensim-SC_OLD-b5c8925fdf17db87df6118449f2f84adb1326225.tar.xz |
added AuthorizationRequest and AuthorizationResponse objects for passing Authorization messages over http. Added handling code for these in the AuthorizationServerConnector and AuthorizationServicesConnector
Diffstat (limited to 'OpenSim/Services/Connectors')
-rw-r--r-- | OpenSim/Services/Connectors/Authorization/AuthorizationServiceConnector.cs | 17 |
1 files changed, 9 insertions, 8 deletions
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 | |||
90 | 90 | ||
91 | public bool isAuthorizedForRegion(UserProfileData user, RegionInfo region) | 91 | public bool isAuthorizedForRegion(UserProfileData user, RegionInfo region) |
92 | { | 92 | { |
93 | // this should be a remote call to the authorization server specified in the AuthorizationServerURI | 93 | // do a remote call to the authorization server specified in the AuthorizationServerURI |
94 | m_log.Info("[AUTHORIZATION CONNECTOR]: isAuthorizedForRegion is not yet implemented. Returning true, the user is authorized "); | 94 | m_log.InfoFormat("[AUTHORIZATION CONNECTOR]: isAuthorizedForRegion checking {0} {1} at remote server {2}",user.FirstName,user.SurName, m_ServerURI); |
95 | 95 | ||
96 | string uri = m_ServerURI + "?uuid="+user.ID + "&firstname="+user.FirstName+"&lastname="+user.SurName+"®ion="+region.RegionName+"®ionid="+region.RegionID+"&email="+user.Email; | 96 | string uri = m_ServerURI; |
97 | 97 | ||
98 | string result = string.Empty; | 98 | AuthorizationRequest req = new AuthorizationRequest(user.ID.ToString(),user.FirstName,user.SurName,user.Email,region.RegionName,region.RegionID.ToString()); |
99 | 99 | ||
100 | AuthorizationResponse response; | ||
100 | try | 101 | try |
101 | { | 102 | { |
102 | result = SynchronousRestObjectRequester. | 103 | response = SynchronousRestObjectRequester.MakeRequest<AuthorizationRequest, AuthorizationResponse>("POST", uri, req); |
103 | MakeRequest<UserProfileData, string>("POST", uri, user); | ||
104 | } | 104 | } |
105 | catch (Exception e) | 105 | catch (Exception e) |
106 | { | 106 | { |
107 | 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); | 107 | 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); |
108 | m_log.WarnFormat("Inner Exception is {0}",e.InnerException); | ||
108 | return m_ResponseOnFailure; | 109 | return m_ResponseOnFailure; |
109 | } | 110 | } |
110 | 111 | ||
111 | m_log.DebugFormat("[AUTHORIZATION CONNECTOR] response from remote service was {0}",result); | 112 | m_log.DebugFormat("[AUTHORIZATION CONNECTOR] response from remote service was {0}",response.Message); |
112 | if(result.Contains("success")) | 113 | if(response.IsAuthorized) |
113 | return true; | 114 | return true; |
114 | else | 115 | else |
115 | return false; | 116 | return false; |