Hi,

$subject occurred due to the incompatibility of the authorization
provided to resources and its corresponding resource content URL.

For instance, a tenant admin's workspace is under
https://governance.cloud-test.wso2.com:9445/t/domian/registry/..
When a tenant admin logs in,though a correct authorization is  granted
to the resource, the resource content URL is set as
https://governance.cloud-test.wso2.com:9445/registry....
which is the super tenant workspace.

The fix is as follows, which uses baseURI when creating the resource
content URL instead of abdera IRI.

This works fine for this particular scenario. Also I don't think we
need the (srcIri != null)  check also.
We can instead use baseURI which is not gonna null.

Senaka, can you verify whether this is correct ?


Index: src/main/java/org/wso2/carbon/registry/app/RemoteRegistry.java
===================================================================
--- src/main/java/org/wso2/carbon/registry/app/RemoteRegistry.java      
(revision
121949)
+++ src/main/java/org/wso2/carbon/registry/app/RemoteRegistry.java      (working
copy)
@@ -398,7 +398,7 @@
         if (srcIri != null) {
             try {
                 final URL url = new URL(Utils.encodeRegistryPath(
-                        URLDecoder.decode(srcIri.toString(), "utf-8")) +
+                        URLDecoder.decode(baseURI, "utf-8")) +
                         ((resource.getPermanentPath() != null) ?
                                 RegistryConstants.URL_SEPARATOR +
"version:" + snapshotID : ""));
                 resource.setContentURL(url);
@@ -407,7 +407,7 @@
                 }
                 return resource;
             } catch (IOException e) {
-                throw new RegistryException("unable to receive
source. " + srcIri.toString());
+                throw new RegistryException("unable to receive
source. " + baseURI);
             }
         }







--

Subash Chaturanga
Software Engineer
WSO2 Inc. http://wso2.com

email - [email protected]
phone - 077 2225922
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to