diff options
Added Authorization client code that interfaces with HGLoginAuthService. Improved error handling in HGLoginAuthService. Instrumented HGInventoryService so that it can interface both with local and remote user and asset services.
Diffstat (limited to 'OpenSim/Framework/Communications/Services')
-rw-r--r-- | OpenSim/Framework/Communications/Services/HGInventoryService.cs | 73 | ||||
-rw-r--r-- | OpenSim/Framework/Communications/Services/HGLoginAuthService.cs | 32 |
2 files changed, 84 insertions, 21 deletions
diff --git a/OpenSim/Framework/Communications/Services/HGInventoryService.cs b/OpenSim/Framework/Communications/Services/HGInventoryService.cs index 33d7722..eef9e80 100644 --- a/OpenSim/Framework/Communications/Services/HGInventoryService.cs +++ b/OpenSim/Framework/Communications/Services/HGInventoryService.cs | |||
@@ -35,7 +35,7 @@ using Nini.Config; | |||
35 | using OpenMetaverse; | 35 | using OpenMetaverse; |
36 | using OpenSim.Data; | 36 | using OpenSim.Data; |
37 | using OpenSim.Framework; | 37 | using OpenSim.Framework; |
38 | //using OpenSim.Framework.Communications; | 38 | using OpenSim.Framework.Communications.Clients; |
39 | using OpenSim.Framework.Communications.Cache; | 39 | using OpenSim.Framework.Communications.Cache; |
40 | using Caps = OpenSim.Framework.Communications.Capabilities.Caps; | 40 | using Caps = OpenSim.Framework.Communications.Capabilities.Caps; |
41 | using LLSDHelpers = OpenSim.Framework.Communications.Capabilities.LLSDHelpers; | 41 | using LLSDHelpers = OpenSim.Framework.Communications.Capabilities.LLSDHelpers; |
@@ -64,6 +64,7 @@ namespace OpenSim.Framework.Communications.Services | |||
64 | // These two used for remote access | 64 | // These two used for remote access |
65 | string m_UserServerURL = string.Empty; | 65 | string m_UserServerURL = string.Empty; |
66 | string m_AssetServerURL = string.Empty; | 66 | string m_AssetServerURL = string.Empty; |
67 | SynchronousGridAssetClient m_AssetClient = null; | ||
67 | 68 | ||
68 | // Constructor for grid inventory server | 69 | // Constructor for grid inventory server |
69 | public HGInventoryService(InventoryServiceBase invService, string assetServiceURL, string userServiceURL, IHttpServer httpserver, string thisurl) | 70 | public HGInventoryService(InventoryServiceBase invService, string assetServiceURL, string userServiceURL, IHttpServer httpserver, string thisurl) |
@@ -71,6 +72,8 @@ namespace OpenSim.Framework.Communications.Services | |||
71 | m_UserServerURL = userServiceURL; | 72 | m_UserServerURL = userServiceURL; |
72 | m_AssetServerURL = assetServiceURL; | 73 | m_AssetServerURL = assetServiceURL; |
73 | 74 | ||
75 | m_AssetClient = new SynchronousGridAssetClient(m_AssetServerURL); | ||
76 | |||
74 | Init(invService, thisurl, httpserver); | 77 | Init(invService, thisurl, httpserver); |
75 | } | 78 | } |
76 | 79 | ||
@@ -298,7 +301,7 @@ namespace OpenSim.Framework.Communications.Services | |||
298 | Item.Owner = olditem.Owner; | 301 | Item.Owner = olditem.Owner; |
299 | // There should be some tests here about the owner, etc but I'm going to ignore that | 302 | // There should be some tests here about the owner, etc but I'm going to ignore that |
300 | // because I'm not sure it makes any sense | 303 | // because I'm not sure it makes any sense |
301 | // Also I should probably close the asset... | 304 | // Also I should probably clone the asset... |
302 | m_inventoryService.AddItem(Item); | 305 | m_inventoryService.AddItem(Item); |
303 | return Item; | 306 | return Item; |
304 | } | 307 | } |
@@ -319,7 +322,7 @@ namespace OpenSim.Framework.Communications.Services | |||
319 | public List<InventoryFolderBase> GetInventorySkeleton(Guid rawUserID) | 322 | public List<InventoryFolderBase> GetInventorySkeleton(Guid rawUserID) |
320 | { | 323 | { |
321 | UUID userID = new UUID(rawUserID); | 324 | UUID userID = new UUID(rawUserID); |
322 | return ((InventoryServiceBase)m_inventoryService).GetInventorySkeleton(userID); | 325 | return m_inventoryService.GetInventorySkeleton(userID); |
323 | } | 326 | } |
324 | 327 | ||
325 | public List<InventoryItemBase> GetActiveGestures(Guid rawUserID) | 328 | public List<InventoryItemBase> GetActiveGestures(Guid rawUserID) |
@@ -328,7 +331,7 @@ namespace OpenSim.Framework.Communications.Services | |||
328 | 331 | ||
329 | m_log.InfoFormat("[HGStandaloneInvService]: fetching active gestures for user {0}", userID); | 332 | m_log.InfoFormat("[HGStandaloneInvService]: fetching active gestures for user {0}", userID); |
330 | 333 | ||
331 | return ((InventoryServiceBase)m_inventoryService).GetActiveGestures(userID); | 334 | return m_inventoryService.GetActiveGestures(userID); |
332 | } | 335 | } |
333 | 336 | ||
334 | public AssetBase GetAsset(InventoryItemBase item) | 337 | public AssetBase GetAsset(InventoryItemBase item) |
@@ -348,8 +351,10 @@ namespace OpenSim.Framework.Communications.Services | |||
348 | } | 351 | } |
349 | 352 | ||
350 | // All good, get the asset | 353 | // All good, get the asset |
351 | AssetBase theasset = m_assetProvider.FetchAsset(item.AssetID); | 354 | //AssetBase theasset = m_assetProvider.FetchAsset(item.AssetID); |
352 | m_log.Debug("[HGStandaloneInvService] Found asset " + ((theasset == null)? "NULL" : "Not Null")); | 355 | AssetBase theasset = FetchAsset(item.AssetID, (item.InvType == (int)InventoryType.Texture)); |
356 | |||
357 | m_log.Debug("[HGStandaloneInvService] Found asset " + ((theasset == null) ? "NULL" : "Not Null")); | ||
353 | if (theasset != null) | 358 | if (theasset != null) |
354 | { | 359 | { |
355 | asset = theasset; | 360 | asset = theasset; |
@@ -361,7 +366,8 @@ namespace OpenSim.Framework.Communications.Services | |||
361 | public bool PostAsset(AssetBase asset) | 366 | public bool PostAsset(AssetBase asset) |
362 | { | 367 | { |
363 | m_log.Info("[HGStandaloneInvService]: Post asset " + asset.FullID); | 368 | m_log.Info("[HGStandaloneInvService]: Post asset " + asset.FullID); |
364 | m_assetProvider.CreateAsset(asset); | 369 | //m_assetProvider.CreateAsset(asset); |
370 | StoreAsset(asset); | ||
365 | 371 | ||
366 | return true; | 372 | return true; |
367 | } | 373 | } |
@@ -492,7 +498,7 @@ namespace OpenSim.Framework.Communications.Services | |||
492 | return; | 498 | return; |
493 | } | 499 | } |
494 | 500 | ||
495 | bool success = ((IAuthentication)m_userService).VerifyKey(userID, authToken); | 501 | bool success = VerifyKey(userID, authToken); |
496 | 502 | ||
497 | if (success) | 503 | if (success) |
498 | { | 504 | { |
@@ -653,5 +659,56 @@ namespace OpenSim.Framework.Communications.Services | |||
653 | } | 659 | } |
654 | 660 | ||
655 | #endregion Caps | 661 | #endregion Caps |
662 | |||
663 | #region Local vs Remote | ||
664 | |||
665 | bool VerifyKey(UUID userID, string key) | ||
666 | { | ||
667 | // Remote call to the Authorization server | ||
668 | if (m_userService == null) | ||
669 | return AuthClient.VerifyKey(m_UserServerURL, userID, key); | ||
670 | // local call | ||
671 | else | ||
672 | return ((IAuthentication)m_userService).VerifyKey(userID, key); | ||
673 | } | ||
674 | |||
675 | AssetBase FetchAsset(UUID assetID, bool isTexture) | ||
676 | { | ||
677 | // Remote call to the Asset server | ||
678 | if (m_assetProvider == null) | ||
679 | return m_AssetClient.SyncGetAsset(assetID, isTexture); | ||
680 | // local call | ||
681 | else | ||
682 | return m_assetProvider.FetchAsset(assetID); | ||
683 | } | ||
684 | |||
685 | void StoreAsset(AssetBase asset) | ||
686 | { | ||
687 | // Remote call to the Asset server | ||
688 | if (m_assetProvider == null) | ||
689 | m_AssetClient.StoreAsset(asset); | ||
690 | // local call | ||
691 | else | ||
692 | m_assetProvider.CreateAsset(asset); | ||
693 | } | ||
694 | |||
695 | #endregion Local vs Remote | ||
696 | } | ||
697 | |||
698 | class SynchronousGridAssetClient : GridAssetClient | ||
699 | { | ||
700 | public SynchronousGridAssetClient(string url) | ||
701 | : base(url) | ||
702 | { | ||
703 | } | ||
704 | |||
705 | public AssetBase SyncGetAsset(UUID assetID, bool isTexture) | ||
706 | { | ||
707 | AssetRequest assReq = new AssetRequest(); | ||
708 | assReq.AssetID = assetID; | ||
709 | assReq.IsTexture = isTexture; | ||
710 | return base.GetAsset(assReq); | ||
711 | } | ||
712 | |||
656 | } | 713 | } |
657 | } | 714 | } |
diff --git a/OpenSim/Framework/Communications/Services/HGLoginAuthService.cs b/OpenSim/Framework/Communications/Services/HGLoginAuthService.cs index 37c8846..cd4ca5c 100644 --- a/OpenSim/Framework/Communications/Services/HGLoginAuthService.cs +++ b/OpenSim/Framework/Communications/Services/HGLoginAuthService.cs | |||
@@ -169,22 +169,28 @@ namespace OpenSim.Framework.Communications.Services | |||
169 | m_log.Debug(" >> Null"); | 169 | m_log.Debug(" >> Null"); |
170 | } | 170 | } |
171 | 171 | ||
172 | // Verify the key of who's calling | ||
173 | UUID userID = UUID.Zero; | ||
174 | string authKey = string.Empty; | ||
175 | UUID.TryParse((string)request.Params[0], out userID); | ||
176 | authKey = (string)request.Params[1]; | ||
177 | |||
178 | m_log.InfoFormat("[HGLOGIN] HGVerifyKey called with key ", authKey); | ||
179 | bool success = false; | 172 | bool success = false; |
180 | 173 | ||
181 | if (!(m_userManager is IAuthentication)) | 174 | if (request.Params.Count >= 2) |
182 | { | 175 | { |
183 | m_log.Debug("[HGLOGIN]: UserManager is not IAuthentication service. Denying."); | 176 | // Verify the key of who's calling |
184 | } | 177 | UUID userID = UUID.Zero; |
185 | else | 178 | string authKey = string.Empty; |
186 | { | 179 | if (UUID.TryParse((string)request.Params[0], out userID)) |
187 | success = ((IAuthentication)m_userManager).VerifyKey(userID, authKey); | 180 | { |
181 | authKey = (string)request.Params[1]; | ||
182 | |||
183 | m_log.InfoFormat("[HGLOGIN] HGVerifyKey called with key ", authKey); | ||
184 | |||
185 | if (!(m_userManager is IAuthentication)) | ||
186 | { | ||
187 | m_log.Debug("[HGLOGIN]: UserManager is not IAuthentication service. Denying."); | ||
188 | } | ||
189 | else | ||
190 | { | ||
191 | success = ((IAuthentication)m_userManager).VerifyKey(userID, authKey); | ||
192 | } | ||
193 | } | ||
188 | } | 194 | } |
189 | 195 | ||
190 | XmlRpcResponse response = new XmlRpcResponse(); | 196 | XmlRpcResponse response = new XmlRpcResponse(); |