@@ -0,0 +1,2119 @@
+/*%0A * Copyright (c) 2020, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.%0A *%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A * http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0A%0Apackage org.wso2.carbon.identity.core.filter;%0A%0Aimport org.wso2.carbon.context.PrivilegedCarbonContext;%0A%0Aimport java.io.IOException;%0A%0Aimport javax.servlet.Filter;%0Aimport javax.servlet.FilterChain;%0Aimport javax.servlet.FilterConfig;%0Aimport javax.servlet.ServletException;%0Aimport javax.servlet.ServletRequest;%0Aimport javax.servlet.ServletResponse;%0A%0Aimport static org.wso2.carbon.utils.multitenancy.MultitenantConstants.SUPER_TENANT_ID;%0A%0A/**%0A * Once registered to a web app, this servlet filter will initiate a super tenant flow when accessing the web app.%0A *%0A * Used to pass the session validation when accessing super tenant web app jsp files through a tenant's context%0A * eg: /t/%7Btenant-domain%7D/.%0A */%0Apublic class SuperTenantFlowInitializer implements Filter %7B%0A%0A    @Override%0A    public void init(FilterConfig filterConfig) throws ServletException %7B%0A%0A        // Nothing to implement%0A    %7D%0A%0A    @Override%0A    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain)%0A            throws IOException, ServletException %7B%0A%0A        try %7B%0A            PrivilegedCarbonContext.startTenantFlow();%0A            PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantId(SUPER_TENANT_ID, true);%0A%0A            filterChain.doFilter(servletRequest, servletResponse);%0A        %7D finally %7B%0A            PrivilegedCarbonContext.endTenantFlow();%0A        %7D%0A    %7D%0A%0A    @Override%0A    public void destroy() %7B%0A%0A        // Nothing to implement%0A    %7D%0A%7D%0A

Add SuperTenantFlowInitializer filter