Unable to subscribe to API after subscribing one API from non-super tenant to super tenant with cross tenant subscription enabled
Steps to Reproduce
Enable enable_cross_tenant_subscriptions [1] and Create a new tenant.
Note: All the APIs are created in carbon.super and enable visibility only for particular API which is used to subscribe below.
Created a user in new tenant (I created using UI)
Register DCR Client using new user (REST API)
Get Access Token (REST API)
List Applications (REST API)
List API's - Success (REST API)
Add Subscription (REST API) to an API
Add subscription (RESt API) to another API
You’ll get below response and errors.
Response
{
"code": 404,
"message": "Not Found",
"description": "Requested API with Id 'e9c99d42-fadd-48ca-916c-4512265614d2' not found",
"moreInfo": "",
"error": []
}
Error
[2024-05-24 12:48:06,387] ERROR - SubscriptionsApiServiceImpl Requested API with Id 'e9c99d42-fadd-48ca-916c-4512265614d2' not found
org.wso2.carbon.apimgt.api.APIManagementException: Failed to retrieve the API e9c99d42-fadd-48ca-916c-4512265614d2 to check user test1@test.com has access to the API
at org.wso2.carbon.apimgt.rest.api.util.utils.RestAPIStoreUtils.isUserAccessAllowedForAPIByUUID(RestAPIStoreUtils.java:195) ~[org.wso2.carbon.apimgt.rest.api.util_6.7.206.403.jar:?]
at org.wso2.carbon.apimgt.rest.api.store.v1.impl.SubscriptionsApiServiceImpl.subscriptionsPost(SubscriptionsApiServiceImpl.java:194) [classes/:?]
at org.wso2.carbon.apimgt.rest.api.store.v1.SubscriptionsApi.subscriptionsPost(SubscriptionsApi.java:95) [classes/:?]
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?]
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?]
at org.apache.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractInvoker.java:179) [cxf-core-3.5.5.jar:3.5.5]
at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:96) [cxf-core-3.5.5.jar:3.5.5]
at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:201) [cxf-rt-frontend-jaxrs-3.5.5.jar:3.5.5]
at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:104) [cxf-rt-frontend-jaxrs-3.5.5.jar:3.5.5]
at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:59) [cxf-core-3.5.5.jar:3.5.5]
at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:96) [cxf-core-3.5.5.jar:3.5.5]
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:307) [cxf-core-3.5.5.jar:3.5.5]
at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121) [cxf-core-3.5.5.jar:3.5.5]
at org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:265) [cxf-rt-transports-http-3.5.5.jar:3.5.5]
at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:234) [cxf-rt-transports-http-3.5.5.jar:3.5.5]
at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:208) [cxf-rt-transports-http-3.5.5.jar:3.5.5]
at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:160) [cxf-rt-transports-http-3.5.5.jar:3.5.5]
at org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:225) [cxf-rt-transports-http-3.5.5.jar:3.5.5]
at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:304) [cxf-rt-transports-http-3.5.5.jar:3.5.5]
at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:217) [cxf-rt-transports-http-3.5.5.jar:3.5.5]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:555) [tomcat-servlet-api_9.0.82.wso2v1.jar:?]
at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:279) [cxf-rt-transports-http-3.5.5.jar:3.5.5]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:209) [tomcat_9.0.82.wso2v1.jar:?]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:153) [tomcat_9.0.82.wso2v1.jar:?]
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51) [tomcat_9.0.82.wso2v1.jar:?]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:178) [tomcat_9.0.82.wso2v1.jar:?]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:153) [tomcat_9.0.82.wso2v1.jar:?]
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:168) [tomcat_9.0.82.wso2v1.jar:?]
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:90) [tomcat_9.0.82.wso2v1.jar:?]
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:481) [tomcat_9.0.82.wso2v1.jar:?]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:130) [tomcat_9.0.82.wso2v1.jar:?]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:93) [tomcat_9.0.82.wso2v1.jar:?]
at org.wso2.carbon.identity.context.rewrite.valve.TenantContextRewriteValve.invoke(TenantContextRewriteValve.java:86) [org.wso2.carbon.identity.context.rewrite.valve_1.4.0.jar:?]
at org.wso2.carbon.identity.authz.valve.AuthorizationValve.invoke(AuthorizationValve.java:120) [org.wso2.carbon.identity.authz.valve_1.4.0.16.jar:?]
at org.wso2.carbon.identity.auth.valve.AuthenticationValve.invoke(AuthenticationValve.java:111) [org.wso2.carbon.identity.auth.valve_1.4.0.15.jar:?]
at org.wso2.carbon.tomcat.ext.valves.CompositeValve.continueInvocation(CompositeValve.java:106) [org.wso2.carbon.tomcat.ext_4.6.0.127.jar:?]
at org.wso2.carbon.tomcat.ext.valves.TomcatValveContainer.invokeValves(TomcatValveContainer.java:49) [org.wso2.carbon.tomcat.ext_4.6.0.127.jar:?]
at org.wso2.carbon.tomcat.ext.valves.CompositeValve.invoke(CompositeValve.java:69) [org.wso2.carbon.tomcat.ext_4.6.0.127.jar:?]
at org.wso2.carbon.tomcat.ext.valves.CarbonStuckThreadDetectionValve.invoke(CarbonStuckThreadDetectionValve.java:145) [org.wso2.carbon.tomcat.ext_4.6.0.127.jar:?]
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:670) [tomcat_9.0.82.wso2v1.jar:?]
at org.wso2.carbon.tomcat.ext.valves.CarbonContextCreatorValve.invoke(CarbonContextCreatorValve.java:59) [org.wso2.carbon.tomcat.ext_4.6.0.127.jar:?]
at org.wso2.carbon.tomcat.ext.valves.RequestCorrelationIdValve.invoke(RequestCorrelationIdValve.java:124) [org.wso2.carbon.tomcat.ext_4.6.0.127.jar:?]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74) [tomcat_9.0.82.wso2v1.jar:?]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342) [tomcat_9.0.82.wso2v1.jar:?]
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:390) [tomcat_9.0.82.wso2v1.jar:?]
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:63) [tomcat_9.0.82.wso2v1.jar:?]
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:928) [tomcat_9.0.82.wso2v1.jar:?]
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1794) [tomcat_9.0.82.wso2v1.jar:?]
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:52) [tomcat_9.0.82.wso2v1.jar:?]
at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191) [tomcat_9.0.82.wso2v1.jar:?]
at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659) [tomcat_9.0.82.wso2v1.jar:?]
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat_9.0.82.wso2v1.jar:?]
at java.lang.Thread.run(Thread.java:829) [?:?]
Caused by: org.wso2.carbon.apimgt.api.APIMgtResourceNotFoundException: Failed to get API. API artifact corresponding to artifactId e9c99d42-fadd-48ca-916c-4512265614d2 does not exist
at org.wso2.carbon.apimgt.impl.AbstractAPIManager.getLightweightAPIByUUID_aroundBody26(AbstractAPIManager.java:663) ~[org.wso2.carbon.apimgt.impl_6.7.206.502.jar:?]
at org.wso2.carbon.apimgt.impl.AbstractAPIManager.getLightweightAPIByUUID(AbstractAPIManager.java:638) ~[org.wso2.carbon.apimgt.impl_6.7.206.502.jar:?]
at org.wso2.carbon.apimgt.rest.api.util.utils.RestAPIStoreUtils.isUserAccessAllowedForAPIByUUID(RestAPIStoreUtils.java:184) ~[org.wso2.carbon.apimgt.rest.api.util_6.7.206.403.jar:?]
... 54 more
Description
Unable to subscribe to API after subscribing one API from non-super tenant to super tenant with cross tenant subscription enabled
Steps to Reproduce
Enable enable_cross_tenant_subscriptions [1] and Create a new tenant. Note: All the APIs are created in carbon.super and enable visibility only for particular API which is used to subscribe below.
Created a user in new tenant (I created using UI) Register DCR Client using new user (REST API) Get Access Token (REST API) List Applications (REST API) List API's - Success (REST API) Add Subscription (REST API) to an API Add subscription (RESt API) to another API You’ll get below response and errors.
Response
Error
Affected Component
APIM
Version
3.2.0
Environment Details (with versions)
No response
Relevant Log Output
No response
Related Issues
No response
Suggested Labels
No response