You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by la...@apache.org on 2013/07/11 14:16:17 UTC
[2/3] git commit: applying 0001-Refactor-redirector-module.patch
applying 0001-Refactor-redirector-module.patch
Project: http://git-wip-us.apache.org/repos/asf/incubator-stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-stratos/commit/888ca4d5
Tree: http://git-wip-us.apache.org/repos/asf/incubator-stratos/tree/888ca4d5
Diff: http://git-wip-us.apache.org/repos/asf/incubator-stratos/diff/888ca4d5
Branch: refs/heads/master
Commit: 888ca4d53165be938f60bb4c276e3e220e89d2f3
Parents: fcb90b1
Author: Lakmal Warusawithana <la...@wso2.com>
Authored: Thu Jul 11 17:45:12 2013 +0530
Committer: Lakmal Warusawithana <la...@wso2.com>
Committed: Thu Jul 11 17:45:12 2013 +0530
----------------------------------------------------------------------
.../pom.xml | 110 ++++++++++++
.../clients/RedirectorServletServiceClient.java | 90 ++++++++++
.../servlet/ui/filters/AllPagesFilter.java | 167 +++++++++++++++++
.../internal/RedirectorServletUIComponent.java | 45 +++++
.../redirector/servlet/ui/util/Util.java | 67 +++++++
.../resources/RedirectorServletService.wsdl | 102 +++++++++++
.../pom.xml | 101 +++++++++++
.../RedirectorServletServiceComponent.java | 80 +++++++++
.../services/RedirectorServletService.java | 37 ++++
.../stratos/redirector/servlet/util/Util.java | 73 ++++++++
.../src/main/resources/META-INF/services.xml | 30 ++++
.../pom.xml | 87 +++++++++
.../ui/internal/RedirectorJSPFilter.java | 60 +++++++
.../internal/SSORedirectorServiceComponent.java | 66 +++++++
.../sso/redirector/ui/i18n/Resources.properties | 32 ++++
.../web/stratos-auth/css/stratos-loginpage.css | 94 ++++++++++
.../images/cloud-identity-sso-config-ok.png | Bin 0 -> 38465 bytes
.../images/cloud-identity-sso-config.png | Bin 0 -> 32929 bytes
.../stratos-auth/images/cloud-sso-config.png | Bin 0 -> 29222 bytes
.../web/stratos-auth/images/delete.gif | Bin 0 -> 555 bytes
.../web/stratos-auth/images/import.gif | Bin 0 -> 1051 bytes
.../web/stratos-auth/images/loading.gif | Bin 0 -> 14367 bytes
.../resources/web/stratos-auth/images/logo.gif | Bin 0 -> 17603 bytes
.../web/stratos-auth/images/policy.gif | Bin 0 -> 1017 bytes
.../web/stratos-auth/images/powered.gif | Bin 0 -> 1773 bytes
.../web/stratos-auth/images/register.gif | Bin 0 -> 4099 bytes
.../resources/web/stratos-auth/images/sso.gif | Bin 0 -> 394 bytes
.../stratos-auth/images/st-login-body-bg.gif | Bin 0 -> 2215 bytes
.../stratos-auth/images/st-login-content-bg.gif | Bin 0 -> 1060 bytes
.../stratos-auth/images/st-login-footer-bg.gif | Bin 0 -> 749 bytes
.../stratos-auth/images/st-login-header-bg.gif | Bin 0 -> 64503 bytes
.../web/stratos-auth/redirect_ajaxprocessor.jsp | 177 +++++++++++++++++++
.../2.1.0/pom.xml | 105 -----------
.../clients/RedirectorServletServiceClient.java | 90 ----------
.../servlet/ui/filters/AllPagesFilter.java | 164 -----------------
.../internal/RedirectorServletUIComponent.java | 44 -----
.../carbon/redirector/servlet/ui/util/Util.java | 64 -------
.../resources/RedirectorServletService.wsdl | 102 -----------
.../2.1.0/pom.xml | 97 ----------
.../RedirectorServletServiceComponent.java | 80 ---------
.../services/RedirectorServletService.java | 37 ----
.../carbon/redirector/servlet/util/Util.java | 84 ---------
.../src/main/resources/META-INF/services.xml | 28 ---
.../2.1.0/pom.xml | 85 ---------
.../ui/internal/RedirectorJSPFilter.java | 59 -------
.../internal/SSORedirectorServiceComponent.java | 65 -------
.../sso/redirector/ui/i18n/Resources.properties | 32 ----
.../web/stratos-auth/css/stratos-loginpage.css | 94 ----------
.../images/cloud-identity-sso-config-ok.png | Bin 38465 -> 0 bytes
.../images/cloud-identity-sso-config.png | Bin 32929 -> 0 bytes
.../stratos-auth/images/cloud-sso-config.png | Bin 29222 -> 0 bytes
.../web/stratos-auth/images/delete.gif | Bin 555 -> 0 bytes
.../web/stratos-auth/images/import.gif | Bin 1051 -> 0 bytes
.../web/stratos-auth/images/loading.gif | Bin 14367 -> 0 bytes
.../resources/web/stratos-auth/images/logo.gif | Bin 17603 -> 0 bytes
.../web/stratos-auth/images/policy.gif | Bin 1017 -> 0 bytes
.../web/stratos-auth/images/powered.gif | Bin 1773 -> 0 bytes
.../web/stratos-auth/images/register.gif | Bin 4099 -> 0 bytes
.../resources/web/stratos-auth/images/sso.gif | Bin 394 -> 0 bytes
.../stratos-auth/images/st-login-body-bg.gif | Bin 2215 -> 0 bytes
.../stratos-auth/images/st-login-content-bg.gif | Bin 1060 -> 0 bytes
.../stratos-auth/images/st-login-footer-bg.gif | Bin 749 -> 0 bytes
.../stratos-auth/images/st-login-header-bg.gif | Bin 64503 -> 0 bytes
.../web/stratos-auth/redirect_ajaxprocessor.jsp | 176 ------------------
components/stratos/redirector/pom.xml | 42 -----
65 files changed, 1418 insertions(+), 1448 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/888ca4d5/components/org.apache.stratos.redirector.servlet.ui/pom.xml
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.redirector.servlet.ui/pom.xml b/components/org.apache.stratos.redirector.servlet.ui/pom.xml
new file mode 100644
index 0000000..aacddac
--- /dev/null
+++ b/components/org.apache.stratos.redirector.servlet.ui/pom.xml
@@ -0,0 +1,110 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ # Licensed to the Apache Software Foundation (ASF) under one
+ # or more contributor license agreements. See the NOTICE file
+ # distributed with this work for additional information
+ # regarding copyright ownership. The ASF licenses this file
+ # to you under the Apache License, Version 2.0 (the
+ # "License"); you may not use this file except in compliance
+ # with the License. You may obtain a copy of the License at
+ #
+ # http://www.apache.org/licenses/LICENSE-2.0
+ #
+ # Unless required by applicable law or agreed to in writing,
+ # software distributed under the License is distributed on an
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ # KIND, either express or implied. See the License for the
+ # specific language governing permissions and limitations
+ # under the License.
+ -->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <groupId>org.apache.stratos</groupId>
+ <artifactId>stratos-components-parent</artifactId>
+ <version>3.0.0-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>org.apache.stratos.redirector.servlet.ui</artifactId>
+ <packaging>bundle</packaging>
+ <name>Apache Stratos - Tenant Specific URL redirector UI component</name>
+
+ <build>
+
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-scr-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+
+ <extensions>true</extensions>
+ <configuration>
+ <instructions>
+ <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
+ <Bundle-Name>${project.artifactId}</Bundle-Name>
+ <Private-Package>
+ org.apache.stratos.redirector.servlet.ui.*,
+ org.apache.stratos.redirector.servlet.ui.internal.*,
+ org.apache.stratos.redirector.servlet.ui.clients.*,
+ org.apache.stratos.redirector.servlet.ui.util.*,
+ </Private-Package>
+ <Import-Package>
+ org.apache.stratos.redirector.servlet.stub.*; version="${carbon.platform.package.import.version.range}",
+ javax.servlet;version="${imp.pkg.version.javax.servlet}",
+ javax.servlet.http;version="${imp.pkg.version.javax.servlet}",
+ org.apache.lucene.*,
+ *;resolution:=optional
+ </Import-Package>
+ <DynamicImport-Package>*</DynamicImport-Package>
+ </instructions>
+ </configuration>
+ </plugin>
+
+ </plugins>
+ </build>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.eclipse.equinox</groupId>
+ <artifactId>javax.servlet</artifactId>
+ <version>3.0.0.v201112011016</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.axis2.wso2</groupId>
+ <artifactId>axis2</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.ws.commons.axiom.wso2</groupId>
+ <artifactId>axiom</artifactId>
+ <version>1.2.11.wso2v4</version>
+ </dependency>
+ <dependency>
+ <groupId>org.wso2.carbon</groupId>
+ <artifactId>org.wso2.carbon.ui</artifactId>
+ <version>${carbon.platform.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.stratos</groupId>
+ <artifactId>org.apache.stratos.common</artifactId>
+ <version>${apache.stratos.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.wso2.carbon</groupId>
+ <artifactId>org.wso2.carbon.redirector.servlet.stub</artifactId>
+ <version>${carbon.platform.version}</version>
+ </dependency>
+
+ </dependencies>
+
+</project>
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/888ca4d5/components/org.apache.stratos.redirector.servlet.ui/src/main/java/org/apache/stratos/redirector/servlet/ui/clients/RedirectorServletServiceClient.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.redirector.servlet.ui/src/main/java/org/apache/stratos/redirector/servlet/ui/clients/RedirectorServletServiceClient.java b/components/org.apache.stratos.redirector.servlet.ui/src/main/java/org/apache/stratos/redirector/servlet/ui/clients/RedirectorServletServiceClient.java
new file mode 100644
index 0000000..a3ae54b
--- /dev/null
+++ b/components/org.apache.stratos.redirector.servlet.ui/src/main/java/org/apache/stratos/redirector/servlet/ui/clients/RedirectorServletServiceClient.java
@@ -0,0 +1,90 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.stratos.redirector.servlet.ui.clients;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.client.Options;
+import org.apache.axis2.client.ServiceClient;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.wso2.carbon.CarbonConstants;
+import org.wso2.carbon.redirector.servlet.stub.RedirectorServletServiceStub;
+import org.wso2.carbon.registry.core.exceptions.RegistryException;
+import org.wso2.carbon.ui.CarbonUIUtil;
+import org.wso2.carbon.utils.ServerConstants;
+
+import javax.servlet.ServletContext;
+import javax.servlet.http.HttpSession;
+
+public class RedirectorServletServiceClient {
+ private static final Log log = LogFactory.getLog(RedirectorServletServiceClient.class);
+
+ private RedirectorServletServiceStub stub;
+ private String epr;
+
+ public RedirectorServletServiceClient(
+ String cookie, String backendServerURL, ConfigurationContext configContext)
+ throws RegistryException {
+
+ epr = backendServerURL + "RedirectorServletService";
+
+ try {
+ stub = new RedirectorServletServiceStub(configContext, epr);
+
+ ServiceClient client = stub._getServiceClient();
+ Options option = client.getOptions();
+ option.setManageSession(true);
+ option.setProperty(org.apache.axis2.transport.http.HTTPConstants.COOKIE_STRING, cookie);
+
+ } catch (AxisFault axisFault) {
+ String msg = "Failed to initiate AddServices service client. " + axisFault.getMessage();
+ log.error(msg, axisFault);
+ throw new RegistryException(msg, axisFault);
+ }
+ }
+
+ public RedirectorServletServiceClient(ServletContext context, HttpSession session)
+ throws RegistryException {
+
+ String cookie = (String)session.getAttribute(ServerConstants.ADMIN_SERVICE_COOKIE);
+ String backendServerURL = CarbonUIUtil.getServerURL(context, session);
+ ConfigurationContext configContext = (ConfigurationContext) context.
+ getAttribute(CarbonConstants.CONFIGURATION_CONTEXT);
+ epr = backendServerURL + "RedirectorServletService";
+
+ try {
+ stub = new RedirectorServletServiceStub(configContext, epr);
+
+ ServiceClient client = stub._getServiceClient();
+ Options option = client.getOptions();
+ option.setManageSession(true);
+ option.setProperty(org.apache.axis2.transport.http.HTTPConstants.COOKIE_STRING, cookie);
+
+ } catch (AxisFault axisFault) {
+ String msg = "Failed to initiate Add Services service client. " + axisFault.getMessage();
+ log.error(msg, axisFault);
+ throw new RegistryException(msg, axisFault);
+ }
+ }
+
+ public String validateTenant(String tenantDomain) throws Exception {
+ return stub.validateTenant(tenantDomain);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/888ca4d5/components/org.apache.stratos.redirector.servlet.ui/src/main/java/org/apache/stratos/redirector/servlet/ui/filters/AllPagesFilter.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.redirector.servlet.ui/src/main/java/org/apache/stratos/redirector/servlet/ui/filters/AllPagesFilter.java b/components/org.apache.stratos.redirector.servlet.ui/src/main/java/org/apache/stratos/redirector/servlet/ui/filters/AllPagesFilter.java
new file mode 100644
index 0000000..4d64d7a
--- /dev/null
+++ b/components/org.apache.stratos.redirector.servlet.ui/src/main/java/org/apache/stratos/redirector/servlet/ui/filters/AllPagesFilter.java
@@ -0,0 +1,167 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.stratos.redirector.servlet.ui.filters;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.wso2.carbon.utils.multitenancy.MultitenantConstants;
+import org.apache.stratos.common.constants.StratosConstants;
+import org.apache.stratos.redirector.servlet.ui.clients.RedirectorServletServiceClient;
+
+import javax.servlet.*;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.StringTokenizer;
+
+public class AllPagesFilter implements Filter {
+ private static final Log log = LogFactory.getLog(AllPagesFilter.class);
+ private static Map<String, Boolean> tenantExistMap = new HashMap<String, Boolean>();
+
+ ServletContext context;
+
+ public void init(FilterConfig filterConfig) throws ServletException {
+ context = filterConfig.getServletContext();
+ }
+
+ public void doFilter(ServletRequest servletRequest,
+ ServletResponse servletResponse, FilterChain filterChain) throws
+ IOException, ServletException {
+ if (!(servletRequest instanceof HttpServletRequest)) {
+ // no filtering
+ return;
+ }
+ HttpServletRequest request = (HttpServletRequest) servletRequest;
+ String requestedURI = request.getRequestURI();
+
+ String contextPath = request.getContextPath();
+ if (contextPath == null || ("/").equals(contextPath)) {
+ contextPath = "";
+ }
+
+ StringTokenizer tokenizer = new StringTokenizer(requestedURI.substring(contextPath.length() + 1), "/");
+ String[] firstUriTokens = new String[2];
+ int i = 0;
+ while (tokenizer.hasMoreElements()) {
+ firstUriTokens[i] = tokenizer.nextToken();
+ i++;
+ if (i > 1) {
+ break;
+ }
+ }
+ if (i > 1 && firstUriTokens[0].equals("t")) {
+ if (requestedURI.startsWith("//")) {
+ requestedURI = requestedURI.replaceFirst("//", "/");
+ }
+ String path = requestedURI.substring(contextPath.length() + firstUriTokens[0].length() +
+ firstUriTokens[1].length() + 2);
+
+ // need to validate the tenant exists
+ String tenantDomain = firstUriTokens[1];
+ boolean tenantExists = true;
+ boolean tenantActive = true;
+
+ if (tenantExistMap.get(tenantDomain) == null) {
+ // we have to call the service :(
+ RedirectorServletServiceClient client;
+ try {
+ client = new RedirectorServletServiceClient(context, request.getSession());
+ } catch (Exception e) {
+ String msg = "Error in constructing RedirectorServletServiceClient.";
+ log.error(msg, e);
+ throw new ServletException(msg, e);
+ }
+
+ try {
+ String status = client.validateTenant(tenantDomain);
+ tenantExists = !StratosConstants.INVALID_TENANT.equals(status);
+ if (tenantExists && StratosConstants.ACTIVE_TENANT.equals(status)) {
+ //tenantExists = true;
+ tenantActive = true;
+ }
+ } catch (Exception e) {
+ String msg = "Error in checking the existing of the tenant domain: " +
+ tenantDomain + ".";
+ log.error(msg, e);
+ throw new ServletException(msg, e);
+ }
+ }
+ // we have some backup stuff, if the tenant doesn't exists
+ if (tenantExists) {
+ if (tenantActive) {
+ // we put this to hash only if the original tenant domain exist
+ tenantExistMap.put(tenantDomain, true);
+ } else {
+ String errorPage = contextPath +
+ "/carbon/admin/error.jsp?The Requested tenant domain: " +
+ tenantDomain + " is inactive.";
+ RequestDispatcher requestDispatcher =
+ request.getRequestDispatcher(errorPage);
+ requestDispatcher.forward(request, servletResponse);
+ return;
+ }
+ } else {
+ String errorPage = contextPath +
+ "/carbon/admin/error.jsp?The Requested tenant domain: " +
+ tenantDomain + " doesn't exist.";
+ RequestDispatcher requestDispatcher =
+ request.getRequestDispatcher(errorPage);
+ requestDispatcher.forward(request, servletResponse);
+ return;
+ }
+ request.setAttribute(MultitenantConstants.TENANT_DOMAIN, tenantDomain);
+// if (path.indexOf("admin/login.jsp") >= 0) {
+// // we are going to apply the login.jsp filter + tenant specif filter both in here
+// path = path.replaceAll("admin/login.jsp",
+// "tenant-login/login_ajaxprocessor.jsp");
+// request.setAttribute(StratosConstants.TENANT_SPECIFIC_URL_RESOLVED, "1");
+// }
+ if (path.indexOf("/admin/index.jsp") >= 0) {
+ // we are going to apply the login.jsp filter + tenant specif filter both in here
+ path = path.replaceAll("/admin/index.jsp", "/tenant-dashboard/index.jsp");
+ request.setAttribute(StratosConstants.TENANT_SPECIFIC_URL_RESOLVED, "1");
+ }
+ if (path.indexOf("admin/docs/userguide.html") >= 0) {
+ // we are going to apply the dasbhoard docs.jsp filter +
+ // tenant specif filter both in here
+ path = path.replaceAll("admin/docs/userguide.html",
+ "tenant-dashboard/docs/userguide.html");
+ request.setAttribute(StratosConstants.TENANT_SPECIFIC_URL_RESOLVED, "1");
+ }
+ if ("".equals(path) || "/".equals(path) || "/carbon".equals(path) ||
+ "/carbon/".equals(path) || "/carbon/admin".equals(path) ||
+ "/carbon/admin/".equals(path)) {
+ // we have to redirect the root to the login page directly
+ path = contextPath + "/carbon/admin/login.jsp";
+ ((HttpServletResponse) servletResponse).sendRedirect(path);
+ return;
+ }
+ RequestDispatcher requestDispatcher =
+ request.getRequestDispatcher(path);
+ requestDispatcher.forward(request, servletResponse);
+ return;
+ }
+ }
+
+ public void destroy() {
+ // nothing to destroy
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/888ca4d5/components/org.apache.stratos.redirector.servlet.ui/src/main/java/org/apache/stratos/redirector/servlet/ui/internal/RedirectorServletUIComponent.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.redirector.servlet.ui/src/main/java/org/apache/stratos/redirector/servlet/ui/internal/RedirectorServletUIComponent.java b/components/org.apache.stratos.redirector.servlet.ui/src/main/java/org/apache/stratos/redirector/servlet/ui/internal/RedirectorServletUIComponent.java
new file mode 100644
index 0000000..c917923
--- /dev/null
+++ b/components/org.apache.stratos.redirector.servlet.ui/src/main/java/org/apache/stratos/redirector/servlet/ui/internal/RedirectorServletUIComponent.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.stratos.redirector.servlet.ui.internal;
+
+import org.apache.stratos.redirector.servlet.ui.util.Util;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.osgi.service.component.ComponentContext;
+
+/**
+ * @scr.component name="org.apache.stratosredirector.servlet.ui"
+ * immediate="true"
+ */
+public class RedirectorServletUIComponent {
+ private static Log log = LogFactory.getLog(RedirectorServletUIComponent.class);
+
+ protected void activate(ComponentContext context) {
+ try {
+ Util.domainRegisterServlet(context.getBundleContext());
+ log.debug("******* Multitenancy Redirector Servlet UI bundle is activated ******* ");
+ } catch (Exception e) {
+ log.error("******* Multitenancy Redirector Servlet UI bundle failed activating ****", e);
+ }
+ }
+
+ protected void deactivate(ComponentContext context) {
+ log.debug("******* Multitenancy Redirector Servlet UI bundle is deactivated ******* ");
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/888ca4d5/components/org.apache.stratos.redirector.servlet.ui/src/main/java/org/apache/stratos/redirector/servlet/ui/util/Util.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.redirector.servlet.ui/src/main/java/org/apache/stratos/redirector/servlet/ui/util/Util.java b/components/org.apache.stratos.redirector.servlet.ui/src/main/java/org/apache/stratos/redirector/servlet/ui/util/Util.java
new file mode 100644
index 0000000..954f29b
--- /dev/null
+++ b/components/org.apache.stratos.redirector.servlet.ui/src/main/java/org/apache/stratos/redirector/servlet/ui/util/Util.java
@@ -0,0 +1,67 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.stratos.redirector.servlet.ui.util;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceRegistration;
+import org.apache.stratos.redirector.servlet.ui.filters.AllPagesFilter;
+import org.wso2.carbon.utils.CarbonUtils;
+import org.wso2.carbon.utils.multitenancy.MultitenantConstants;
+
+import javax.servlet.Filter;
+import javax.servlet.Servlet;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.util.Dictionary;
+import java.util.Hashtable;
+
+public class Util {
+
+ private static final Log log = LogFactory.getLog(Util.class);
+
+ private static ServiceRegistration redirectorServiceRegistration;
+
+ public static void domainRegisterServlet(BundleContext bundleContext) throws Exception {
+ if (!CarbonUtils.isRemoteRegistry()) {
+ HttpServlet reirectorServlet = new HttpServlet() {
+ // the redirector filter will forward the request before this servlet is hit
+ protected void doGet(HttpServletRequest request, HttpServletResponse response)
+ throws ServletException, IOException {
+ }
+ };
+
+ Filter redirectorFilter = new AllPagesFilter();
+
+ Dictionary redirectorServletAttributes = new Hashtable(2);
+ Dictionary redirectorParams = new Hashtable(2);
+ redirectorParams.put("url-pattern", "/" + MultitenantConstants.TENANT_AWARE_URL_PREFIX);
+ redirectorParams.put("associated-filter", redirectorFilter);
+ redirectorParams.put("servlet-attributes", redirectorServletAttributes);
+
+ redirectorServiceRegistration = bundleContext.registerService(Servlet.class.getName(),
+ reirectorServlet, redirectorParams);
+
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/888ca4d5/components/org.apache.stratos.redirector.servlet.ui/src/main/resources/RedirectorServletService.wsdl
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.redirector.servlet.ui/src/main/resources/RedirectorServletService.wsdl b/components/org.apache.stratos.redirector.servlet.ui/src/main/resources/RedirectorServletService.wsdl
new file mode 100644
index 0000000..374ac3b
--- /dev/null
+++ b/components/org.apache.stratos.redirector.servlet.ui/src/main/resources/RedirectorServletService.wsdl
@@ -0,0 +1,102 @@
+<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:ns1="http://org.apache.axis2/xsd" xmlns:ns="http://services.servlet.redirector.carbon.wso2.org" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" targetNamespace="http://services.servlet.redirector.carbon.wso2.org">
+ <wsdl:documentation>RedirectorServletService</wsdl:documentation>
+ <wsdl:types>
+ <xs:schema attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://services.servlet.redirector.carbon.wso2.org">
+ <xs:element name="validateTenantException">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" name="validateTenantException" nillable="true" type="ns:Exception" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:complexType name="Exception">
+ <xs:sequence>
+ <xs:element minOccurs="0" name="Message" nillable="true" type="xs:string" />
+ </xs:sequence>
+ </xs:complexType>
+ <xs:element name="validateTenant">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" name="tenantDomain" nillable="true" type="xs:string" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="validateTenantResponse">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" name="return" nillable="true" type="xs:string" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ </xs:schema>
+ </wsdl:types>
+ <wsdl:message name="validateTenantRequest">
+ <wsdl:part name="parameters" element="ns:validateTenant" />
+ </wsdl:message>
+ <wsdl:message name="validateTenantResponse">
+ <wsdl:part name="parameters" element="ns:validateTenantResponse" />
+ </wsdl:message>
+ <wsdl:message name="validateTenantException">
+ <wsdl:part name="parameters" element="ns:validateTenantException" />
+ </wsdl:message>
+ <wsdl:portType name="RedirectorServletServicePortType">
+ <wsdl:operation name="validateTenant">
+ <wsdl:input message="ns:validateTenantRequest" wsaw:Action="urn:validateTenant" />
+ <wsdl:output message="ns:validateTenantResponse" wsaw:Action="urn:validateTenantResponse" />
+ <wsdl:fault message="ns:validateTenantException" name="validateTenantException" wsaw:Action="urn:validateTenantvalidateTenantException" />
+ </wsdl:operation>
+ </wsdl:portType>
+ <wsdl:binding name="RedirectorServletServiceSoap11Binding" type="ns:RedirectorServletServicePortType">
+ <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document" />
+ <wsdl:operation name="validateTenant">
+ <soap:operation soapAction="urn:validateTenant" style="document" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ <wsdl:fault name="validateTenantException">
+ <soap:fault use="literal" name="validateTenantException" />
+ </wsdl:fault>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:binding name="RedirectorServletServiceSoap12Binding" type="ns:RedirectorServletServicePortType">
+ <soap12:binding transport="http://schemas.xmlsoap.org/soap/http" style="document" />
+ <wsdl:operation name="validateTenant">
+ <soap12:operation soapAction="urn:validateTenant" style="document" />
+ <wsdl:input>
+ <soap12:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap12:body use="literal" />
+ </wsdl:output>
+ <wsdl:fault name="validateTenantException">
+ <soap12:fault use="literal" name="validateTenantException" />
+ </wsdl:fault>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:binding name="RedirectorServletServiceHttpBinding" type="ns:RedirectorServletServicePortType">
+ <http:binding verb="POST" />
+ <wsdl:operation name="validateTenant">
+ <http:operation location="validateTenant" />
+ <wsdl:input>
+ <mime:content type="text/xml" part="parameters" />
+ </wsdl:input>
+ <wsdl:output>
+ <mime:content type="text/xml" part="parameters" />
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:service name="RedirectorServletService">
+ <wsdl:port name="RedirectorServletServiceHttpsSoap11Endpoint" binding="ns:RedirectorServletServiceSoap11Binding">
+ <soap:address location="https://10.100.0.161:9443/services/RedirectorServletService.RedirectorServletServiceHttpsSoap11Endpoint/" />
+ </wsdl:port>
+ <wsdl:port name="RedirectorServletServiceHttpsSoap12Endpoint" binding="ns:RedirectorServletServiceSoap12Binding">
+ <soap12:address location="https://10.100.0.161:9443/services/RedirectorServletService.RedirectorServletServiceHttpsSoap12Endpoint/" />
+ </wsdl:port>
+ <wsdl:port name="RedirectorServletServiceHttpsEndpoint" binding="ns:RedirectorServletServiceHttpBinding">
+ <http:address location="https://10.100.0.161:9443/services/RedirectorServletService.RedirectorServletServiceHttpsEndpoint/" />
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/888ca4d5/components/org.apache.stratos.redirector.servlet/pom.xml
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.redirector.servlet/pom.xml b/components/org.apache.stratos.redirector.servlet/pom.xml
new file mode 100644
index 0000000..c560810
--- /dev/null
+++ b/components/org.apache.stratos.redirector.servlet/pom.xml
@@ -0,0 +1,101 @@
+<!--
+ # Licensed to the Apache Software Foundation (ASF) under one
+ # or more contributor license agreements. See the NOTICE file
+ # distributed with this work for additional information
+ # regarding copyright ownership. The ASF licenses this file
+ # to you under the Apache License, Version 2.0 (the
+ # "License"); you may not use this file except in compliance
+ # with the License. You may obtain a copy of the License at
+ #
+ # http://www.apache.org/licenses/LICENSE-2.0
+ #
+ # Unless required by applicable law or agreed to in writing,
+ # software distributed under the License is distributed on an
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ # KIND, either express or implied. See the License for the
+ # specific language governing permissions and limitations
+ # under the License.
+ -->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <groupId>org.apache.stratos</groupId>
+ <artifactId>stratos-components-parent</artifactId>
+ <version>3.0.0-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>org.apache.straos.redirector.servlet</artifactId>
+ <packaging>bundle</packaging>
+ <name>Apache Stratos - Tenant Specific URL redirector</name>
+
+ <build>
+
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-scr-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+
+ <extensions>true</extensions>
+ <configuration>
+ <instructions>
+ <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
+ <Bundle-Name>${project.artifactId}</Bundle-Name>
+ <Private-Package>
+ org.apache.stratos.redirector.servlet.services.*,
+ org.apache.stratos.redirector.servlet.internal.*,
+ </Private-Package>
+ <Export-Package>
+ org.apache.stratos.redirector.servlet.util.*,
+ </Export-Package>
+ <Import-Package>
+ org.wso2.carbon.registry.core.*;version=1.0.1,
+ !javax.xml.namespace,
+ javax.xml.namespace; version=0.0.0,
+ javax.servlet;version="${imp.pkg.version.javax.servlet}",
+ javax.servlet.http;version="${imp.pkg.version.javax.servlet}",
+ org.apache.axiom.*; version="${axiom.osgi.version.range}",
+ *;resolution:=optional
+ </Import-Package>
+ </instructions>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.axis2.wso2</groupId>
+ <artifactId>axis2</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.wso2.carbon</groupId>
+ <artifactId>org.wso2.carbon.registry.core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.stratos</groupId>
+ <artifactId>org.apache.stratos.common</artifactId>
+ <version>${apache.stratos.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.stratos</groupId>
+ <artifactId>org.apache.stratos.activation</artifactId>
+ <version>${apache.stratos.version}</version>
+ </dependency>
+ </dependencies>
+
+</project>
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/888ca4d5/components/org.apache.stratos.redirector.servlet/src/main/java/org/apache/stratos/redirector/servlet/internal/RedirectorServletServiceComponent.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.redirector.servlet/src/main/java/org/apache/stratos/redirector/servlet/internal/RedirectorServletServiceComponent.java b/components/org.apache.stratos.redirector.servlet/src/main/java/org/apache/stratos/redirector/servlet/internal/RedirectorServletServiceComponent.java
new file mode 100644
index 0000000..22c9a04
--- /dev/null
+++ b/components/org.apache.stratos.redirector.servlet/src/main/java/org/apache/stratos/redirector/servlet/internal/RedirectorServletServiceComponent.java
@@ -0,0 +1,80 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.stratos.redirector.servlet.internal;
+
+import org.apache.stratos.redirector.servlet.util.Util;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.osgi.service.component.ComponentContext;
+import org.wso2.carbon.registry.core.service.RegistryService;
+import org.wso2.carbon.user.core.service.RealmService;
+import org.apache.stratos.activation.service.ActivationService;
+
+/**
+ * @scr.component name="org.apache.stratos.redirector.servlet"
+ * immediate="true"
+ * @scr.reference name="registry.service"
+ * interface="org.wso2.carbon.registry.core.service.RegistryService" cardinality="1..1"
+ * policy="dynamic" bind="setRegistryService" unbind="unsetRegistryService"
+ * @scr.reference name="user.realmservice.default" interface="org.wso2.carbon.user.core.service.RealmService"
+ * cardinality="1..1" policy="dynamic" bind="setRealmService"
+ * unbind="unsetRealmService"
+ * @scr.reference name="activation.service" interface="org.apache.stratos.activation.service.ActivationService"
+ * cardinality="0..1" policy="dynamic" bind="setActivationService"
+ * unbind="unsetActivationService"
+ */
+public class RedirectorServletServiceComponent {
+ private static Log log = LogFactory.getLog(RedirectorServletServiceComponent.class);
+
+ protected void activate(ComponentContext context) {
+ try {
+ log.debug("******* Multitenancy Redirector Servlet admin service bundle is activated ******* ");
+ } catch (Exception e) {
+ log.error("******* Multitenancy Redirector Servlet admin service bundle failed activating ****", e);
+ }
+ }
+
+ protected void deactivate(ComponentContext context) {
+ log.debug("******* Multitenancy Redirector Servlet admin service bundle is deactivated ******* ");
+ }
+
+ protected void setRegistryService(RegistryService registryService) {
+ Util.setRegistryService(registryService);
+ }
+
+ protected void unsetRegistryService(RegistryService registryService) {
+ Util.setRegistryService(null);
+ }
+
+ protected void setRealmService(RealmService realmService) {
+ Util.setRealmService(realmService);
+ }
+
+ protected void unsetRealmService(RealmService realmService) {
+ Util.setRealmService(null);
+ }
+
+ protected void setActivationService(ActivationService activationService) {
+ Util.setActivationService(activationService);
+ }
+
+ protected void unsetActivationService(ActivationService activationService) {
+ Util.setActivationService(null);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/888ca4d5/components/org.apache.stratos.redirector.servlet/src/main/java/org/apache/stratos/redirector/servlet/services/RedirectorServletService.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.redirector.servlet/src/main/java/org/apache/stratos/redirector/servlet/services/RedirectorServletService.java b/components/org.apache.stratos.redirector.servlet/src/main/java/org/apache/stratos/redirector/servlet/services/RedirectorServletService.java
new file mode 100644
index 0000000..ed1d5cb
--- /dev/null
+++ b/components/org.apache.stratos.redirector.servlet/src/main/java/org/apache/stratos/redirector/servlet/services/RedirectorServletService.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.stratos.redirector.servlet.services;
+
+import org.apache.stratos.redirector.servlet.util.Util;
+import org.wso2.carbon.user.core.tenant.TenantManager;
+import org.apache.stratos.common.constants.StratosConstants;
+
+public class RedirectorServletService {
+ public String validateTenant(String tenantDomain) throws Exception {
+ TenantManager tenantManager = Util.getTenantManager();
+ int tenantId = tenantManager.getTenantId(tenantDomain);
+ if (tenantId <= 0) {
+ return StratosConstants.INVALID_TENANT;
+ } else if (Util.getActivationService() != null &&
+ !Util.getActivationService().isActive(tenantId)) {
+ return StratosConstants.INACTIVE_TENANT;
+ }
+ return StratosConstants.ACTIVE_TENANT;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/888ca4d5/components/org.apache.stratos.redirector.servlet/src/main/java/org/apache/stratos/redirector/servlet/util/Util.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.redirector.servlet/src/main/java/org/apache/stratos/redirector/servlet/util/Util.java b/components/org.apache.stratos.redirector.servlet/src/main/java/org/apache/stratos/redirector/servlet/util/Util.java
new file mode 100644
index 0000000..3193c30
--- /dev/null
+++ b/components/org.apache.stratos.redirector.servlet/src/main/java/org/apache/stratos/redirector/servlet/util/Util.java
@@ -0,0 +1,73 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.stratos.redirector.servlet.util;
+
+import org.wso2.carbon.registry.core.service.RegistryService;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.wso2.carbon.user.core.service.RealmService;
+import org.wso2.carbon.user.core.tenant.TenantManager;
+import org.wso2.carbon.user.api.RealmConfiguration;
+import org.osgi.framework.ServiceRegistration;
+import org.apache.stratos.activation.service.ActivationService;
+
+import java.io.*;
+import java.util.*;
+
+public class Util {
+
+ private static final Log log = LogFactory.getLog(Util.class);
+
+ private static RegistryService registryService;
+ private static RealmService realmService;
+ private static ServiceRegistration redirectorServiceRegistration = null;
+ private static ActivationService activationService = null;
+
+ public static synchronized void setRegistryService(RegistryService service) {
+ if (registryService == null) {
+ registryService = service;
+ }
+ }
+ public static RegistryService getRegistryService() {
+ return registryService;
+ }
+
+ public static synchronized void setActivationService(ActivationService service) {
+ if (activationService == null) {
+ activationService = service;
+ }
+ }
+ public static ActivationService getActivationService() {
+ return activationService;
+ }
+
+ public static synchronized void setRealmService(RealmService service) {
+ if (realmService == null) {
+ realmService = service;
+ }
+ }
+
+ public static TenantManager getTenantManager() {
+ return realmService.getTenantManager();
+ }
+
+ public static RealmConfiguration getBootstrapRealmConfiguration() {
+ return realmService.getBootstrapRealmConfiguration();
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/888ca4d5/components/org.apache.stratos.redirector.servlet/src/main/resources/META-INF/services.xml
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.redirector.servlet/src/main/resources/META-INF/services.xml b/components/org.apache.stratos.redirector.servlet/src/main/resources/META-INF/services.xml
new file mode 100644
index 0000000..dd13fd4
--- /dev/null
+++ b/components/org.apache.stratos.redirector.servlet/src/main/resources/META-INF/services.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you under the Apache License, Version 2.0 (the
+ ~ "License"); you may not use this file except in compliance
+ ~ with the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing,
+ ~ software distributed under the License is distributed on an
+ ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ~ KIND, either express or implied. See the License for the
+ ~ specific language governing permissions and limitations
+ ~ under the License.
+ -->
+<serviceGroup>
+ <service name="RedirectorServletService" scope="transportsession">
+ <transports>
+ <transport>https</transport>
+ </transports>
+ <parameter name="ServiceClass" locked="false">
+ org.apache.stratos.redirector.servlet.services.RedirectorServletService
+ </parameter>
+ </service>
+ <parameter name="hiddenService" locked="true">true</parameter>
+</serviceGroup>
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/888ca4d5/components/org.apache.stratos.sso.redirector.ui/pom.xml
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.sso.redirector.ui/pom.xml b/components/org.apache.stratos.sso.redirector.ui/pom.xml
new file mode 100644
index 0000000..1b425b7
--- /dev/null
+++ b/components/org.apache.stratos.sso.redirector.ui/pom.xml
@@ -0,0 +1,87 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ # Licensed to the Apache Software Foundation (ASF) under one
+ # or more contributor license agreements. See the NOTICE file
+ # distributed with this work for additional information
+ # regarding copyright ownership. The ASF licenses this file
+ # to you under the Apache License, Version 2.0 (the
+ # "License"); you may not use this file except in compliance
+ # with the License. You may obtain a copy of the License at
+ #
+ # http://www.apache.org/licenses/LICENSE-2.0
+ #
+ # Unless required by applicable law or agreed to in writing,
+ # software distributed under the License is distributed on an
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ # KIND, either express or implied. See the License for the
+ # specific language governing permissions and limitations
+ # under the License.
+ -->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <groupId>org.apache.stratos</groupId>
+ <artifactId>stratos-components-parent</artifactId>
+ <version>3.0.0-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>org.apache.stratos.sso.redirector.ui</artifactId>
+ <version>2.1.0</version>
+ <packaging>bundle</packaging>
+ <name>Apache Stratos - SSO redirector UI component</name>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.5</source>
+ <target>1.5</target>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-scr-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+
+ <extensions>true</extensions>
+ <configuration>
+ <instructions>
+ <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
+ <Bundle-Name>${project.artifactId}</Bundle-Name>
+ <Private-Package>
+ org.apache.stratos.sso.redirector.ui.internal.*,
+ </Private-Package>
+ <Import-Package>
+ javax.servlet;version="${imp.pkg.version.javax.servlet}",
+ javax.servlet.http;version="${imp.pkg.version.javax.servlet}",
+ org.apache.lucene.*,
+ *;resolution:=optional
+ </Import-Package>
+ <Carbon-Component>UIBundle</Carbon-Component>
+ </instructions>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.wso2.carbon</groupId>
+ <artifactId>org.wso2.carbon.ui</artifactId>
+ <version>4.1.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.wso2.carbon</groupId>
+ <artifactId>org.wso2.carbon.identity.authenticator.saml2.sso.common</artifactId>
+ <version>4.1.0</version>
+ </dependency>
+ </dependencies>
+
+</project>
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/888ca4d5/components/org.apache.stratos.sso.redirector.ui/src/main/java/org/apache/stratos/sso/redirector/ui/internal/RedirectorJSPFilter.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.sso.redirector.ui/src/main/java/org/apache/stratos/sso/redirector/ui/internal/RedirectorJSPFilter.java b/components/org.apache.stratos.sso.redirector.ui/src/main/java/org/apache/stratos/sso/redirector/ui/internal/RedirectorJSPFilter.java
new file mode 100644
index 0000000..1c7ef60
--- /dev/null
+++ b/components/org.apache.stratos.sso.redirector.ui/src/main/java/org/apache/stratos/sso/redirector/ui/internal/RedirectorJSPFilter.java
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.stratos.sso.redirector.ui.internal;
+
+import javax.servlet.Filter;
+import javax.servlet.FilterChain;
+import javax.servlet.FilterConfig;
+import javax.servlet.RequestDispatcher;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.servlet.http.HttpServletRequest;
+import java.io.IOException;
+
+/**
+ * This class acts as a servlet filter which forwads the requests coming for sso-acs/redirect_ajaxprocessor.jsp
+ * to stratos-auth/redirect_ajaxprocessor.jsp
+ */
+public class RedirectorJSPFilter implements Filter {
+
+ public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse,
+ FilterChain filterChain) throws IOException, ServletException {
+ if (!(servletRequest instanceof HttpServletRequest)) {
+ return;
+ }
+ String url = ((HttpServletRequest) servletRequest).getRequestURI();
+ if(url.contains("//")){
+ url = url.replace("//", "/");
+ }
+ url = url.replace("sso-acs/redirect_ajaxprocessor.jsp", "stratos-auth/redirect_ajaxprocessor.jsp");
+ RequestDispatcher requestDispatcher =
+ servletRequest.getRequestDispatcher(url);
+ requestDispatcher.forward(servletRequest, servletResponse);
+ }
+
+ public void init(FilterConfig filterConfig) throws ServletException {
+ // not required to implement
+ }
+
+ public void destroy() {
+ // not required to implement
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/888ca4d5/components/org.apache.stratos.sso.redirector.ui/src/main/java/org/apache/stratos/sso/redirector/ui/internal/SSORedirectorServiceComponent.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.sso.redirector.ui/src/main/java/org/apache/stratos/sso/redirector/ui/internal/SSORedirectorServiceComponent.java b/components/org.apache.stratos.sso.redirector.ui/src/main/java/org/apache/stratos/sso/redirector/ui/internal/SSORedirectorServiceComponent.java
new file mode 100644
index 0000000..5f2521b
--- /dev/null
+++ b/components/org.apache.stratos.sso.redirector.ui/src/main/java/org/apache/stratos/sso/redirector/ui/internal/SSORedirectorServiceComponent.java
@@ -0,0 +1,66 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.stratos.sso.redirector.ui.internal;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.osgi.service.component.ComponentContext;
+
+import javax.servlet.Filter;
+import javax.servlet.Servlet;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.util.Dictionary;
+import java.util.Hashtable;
+
+/**
+ * @scr.component name="org.apache.stratos.sso.redirector.ui"
+ * immediate="true"
+ */
+public class SSORedirectorServiceComponent {
+ private static Log log = LogFactory.getLog(SSORedirectorServiceComponent.class);
+
+ protected void activate(ComponentContext ctxt) {
+
+ // register a servlet filter for SSO redirector page
+ HttpServlet redirectJSPRedirectorServlet = new HttpServlet() {
+ protected void doGet(HttpServletRequest request, HttpServletResponse response)
+ throws ServletException, IOException {
+ }
+ };
+
+ Filter redirectPageFilter = new RedirectorJSPFilter();
+ Dictionary redirectorPageFilterAttrs = new Hashtable(2);
+ Dictionary redirectorPageFilterParams = new Hashtable(2);
+ redirectorPageFilterParams.put("url-pattern", "/carbon/sso-acs/redirect_ajaxprocessor.jsp");
+ redirectorPageFilterParams.put("associated-filter", redirectPageFilter);
+ redirectorPageFilterParams.put("servlet-attributes", redirectorPageFilterAttrs);
+ ctxt.getBundleContext().registerService(Servlet.class.getName(), redirectJSPRedirectorServlet,
+ redirectorPageFilterParams);
+ log.debug("Stratos SSO Redirector bundle is activated..");
+ }
+
+ protected void deactivate(ComponentContext ctxt) {
+ log.debug("Stratos SSO Redirector bundle is deactivated..");
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/888ca4d5/components/org.apache.stratos.sso.redirector.ui/src/main/resources/org/apache/stratos/sso/redirector/ui/i18n/Resources.properties
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.sso.redirector.ui/src/main/resources/org/apache/stratos/sso/redirector/ui/i18n/Resources.properties b/components/org.apache.stratos.sso.redirector.ui/src/main/resources/org/apache/stratos/sso/redirector/ui/i18n/Resources.properties
new file mode 100644
index 0000000..d941d56
--- /dev/null
+++ b/components/org.apache.stratos.sso.redirector.ui/src/main/resources/org/apache/stratos/sso/redirector/ui/i18n/Resources.properties
@@ -0,0 +1,32 @@
+saml.sso.menu=SAML SSO
+saml.sso=SAML 2.0 based Single Sign-On
+enter.password.to.signin=Please enter your credentials to sign in to WSO2 Identity Server SAML SSO
+username=Username
+password=Password
+login=Sign In
+sso.configuration=SAML SSO Configuration
+sp.issuer=Issuer
+sp.assertionConsumerURL=Assertion Consumer URL
+sp.certAlias=Certificate Alias
+saml.sso.service.providers.not.found=No SAML SSO Service Providers are found.
+saml.sso.add.service.provider=Add new Service Provider
+saml.sso.add=Add
+sp.enter.valid.endpoint.address=Please enter a valid URL for AssertionConsumerURL
+sp.enter.valid.issuer=Please enter a valid issuer
+sp.enter.valid.claimID=ClaimID field cannot be left empty
+sp.added.successfully=Service Provider Added Successfully
+error.adding.sp=Could not add Service Provider. You might be entering a duplicate Service Provider
+remove.message1=You are about to remove the trusted service provider
+remove.message2=. Do you want to proceed?
+error.removing.sp=Problem in removing the service provider
+select.subject.type=Select the value to be appeared as the subject
+select.subject.type.username=Use current username as the subject
+select.subject.type.claimid=Use a custom claim as the subject
+subject.type.claimid=Claim ID
+subject.type.namidformat=NameID Format
+logout.url=Custom Logout URL
+validate.signature=Enable Signature Validation in Authentication Requests and Logout Requests
+saml.sso.generated.key=Generated Key for Signing SAML2 based single sign-on
+saml.sso.download.pub.key=Download the public key of the generated key pair
+saml.sso.add.sp.to.genkey=Add atleast one service provider to generate a key pair
+login.fail.message=Login failed! Please recheck the username and password and try again.
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/888ca4d5/components/org.apache.stratos.sso.redirector.ui/src/main/resources/web/stratos-auth/css/stratos-loginpage.css
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.sso.redirector.ui/src/main/resources/web/stratos-auth/css/stratos-loginpage.css b/components/org.apache.stratos.sso.redirector.ui/src/main/resources/web/stratos-auth/css/stratos-loginpage.css
new file mode 100644
index 0000000..fce87f7
--- /dev/null
+++ b/components/org.apache.stratos.sso.redirector.ui/src/main/resources/web/stratos-auth/css/stratos-loginpage.css
@@ -0,0 +1,94 @@
+body {
+background-image:url(../images/st-login-body-bg.gif);
+background-position:left top;
+background-repeat:repeat-x;
+font-family:"Calibri",Arial,Helvetica,san-serif;
+font-size:0.8em;
+margin:0;
+padding:0;
+}
+p {
+}
+td {
+}
+a:link {
+text-decoration:none;
+}
+a:visited {
+}
+a:hover {
+}
+a:active {
+}
+a img {
+border:0 none;
+}
+div#middle {
+background-color:#FFFFFF;
+margin:auto;
+width:961px;
+}
+div#header {
+background-image:url(../images/st-login-header-bg.gif);
+background-position:left top;
+background-repeat:no-repeat;
+height:87px;
+padding-top:94px;
+text-align:center;
+}
+div#content {
+background-image:url(../images/st-login-content-bg.gif);
+background-position:left top;
+background-repeat:no-repeat;
+padding-left:60px;
+padding-right:60px;
+padding-top:20px;
+}
+div#intro {
+padding-bottom:10px;
+text-align:center;
+}
+div#register {
+float:left;
+padding-top:85px;
+text-align:center;
+width:420px;
+}
+div#sign-in {
+border-left:1px solid #0499CC;
+float:left;
+padding:20px 30px 30px 50px;
+text-align:left;
+width:340px;
+}
+div#sign-in h2 {
+border-bottom:1px solid #78BDE8;
+font-size:130%;
+margin-bottom:10px;
+margin-top:0;
+padding-bottom:10px;
+padding-top:0;
+}
+div#sign-in table tr td {
+padding-bottom:5px;
+padding-right:7px;
+}
+div#sign-in table {
+border-bottom:1px solid #78BDE8;
+margin-bottom:7px;
+}
+div#footer {
+background-image:url(../images/st-login-footer-bg.gif);
+background-position:left top;
+background-repeat:no-repeat;
+margin-top:5px;
+padding-bottom:7px;
+padding-top:25px;
+text-align:center;
+}
+div.clear {
+clear:both;
+}
+#loginForm td label{
+ font-size:11px;
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/888ca4d5/components/org.apache.stratos.sso.redirector.ui/src/main/resources/web/stratos-auth/images/cloud-identity-sso-config-ok.png
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.sso.redirector.ui/src/main/resources/web/stratos-auth/images/cloud-identity-sso-config-ok.png b/components/org.apache.stratos.sso.redirector.ui/src/main/resources/web/stratos-auth/images/cloud-identity-sso-config-ok.png
new file mode 100644
index 0000000..eab6259
Binary files /dev/null and b/components/org.apache.stratos.sso.redirector.ui/src/main/resources/web/stratos-auth/images/cloud-identity-sso-config-ok.png differ
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/888ca4d5/components/org.apache.stratos.sso.redirector.ui/src/main/resources/web/stratos-auth/images/cloud-identity-sso-config.png
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.sso.redirector.ui/src/main/resources/web/stratos-auth/images/cloud-identity-sso-config.png b/components/org.apache.stratos.sso.redirector.ui/src/main/resources/web/stratos-auth/images/cloud-identity-sso-config.png
new file mode 100644
index 0000000..994c861
Binary files /dev/null and b/components/org.apache.stratos.sso.redirector.ui/src/main/resources/web/stratos-auth/images/cloud-identity-sso-config.png differ
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/888ca4d5/components/org.apache.stratos.sso.redirector.ui/src/main/resources/web/stratos-auth/images/cloud-sso-config.png
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.sso.redirector.ui/src/main/resources/web/stratos-auth/images/cloud-sso-config.png b/components/org.apache.stratos.sso.redirector.ui/src/main/resources/web/stratos-auth/images/cloud-sso-config.png
new file mode 100644
index 0000000..375e9ee
Binary files /dev/null and b/components/org.apache.stratos.sso.redirector.ui/src/main/resources/web/stratos-auth/images/cloud-sso-config.png differ
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/888ca4d5/components/org.apache.stratos.sso.redirector.ui/src/main/resources/web/stratos-auth/images/delete.gif
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.sso.redirector.ui/src/main/resources/web/stratos-auth/images/delete.gif b/components/org.apache.stratos.sso.redirector.ui/src/main/resources/web/stratos-auth/images/delete.gif
new file mode 100644
index 0000000..471f55c
Binary files /dev/null and b/components/org.apache.stratos.sso.redirector.ui/src/main/resources/web/stratos-auth/images/delete.gif differ
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/888ca4d5/components/org.apache.stratos.sso.redirector.ui/src/main/resources/web/stratos-auth/images/import.gif
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.sso.redirector.ui/src/main/resources/web/stratos-auth/images/import.gif b/components/org.apache.stratos.sso.redirector.ui/src/main/resources/web/stratos-auth/images/import.gif
new file mode 100644
index 0000000..c9fb1df
Binary files /dev/null and b/components/org.apache.stratos.sso.redirector.ui/src/main/resources/web/stratos-auth/images/import.gif differ
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/888ca4d5/components/org.apache.stratos.sso.redirector.ui/src/main/resources/web/stratos-auth/images/loading.gif
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.sso.redirector.ui/src/main/resources/web/stratos-auth/images/loading.gif b/components/org.apache.stratos.sso.redirector.ui/src/main/resources/web/stratos-auth/images/loading.gif
new file mode 100644
index 0000000..5b200ed
Binary files /dev/null and b/components/org.apache.stratos.sso.redirector.ui/src/main/resources/web/stratos-auth/images/loading.gif differ
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/888ca4d5/components/org.apache.stratos.sso.redirector.ui/src/main/resources/web/stratos-auth/images/logo.gif
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.sso.redirector.ui/src/main/resources/web/stratos-auth/images/logo.gif b/components/org.apache.stratos.sso.redirector.ui/src/main/resources/web/stratos-auth/images/logo.gif
new file mode 100644
index 0000000..837f813
Binary files /dev/null and b/components/org.apache.stratos.sso.redirector.ui/src/main/resources/web/stratos-auth/images/logo.gif differ
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/888ca4d5/components/org.apache.stratos.sso.redirector.ui/src/main/resources/web/stratos-auth/images/policy.gif
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.sso.redirector.ui/src/main/resources/web/stratos-auth/images/policy.gif b/components/org.apache.stratos.sso.redirector.ui/src/main/resources/web/stratos-auth/images/policy.gif
new file mode 100644
index 0000000..f9c58f5
Binary files /dev/null and b/components/org.apache.stratos.sso.redirector.ui/src/main/resources/web/stratos-auth/images/policy.gif differ
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/888ca4d5/components/org.apache.stratos.sso.redirector.ui/src/main/resources/web/stratos-auth/images/powered.gif
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.sso.redirector.ui/src/main/resources/web/stratos-auth/images/powered.gif b/components/org.apache.stratos.sso.redirector.ui/src/main/resources/web/stratos-auth/images/powered.gif
new file mode 100644
index 0000000..b8bc163
Binary files /dev/null and b/components/org.apache.stratos.sso.redirector.ui/src/main/resources/web/stratos-auth/images/powered.gif differ
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/888ca4d5/components/org.apache.stratos.sso.redirector.ui/src/main/resources/web/stratos-auth/images/register.gif
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.sso.redirector.ui/src/main/resources/web/stratos-auth/images/register.gif b/components/org.apache.stratos.sso.redirector.ui/src/main/resources/web/stratos-auth/images/register.gif
new file mode 100644
index 0000000..f225e38
Binary files /dev/null and b/components/org.apache.stratos.sso.redirector.ui/src/main/resources/web/stratos-auth/images/register.gif differ
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/888ca4d5/components/org.apache.stratos.sso.redirector.ui/src/main/resources/web/stratos-auth/images/sso.gif
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.sso.redirector.ui/src/main/resources/web/stratos-auth/images/sso.gif b/components/org.apache.stratos.sso.redirector.ui/src/main/resources/web/stratos-auth/images/sso.gif
new file mode 100644
index 0000000..7f2e74a
Binary files /dev/null and b/components/org.apache.stratos.sso.redirector.ui/src/main/resources/web/stratos-auth/images/sso.gif differ
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/888ca4d5/components/org.apache.stratos.sso.redirector.ui/src/main/resources/web/stratos-auth/images/st-login-body-bg.gif
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.sso.redirector.ui/src/main/resources/web/stratos-auth/images/st-login-body-bg.gif b/components/org.apache.stratos.sso.redirector.ui/src/main/resources/web/stratos-auth/images/st-login-body-bg.gif
new file mode 100644
index 0000000..dc2c240
Binary files /dev/null and b/components/org.apache.stratos.sso.redirector.ui/src/main/resources/web/stratos-auth/images/st-login-body-bg.gif differ
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/888ca4d5/components/org.apache.stratos.sso.redirector.ui/src/main/resources/web/stratos-auth/images/st-login-content-bg.gif
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.sso.redirector.ui/src/main/resources/web/stratos-auth/images/st-login-content-bg.gif b/components/org.apache.stratos.sso.redirector.ui/src/main/resources/web/stratos-auth/images/st-login-content-bg.gif
new file mode 100644
index 0000000..9624125
Binary files /dev/null and b/components/org.apache.stratos.sso.redirector.ui/src/main/resources/web/stratos-auth/images/st-login-content-bg.gif differ
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/888ca4d5/components/org.apache.stratos.sso.redirector.ui/src/main/resources/web/stratos-auth/images/st-login-footer-bg.gif
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.sso.redirector.ui/src/main/resources/web/stratos-auth/images/st-login-footer-bg.gif b/components/org.apache.stratos.sso.redirector.ui/src/main/resources/web/stratos-auth/images/st-login-footer-bg.gif
new file mode 100644
index 0000000..dc317e5
Binary files /dev/null and b/components/org.apache.stratos.sso.redirector.ui/src/main/resources/web/stratos-auth/images/st-login-footer-bg.gif differ
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/888ca4d5/components/org.apache.stratos.sso.redirector.ui/src/main/resources/web/stratos-auth/images/st-login-header-bg.gif
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.sso.redirector.ui/src/main/resources/web/stratos-auth/images/st-login-header-bg.gif b/components/org.apache.stratos.sso.redirector.ui/src/main/resources/web/stratos-auth/images/st-login-header-bg.gif
new file mode 100644
index 0000000..bd228c9
Binary files /dev/null and b/components/org.apache.stratos.sso.redirector.ui/src/main/resources/web/stratos-auth/images/st-login-header-bg.gif differ
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/888ca4d5/components/org.apache.stratos.sso.redirector.ui/src/main/resources/web/stratos-auth/redirect_ajaxprocessor.jsp
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.sso.redirector.ui/src/main/resources/web/stratos-auth/redirect_ajaxprocessor.jsp b/components/org.apache.stratos.sso.redirector.ui/src/main/resources/web/stratos-auth/redirect_ajaxprocessor.jsp
new file mode 100644
index 0000000..5725f7a
--- /dev/null
+++ b/components/org.apache.stratos.sso.redirector.ui/src/main/resources/web/stratos-auth/redirect_ajaxprocessor.jsp
@@ -0,0 +1,177 @@
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you under the Apache License, Version 2.0 (the
+ ~ "License"); you may not use this file except in compliance
+ ~ with the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing,
+ ~ software distributed under the License is distributed on an
+ ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ~ KIND, either express or implied. See the License for the
+ ~ specific language governing permissions and limitations
+ ~ under the License.
+ -->
+<%@page import="org.opensaml.saml2.core.AuthnRequest" %>
+<%@page import="org.opensaml.saml2.core.LogoutRequest" %>
+<%@ page
+ import="org.wso2.carbon.identity.authenticator.saml2.sso.common.SAML2SSOAuthenticatorConstants" %>
+<%@ page import="org.wso2.carbon.identity.authenticator.saml2.sso.common.SSOSessionManager" %>
+<%@ page
+ import="org.wso2.carbon.identity.authenticator.saml2.sso.common.builders.AuthenticationRequestBuilder" %>
+<%@ page
+ import="org.wso2.carbon.identity.authenticator.saml2.sso.common.builders.LogoutRequestBuilder" %>
+<%@ page
+ import="org.wso2.carbon.identity.authenticator.saml2.sso.common.Util" %>
+<%@ page import="org.wso2.carbon.registry.core.utils.UUIDGenerator" %>
+<%@ page import="org.wso2.carbon.utils.multitenancy.MultitenantConstants" %>
+<%@ page contentType="text/html;charset=UTF-8" language="java" %>
+<html>
+<head>
+ <title>WSO2 Stratos Identity</title>
+ <style type="text/css" media="screen"><!--
+ body {
+ color: #111111;
+ font: 13px/27px Arial,sans-serif;
+ font-size-adjust: none;
+ font-style: normal;
+ font-variant: normal;
+ }
+
+
+
+ .redirectForm {
+ display: inline;
+ }
+ .dots{
+ border:solid 1x #ccc;
+ width:10px;
+ height:10px;
+ float:left;
+ margin:5px;
+ -moz-border-radius: 4px;
+ border-radius: 4px;
+ -moz-box-shadow: 3px 3px 3px #888;
+ -webkit-box-shadow: 3px 3px 3px #888;
+ box-shadow: 3px 3px 3px #888;
+ }
+ .dots-pane{
+ width:150px;
+ margin:0px 10px;
+ }
+ .dot0{
+ background-color:#111;
+ }
+ .dot1{
+ background-color:#444;
+ }
+ .dot2{
+ background-color:#777;
+ }
+ .dot3{
+ background-color:#ddd;
+ }
+ .dot4{
+ background-color:#eee;
+ }
+ .dot5{
+ background-color:#fff;
+ }
+ .loading-text{
+ padding:10px;
+ font-weight:bold;
+ font-size:16px;
+ }
+ --></style>
+</head>
+<body>
+<%
+ String encodedReq = null;
+ String relayState = "";
+ String domain = null;
+ if (request.getParameter(SAML2SSOAuthenticatorConstants.LOG_OUT_REQ) != null) {
+ LogoutRequestBuilder logoutRequestBuilder = new LogoutRequestBuilder();
+ LogoutRequest logoutReq = logoutRequestBuilder.buildLogoutRequest((String) request.getAttribute(
+ SAML2SSOAuthenticatorConstants.LOGGED_IN_USER), SAML2SSOAuthenticatorConstants.LOGOUT_USER);
+ encodedReq = Util.encode(Util.marshall(logoutReq));
+ relayState = UUIDGenerator.generateUUID();
+ } else {
+ AuthenticationRequestBuilder authnReqGenerator = new AuthenticationRequestBuilder();
+ AuthnRequest authRequest = authnReqGenerator.buildAuthenticationRequest(null);
+ encodedReq = Util.encode(Util.marshall(authRequest));
+ relayState = UUIDGenerator.generateUUID();
+ domain = (String) request.getAttribute(MultitenantConstants.TENANT_DOMAIN);
+ }
+ // add the relay state to Session Manager
+ SSOSessionManager.addAuthnRequest(relayState);
+
+%>
+<div class="loading-text">Loading WSO2 StratosLive...</div>
+<div class="dots-pane" id="dotsContainer">
+ <div class="dots"></div>
+ <div class="dots"></div>
+ <div class="dots"></div>
+ <div class="dots"></div>
+ <div class="dots"></div>
+ <div class="dots"></div>
+</div>
+
+<script>
+ var t;
+ var timer_is_on = 0;
+ var j=0;
+ var dotsContainer = document.getElementById('dotsContainer');
+ var dots = dotsContainer.childNodes;
+ var divdots = new Array();
+ for(var i=0;i<dots.length;i++){
+ if(dots[i].nodeName == "DIV" ){
+ divdots.push(dots[i]);
+ }
+ }
+ function animateStuff(){
+ for(var i=0;i<divdots.length;i++){
+ var classNumber;
+ if((i+j)<divdots.length){
+ classNumber = i + j;
+ }else{
+ classNumber = i + j - divdots.length;
+ }
+ divdots[i].className = "dots dot"+classNumber;
+
+ }
+ if(j<=5){
+ j++;
+ }else{
+ j=0;
+ }
+ t = setTimeout(animateStuff,200);
+ }
+
+ if(!timer_is_on){
+ animateStuff();
+ }
+</script>
+
+
+
+<form method="post" action="<%=Util.getIdentityProviderSSOServiceURL()%>" class="redirectForm">
+ <input type="hidden"
+ name="<%=SAML2SSOAuthenticatorConstants.HTTP_POST_PARAM_SAML2_AUTH_REQ%>"
+ value="<%= encodedReq %>"/>
+ <input type="hidden" name="RelayState" value="<%= relayState %>"/>
+ <input type="hidden" name="<%= MultitenantConstants.TENANT_DOMAIN %>"
+ value="<%= domain %>"/>
+ <input type="hidden" name="<%= MultitenantConstants.SSO_AUTH_SESSION_ID %>" value="<%= session.getId() %>"/>
+
+</form>
+
+<script type="text/javascript">
+ document.forms[0].submit();
+</script>
+
+</body>
+</html>