diff options
author | Diva Canto | 2009-09-10 19:56:08 -0700 |
---|---|---|
committer | Diva Canto | 2009-09-10 19:56:08 -0700 |
commit | ce332f235ccc5168cfc44834e16318497c67cdd7 (patch) | |
tree | 27e0f79a50060c981dffd4dbffe5938d70cad2a3 | |
parent | added AuthorizationRequest and AuthorizationResponse objects for passing Auth... (diff) | |
download | opensim-SC_OLD-ce332f235ccc5168cfc44834e16318497c67cdd7.zip opensim-SC_OLD-ce332f235ccc5168cfc44834e16318497c67cdd7.tar.gz opensim-SC_OLD-ce332f235ccc5168cfc44834e16318497c67cdd7.tar.bz2 opensim-SC_OLD-ce332f235ccc5168cfc44834e16318497c67cdd7.tar.xz |
Changed the interface of IAuthorizationService to get less data.
9 files changed, 32 insertions, 56 deletions
diff --git a/OpenSim/Framework/AuthorizationRequest.cs b/OpenSim/Framework/AuthorizationRequest.cs index 864d87d..3280c65 100644 --- a/OpenSim/Framework/AuthorizationRequest.cs +++ b/OpenSim/Framework/AuthorizationRequest.cs | |||
@@ -29,7 +29,7 @@ namespace OpenSim.Framework | |||
29 | { | 29 | { |
30 | public class AuthorizationRequest | 30 | public class AuthorizationRequest |
31 | { | 31 | { |
32 | private string m_ID; | 32 | private string m_userID; |
33 | private string m_firstname; | 33 | private string m_firstname; |
34 | private string m_surname; | 34 | private string m_surname; |
35 | private string m_email; | 35 | private string m_email; |
@@ -40,46 +40,18 @@ namespace OpenSim.Framework | |||
40 | { | 40 | { |
41 | } | 41 | } |
42 | 42 | ||
43 | public AuthorizationRequest(string ID,string FirstName, string SurName, string Email, string RegionName, string RegionID) | 43 | public AuthorizationRequest(string ID, string RegionID) |
44 | { | 44 | { |
45 | m_ID = ID; | 45 | m_userID = ID; |
46 | m_firstname = FirstName; | ||
47 | m_surname = SurName; | ||
48 | m_email = Email; | ||
49 | m_regionName = RegionName; | ||
50 | m_regionID = RegionID; | 46 | m_regionID = RegionID; |
51 | } | 47 | } |
52 | 48 | ||
53 | public string ID | 49 | public string ID |
54 | { | 50 | { |
55 | get { return m_ID; } | 51 | get { return m_userID; } |
56 | set { m_ID = value; } | 52 | set { m_userID = value; } |
57 | } | 53 | } |
58 | 54 | ||
59 | public string FirstName | ||
60 | { | ||
61 | get { return m_firstname; } | ||
62 | set { m_firstname = value; } | ||
63 | } | ||
64 | |||
65 | public string SurName | ||
66 | { | ||
67 | get { return m_surname; } | ||
68 | set { m_surname = value; } | ||
69 | } | ||
70 | |||
71 | public string Email | ||
72 | { | ||
73 | get { return m_email; } | ||
74 | set { m_email = value; } | ||
75 | } | ||
76 | |||
77 | public string RegionName | ||
78 | { | ||
79 | get { return m_regionName; } | ||
80 | set { m_regionName = value; } | ||
81 | } | ||
82 | |||
83 | public string RegionID | 55 | public string RegionID |
84 | { | 56 | { |
85 | get { return m_regionID; } | 57 | get { return m_regionID; } |
diff --git a/OpenSim/Framework/AuthorizationResponse.cs b/OpenSim/Framework/AuthorizationResponse.cs index 5a03dfe..c8d77de 100644 --- a/OpenSim/Framework/AuthorizationResponse.cs +++ b/OpenSim/Framework/AuthorizationResponse.cs | |||
@@ -36,7 +36,7 @@ namespace OpenSim.Framework | |||
36 | { | 36 | { |
37 | } | 37 | } |
38 | 38 | ||
39 | public AuthorizationResponse(bool isAuthorized,string message) | 39 | public AuthorizationResponse(bool isAuthorized, string message) |
40 | { | 40 | { |
41 | m_isAuthorized = isAuthorized; | 41 | m_isAuthorized = isAuthorized; |
42 | m_message = message; | 42 | m_message = message; |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Authorization/LocalAuthorizationServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Authorization/LocalAuthorizationServiceConnector.cs index 7973496..c52c257 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Authorization/LocalAuthorizationServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Authorization/LocalAuthorizationServiceConnector.cs | |||
@@ -67,7 +67,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Authorization | |||
67 | IConfig moduleConfig = source.Configs["Modules"]; | 67 | IConfig moduleConfig = source.Configs["Modules"]; |
68 | if (moduleConfig != null) | 68 | if (moduleConfig != null) |
69 | { | 69 | { |
70 | string name = moduleConfig.GetString("AuthorizationServices", ""); | 70 | string name = moduleConfig.GetString("AuthorizationServices", string.Empty); |
71 | if (name == Name) | 71 | if (name == Name) |
72 | { | 72 | { |
73 | IConfig authorizationConfig = source.Configs["AuthorizationService"]; | 73 | IConfig authorizationConfig = source.Configs["AuthorizationService"]; |
@@ -132,9 +132,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Authorization | |||
132 | 132 | ||
133 | } | 133 | } |
134 | 134 | ||
135 | public bool isAuthorizedForRegion(UserProfileData user, RegionInfo region) | 135 | public bool IsAuthorizedForRegion(string userID, string regionID) |
136 | { | 136 | { |
137 | return m_AuthorizationService.isAuthorizedForRegion( user, region); | 137 | return m_AuthorizationService.IsAuthorizedForRegion(userID, regionID); |
138 | } | 138 | } |
139 | 139 | ||
140 | } | 140 | } |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 1346844..d95d9d3 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -3250,12 +3250,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
3250 | 3250 | ||
3251 | if (!m_strictAccessControl) return true; | 3251 | if (!m_strictAccessControl) return true; |
3252 | if (Permissions.IsGod(agent.AgentID)) return true; | 3252 | if (Permissions.IsGod(agent.AgentID)) return true; |
3253 | 3253 | ||
3254 | UserProfileData userProfile = CommsManager.UserService.GetUserProfile(agent.AgentID); | 3254 | if (AuthorizationService != null) |
3255 | |||
3256 | if(AuthorizationService!=null) | ||
3257 | { | 3255 | { |
3258 | if(!AuthorizationService.isAuthorizedForRegion(userProfile,RegionInfo)) | 3256 | if(!AuthorizationService.IsAuthorizedForRegion(agent.AgentID.ToString(), RegionInfo.RegionID.ToString())) |
3259 | { | 3257 | { |
3260 | m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user does not have access to the region", | 3258 | m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user does not have access to the region", |
3261 | agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName); | 3259 | agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName); |
diff --git a/OpenSim/Server/Handlers/Authorization/AuthorizationServerPostHandler.cs b/OpenSim/Server/Handlers/Authorization/AuthorizationServerPostHandler.cs index 407a18a..fb079d3 100644 --- a/OpenSim/Server/Handlers/Authorization/AuthorizationServerPostHandler.cs +++ b/OpenSim/Server/Handlers/Authorization/AuthorizationServerPostHandler.cs | |||
@@ -60,7 +60,9 @@ namespace OpenSim.Server.Handlers.Authorization | |||
60 | XmlSerializer xs = new XmlSerializer(typeof (AuthorizationRequest)); | 60 | XmlSerializer xs = new XmlSerializer(typeof (AuthorizationRequest)); |
61 | AuthorizationRequest Authorization = (AuthorizationRequest) xs.Deserialize(request); | 61 | AuthorizationRequest Authorization = (AuthorizationRequest) xs.Deserialize(request); |
62 | 62 | ||
63 | AuthorizationResponse result = new AuthorizationResponse(true,Authorization.FirstName + " " + Authorization.SurName + " has been authorized"); | 63 | bool authorized = m_AuthorizationService.IsAuthorizedForRegion(Authorization.ID, Authorization.RegionID); |
64 | |||
65 | AuthorizationResponse result = new AuthorizationResponse(authorized, Authorization.ID + " has been authorized"); | ||
64 | 66 | ||
65 | xs = new XmlSerializer(typeof(AuthorizationResponse)); | 67 | xs = new XmlSerializer(typeof(AuthorizationResponse)); |
66 | return ServerUtils.SerializeResult(xs, result); | 68 | return ServerUtils.SerializeResult(xs, result); |
diff --git a/OpenSim/Services/AuthorizationService/AuthorizationService.cs b/OpenSim/Services/AuthorizationService/AuthorizationService.cs index e779325..c795ba0 100644 --- a/OpenSim/Services/AuthorizationService/AuthorizationService.cs +++ b/OpenSim/Services/AuthorizationService/AuthorizationService.cs | |||
@@ -48,7 +48,7 @@ namespace OpenSim.Services.AuthorizationService | |||
48 | m_log.Info("[AUTHORIZATION CONNECTOR]: Local Authorization service enabled"); | 48 | m_log.Info("[AUTHORIZATION CONNECTOR]: Local Authorization service enabled"); |
49 | } | 49 | } |
50 | 50 | ||
51 | public bool isAuthorizedForRegion(UserProfileData user, RegionInfo region) | 51 | public bool IsAuthorizedForRegion(string userID, string regionID) |
52 | { | 52 | { |
53 | return true; | 53 | return true; |
54 | } | 54 | } |
diff --git a/OpenSim/Services/Connectors/Authorization/AuthorizationServiceConnector.cs b/OpenSim/Services/Connectors/Authorization/AuthorizationServiceConnector.cs index d65afc6..d50a6ed 100644 --- a/OpenSim/Services/Connectors/Authorization/AuthorizationServiceConnector.cs +++ b/OpenSim/Services/Connectors/Authorization/AuthorizationServiceConnector.cs | |||
@@ -88,14 +88,14 @@ namespace OpenSim.Services.Connectors | |||
88 | m_ResponseOnFailure = responseOnFailure; | 88 | m_ResponseOnFailure = responseOnFailure; |
89 | } | 89 | } |
90 | 90 | ||
91 | public bool isAuthorizedForRegion(UserProfileData user, RegionInfo region) | 91 | public bool IsAuthorizedForRegion(string userID, string regionID) |
92 | { | 92 | { |
93 | // do 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.InfoFormat("[AUTHORIZATION CONNECTOR]: isAuthorizedForRegion checking {0} {1} at remote server {2}",user.FirstName,user.SurName, m_ServerURI); | 94 | m_log.InfoFormat("[AUTHORIZATION CONNECTOR]: IsAuthorizedForRegion checking {0} at remote server {1}", userID, m_ServerURI); |
95 | 95 | ||
96 | string uri = m_ServerURI; | 96 | string uri = m_ServerURI; |
97 | 97 | ||
98 | AuthorizationRequest req = new AuthorizationRequest(user.ID.ToString(),user.FirstName,user.SurName,user.Email,region.RegionName,region.RegionID.ToString()); | 98 | AuthorizationRequest req = new AuthorizationRequest(userID, regionID); |
99 | 99 | ||
100 | AuthorizationResponse response; | 100 | AuthorizationResponse response; |
101 | try | 101 | try |
@@ -104,16 +104,14 @@ namespace OpenSim.Services.Connectors | |||
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} for region {1} error thrown during comms with remote server. Reason: {2}", userID, regionID, e.Message); |
108 | m_log.WarnFormat("Inner Exception is {0}",e.InnerException); | 108 | m_log.WarnFormat("Inner Exception is {0}",e.InnerException); |
109 | return m_ResponseOnFailure; | 109 | return m_ResponseOnFailure; |
110 | } | 110 | } |
111 | 111 | ||
112 | m_log.DebugFormat("[AUTHORIZATION CONNECTOR] response from remote service was {0}",response.Message); | 112 | m_log.DebugFormat("[AUTHORIZATION CONNECTOR] response from remote service was {0}", response.Message); |
113 | if(response.IsAuthorized) | 113 | |
114 | return true; | 114 | return response.IsAuthorized; |
115 | else | ||
116 | return false; | ||
117 | } | 115 | } |
118 | 116 | ||
119 | } | 117 | } |
diff --git a/OpenSim/Services/Interfaces/IAuthorizationService.cs b/OpenSim/Services/Interfaces/IAuthorizationService.cs index e8b7298..6acd1f6 100644 --- a/OpenSim/Services/Interfaces/IAuthorizationService.cs +++ b/OpenSim/Services/Interfaces/IAuthorizationService.cs | |||
@@ -40,7 +40,7 @@ namespace OpenSim.Services.Interfaces | |||
40 | // This method returns a simple true false indicating | 40 | // This method returns a simple true false indicating |
41 | // whether or not a user has access to the region | 41 | // whether or not a user has access to the region |
42 | // | 42 | // |
43 | bool isAuthorizedForRegion(UserProfileData user, RegionInfo region); | 43 | bool IsAuthorizedForRegion(string userID, string regionID); |
44 | 44 | ||
45 | } | 45 | } |
46 | } | 46 | } |
diff --git a/bin/config-include/StandaloneHypergrid.ini b/bin/config-include/StandaloneHypergrid.ini index 6359ac0..aa122be 100644 --- a/bin/config-include/StandaloneHypergrid.ini +++ b/bin/config-include/StandaloneHypergrid.ini | |||
@@ -11,6 +11,7 @@ | |||
11 | AssetServices = "HGAssetBroker" | 11 | AssetServices = "HGAssetBroker" |
12 | InventoryServices = "HGInventoryBroker" | 12 | InventoryServices = "HGInventoryBroker" |
13 | NeighbourServices = "LocalNeighbourServicesConnector" | 13 | NeighbourServices = "LocalNeighbourServicesConnector" |
14 | AuthorizationServices = "LocalAuthorizationServicesConnector" | ||
14 | InventoryServiceInConnector = true | 15 | InventoryServiceInConnector = true |
15 | AssetServiceInConnector = true | 16 | AssetServiceInConnector = true |
16 | HGAuthServiceInConnector = true | 17 | HGAuthServiceInConnector = true |
@@ -31,6 +32,11 @@ | |||
31 | LocalGridInventoryService = "OpenSim.Services.InventoryService.dll:InventoryService" | 32 | LocalGridInventoryService = "OpenSim.Services.InventoryService.dll:InventoryService" |
32 | HypergridInventoryService = "OpenSim.Services.Connectors.dll:HGInventoryServiceConnector" | 33 | HypergridInventoryService = "OpenSim.Services.Connectors.dll:HGInventoryServiceConnector" |
33 | 34 | ||
35 | [AuthorizationService] | ||
36 | LocalServiceModule = "OpenSim.Services.AuthorizationService.dll:AuthorizationService" | ||
37 | |||
34 | [AuthenticationService] | 38 | [AuthenticationService] |
35 | ; For the HGAuthServiceInConnector | 39 | ; For the HGAuthServiceInConnector |
36 | LocalServiceModule = "OpenSim.Services.AuthenticationService.dll:HGAuthenticationService" \ No newline at end of file | 40 | LocalServiceModule = "OpenSim.Services.AuthenticationService.dll:HGAuthenticationService" |
41 | |||
42 | \ No newline at end of file | ||