Java Code Examples for org.wso2.carbon.utils.multitenancy.MultitenantConstants#TENANT_AWARE_URL_PREFIX
The following examples show how to use
org.wso2.carbon.utils.multitenancy.MultitenantConstants#TENANT_AWARE_URL_PREFIX .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AbstractFileUploadExecutor.java From attic-stratos with Apache License 2.0 | 6 votes |
protected String getContextRoot(HttpServletRequest request) { String contextPath = (request.getContextPath().equals("")) ? "" : request.getContextPath(); int index; if (contextPath.equals("/fileupload")) { contextPath = ""; } else { if ((index = contextPath.indexOf("/fileupload")) > -1) { contextPath = contextPath.substring(0, index); } } // Make the context root tenant aware, eg: /t/wso2.com in a multi-tenant scenario String tenantDomain = (String)request.getSession().getAttribute(MultitenantConstants.TENANT_DOMAIN); if(!contextPath.startsWith("/" + MultitenantConstants.TENANT_AWARE_URL_PREFIX + "/") && (tenantDomain != null && !MultitenantConstants.SUPER_TENANT_DOMAIN_NAME.equals(tenantDomain)) ){ contextPath = contextPath + "/" + MultitenantConstants.TENANT_AWARE_URL_PREFIX + "/" + tenantDomain; // replace the possible '//' with '/ ' contextPath = contextPath.replaceAll("//", "/"); } return contextPath; }
Example 2
Source File: IdPManagementUtil.java From carbon-identity-framework with Apache License 2.0 | 5 votes |
/** * Set tenantContext and tenantParameter specific to the tenant domain. * * @param tenantDomain of requested resident IdP */ public static void setTenantSpecifiers(String tenantDomain) { if (!MultitenantConstants.SUPER_TENANT_DOMAIN_NAME.equalsIgnoreCase(tenantDomain)) { tenantContext = MultitenantConstants.TENANT_AWARE_URL_PREFIX + "/" + tenantDomain + "/"; tenantParameter = "?" + MultitenantConstants.TENANT_DOMAIN + "=" + tenantDomain; } else { tenantContext = ""; tenantParameter = ""; } }
Example 3
Source File: CarbonUILoginUtil.java From attic-stratos with Apache License 2.0 | 4 votes |
/** * * @param requestedURI * @param request * @param response * @param authenticated * @param context * @param indexPageURL * @return * @throws IOException */ protected static int handleLoginPageRequest(String requestedURI, HttpServletRequest request, HttpServletResponse response, boolean authenticated, String context, String indexPageURL) throws IOException { if (requestedURI.indexOf("login.jsp") > -1 || requestedURI.indexOf("login_ajaxprocessor.jsp") > -1 || requestedURI.indexOf("admin/layout/template.jsp") > -1 || requestedURI.endsWith("/filedownload") || requestedURI.endsWith("/fileupload") || requestedURI.indexOf("/fileupload/") > -1 || requestedURI.indexOf("login_action.jsp") > -1 || requestedURI.indexOf("admin/jsp/WSRequestXSSproxy_ajaxprocessor.jsp") > -1) { if ((requestedURI.indexOf("login.jsp") > -1 || requestedURI.indexOf("login_ajaxprocessor.jsp") > -1 || requestedURI .indexOf("login_action.jsp") > -1) && authenticated) { // User has typed the login page url, while being logged in if (request.getSession().getAttribute(MultitenantConstants.TENANT_DOMAIN) != null) { String tenantDomain = (String) request.getSession().getAttribute( MultitenantConstants.TENANT_DOMAIN); if (tenantDomain != null && !MultitenantConstants.SUPER_TENANT_DOMAIN_NAME.equals(tenantDomain)) { context += "/" + MultitenantConstants.TENANT_AWARE_URL_PREFIX + "/" + tenantDomain; } } if(log.isDebugEnabled()){ log.debug("User already authenticated. Redirecting to " + indexPageURL); } // redirect relative to the servlet container root response.sendRedirect(context + "/carbon/admin/index.jsp"); return RETURN_FALSE; } else if (requestedURI.indexOf("login_action.jsp") > -1 && !authenticated) { // User is not yet authenticated and now trying to get authenticated // do nothing, leave for authentication at the end if (log.isDebugEnabled()) { log.debug("User is not yet authenticated and now trying to get authenticated;" + "do nothing, leave for authentication at the end"); } return CONTINUE; } else { if (log.isDebugEnabled()) { log.debug("Skipping security checks for " + requestedURI); } return RETURN_TRUE; } } return CONTINUE; }