Author: hfnukal
Date: 2011-06-22 19:50:33 -0400 (Wed, 22 Jun 2011)
New Revision: 6717
Removed:
epp/portal/branches/EPP_5_2_Branch/component/web/security/src/main/java/org/exoplatform/web/security/Credentials.java
Modified:
epp/portal/branches/EPP_5_2_Branch/component/
epp/portal/branches/EPP_5_2_Branch/component/web/security/pom.xml
epp/portal/branches/EPP_5_2_Branch/component/web/security/src/main/java/org/exoplatform/web/login/ClusteredSSOFilter.java
epp/portal/branches/EPP_5_2_Branch/component/web/security/src/main/java/org/exoplatform/web/login/InitiateLoginServlet.java
epp/portal/branches/EPP_5_2_Branch/component/web/security/src/main/java/org/exoplatform/web/login/RememberMeFilter.java
epp/portal/branches/EPP_5_2_Branch/component/web/security/src/main/java/org/exoplatform/web/security/GateInToken.java
epp/portal/branches/EPP_5_2_Branch/component/web/security/src/main/java/org/exoplatform/web/security/PortalLoginModule.java
epp/portal/branches/EPP_5_2_Branch/component/web/security/src/main/java/org/exoplatform/web/security/Token.java
epp/portal/branches/EPP_5_2_Branch/component/web/security/src/main/java/org/exoplatform/web/security/TokenStore.java
epp/portal/branches/EPP_5_2_Branch/component/web/security/src/main/java/org/exoplatform/web/security/security/AbstractTokenService.java
epp/portal/branches/EPP_5_2_Branch/component/web/security/src/main/java/org/exoplatform/web/security/security/CookieTokenService.java
epp/portal/branches/EPP_5_2_Branch/component/web/security/src/main/java/org/exoplatform/web/security/security/TokenContainer.java
epp/portal/branches/EPP_5_2_Branch/component/web/security/src/main/java/org/exoplatform/web/security/security/TokenEntry.java
epp/portal/branches/EPP_5_2_Branch/component/web/security/src/main/java/org/exoplatform/web/security/security/TransientTokenService.java
epp/portal/branches/EPP_5_2_Branch/examples/
epp/portal/branches/EPP_5_2_Branch/examples/extension/war/src/main/webapp/templates/groovy/webui/component/UIHomePagePortlet.gtmpl
epp/portal/branches/EPP_5_2_Branch/examples/portal/README.txt
epp/portal/branches/EPP_5_2_Branch/examples/portal/ear/src/main/application/META-INF/gatein-jboss-beans.xml
epp/portal/branches/EPP_5_2_Branch/examples/portal/war/src/main/webapp/WEB-INF/web.xml
epp/portal/branches/EPP_5_2_Branch/examples/portal/war/src/main/webapp/templates/groovy/webui/component/UIHomePagePortlet.gtmpl
Log:
JBEPP-952 merge r5822
Property changes on: epp/portal/branches/EPP_5_2_Branch/component
___________________________________________________________________
Added: svn:mergeinfo
+ /epp/portal/branches/EPP_5_1_0_GA_JBEPP-795/component:5868
/portal/branches/branch-GTNPORTAL-1592/component:4894
/portal/branches/branch-GTNPORTAL-1643/component:5002,5063,5167
/portal/branches/branch-GTNPORTAL-1700/component:5348,5402,5445
/portal/branches/branch-GTNPORTAL-1731/component:5668
/portal/branches/branch-GTNPORTAL-1745/component:5765
/portal/branches/branch-GTNPORTAL-1822/component:5943
/portal/branches/branch-GTNPORTAL-1832/component:6030,6063
/portal/trunk/component:4891,5744,5822,5943,6168,6196,6201-6203,6205-6206
Modified: epp/portal/branches/EPP_5_2_Branch/component/web/security/pom.xml
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/web/security/pom.xml 2011-06-22 20:22:21
UTC (rev 6716)
+++ epp/portal/branches/EPP_5_2_Branch/component/web/security/pom.xml 2011-06-22 23:50:33
UTC (rev 6717)
@@ -63,5 +63,9 @@
<artifactId>jboss-as-tomcat</artifactId>
<scope>provided</scope>
</dependency>
+ <dependency>
+ <groupId>org.gatein.wci</groupId>
+ <artifactId>wci-wci</artifactId>
+ </dependency>
</dependencies>
</project>
Modified:
epp/portal/branches/EPP_5_2_Branch/component/web/security/src/main/java/org/exoplatform/web/login/ClusteredSSOFilter.java
===================================================================
---
epp/portal/branches/EPP_5_2_Branch/component/web/security/src/main/java/org/exoplatform/web/login/ClusteredSSOFilter.java 2011-06-22
20:22:21 UTC (rev 6716)
+++
epp/portal/branches/EPP_5_2_Branch/component/web/security/src/main/java/org/exoplatform/web/login/ClusteredSSOFilter.java 2011-06-22
23:50:33 UTC (rev 6717)
@@ -25,9 +25,9 @@
import org.exoplatform.container.ExoContainer;
import org.exoplatform.container.web.AbstractFilter;
-import org.exoplatform.web.security.Credentials;
import org.exoplatform.web.security.PortalLoginModule;
+import org.gatein.wci.security.Credentials;
import org.jboss.web.tomcat.security.login.WebAuthentication;
import javax.servlet.FilterChain;
@@ -77,4 +77,4 @@
public void destroy()
{
}
-}
+}
\ No newline at end of file
Modified:
epp/portal/branches/EPP_5_2_Branch/component/web/security/src/main/java/org/exoplatform/web/login/InitiateLoginServlet.java
===================================================================
---
epp/portal/branches/EPP_5_2_Branch/component/web/security/src/main/java/org/exoplatform/web/login/InitiateLoginServlet.java 2011-06-22
20:22:21 UTC (rev 6716)
+++
epp/portal/branches/EPP_5_2_Branch/component/web/security/src/main/java/org/exoplatform/web/login/InitiateLoginServlet.java 2011-06-22
23:50:33 UTC (rev 6717)
@@ -19,18 +19,20 @@
package org.exoplatform.web.login;
-import org.exoplatform.container.PortalContainer;
import org.exoplatform.container.web.AbstractHttpServlet;
-import org.exoplatform.web.security.Credentials;
import org.exoplatform.web.security.security.AbstractTokenService;
import org.exoplatform.web.security.security.CookieTokenService;
-import org.exoplatform.web.security.security.TransientTokenService;
+import org.exoplatform.web.security.security.TicketConfiguration;
import org.gatein.common.logging.Logger;
import org.gatein.common.logging.LoggerFactory;
+import org.gatein.wci.authentication.AuthenticationResult;
+import org.gatein.wci.authentication.GenericAuthenticationResult;
+import org.gatein.wci.authentication.ProgrammaticAuthenticationResult;
+import org.gatein.wci.security.Credentials;
+import org.gatein.wci.impl.DefaultServletContainerFactory;
import java.io.IOException;
-import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
@@ -53,7 +55,8 @@
public static final String COOKIE_NAME = "rememberme";
/** . */
- public static final String CREDENTIALS = "credentials";
+ public static final long LOGIN_VALIDITY =
+ 1000 *
TicketConfiguration.getInstance(TicketConfiguration.class).getValidityTime();
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws
ServletException, IOException
@@ -62,14 +65,11 @@
HttpSession session = req.getSession();
// Looking for credentials stored in the session
- Credentials credentials =
(Credentials)session.getAttribute(InitiateLoginServlet.CREDENTIALS);
+ Credentials credentials =
(Credentials)session.getAttribute(Credentials.CREDENTIALS);
//
if (credentials == null)
{
- PortalContainer pContainer = PortalContainer.getInstance();
- ServletContext context = pContainer.getPortalContext();
-
//
String token = getRememberMeTokenCookie(req);
if (token != null)
@@ -96,7 +96,8 @@
// Send authentication request
log.debug("Login initiated with no credentials in session but found
token " + token + " with existing credentials, " +
"performing authentication");
- sendAuth(resp, credentials.getUsername(), token);
+ //sendAuth(resp, credentials.getUsername(), token);
+ sendAuth(req, resp, credentials.getUsername(), token);
}
}
else
@@ -109,24 +110,30 @@
}
else
{
- // We create a temporary token just for the login time
- TransientTokenService tokenService =
AbstractTokenService.getInstance(TransientTokenService.class);
- String token = tokenService.createToken(credentials);
- req.getSession().removeAttribute(InitiateLoginServlet.CREDENTIALS);
+ // WCI authentication
+ AuthenticationResult result =
DefaultServletContainerFactory.getInstance().getServletContainer()
+ .login(req, resp, credentials.getUsername(), credentials.getPassword(),
LOGIN_VALIDITY);
- // Send authentication request
log.debug("Login initiated with credentials in session, performing
authentication");
- sendAuth(resp, credentials.getUsername(), token);
+ if (result instanceof GenericAuthenticationResult)
+ {
+ ((GenericAuthenticationResult) result).perform(req, resp);
+ }
+ else if (result instanceof ProgrammaticAuthenticationResult)
+ {
+
resp.sendRedirect(resp.encodeRedirectURL((String)req.getAttribute("javax.servlet.forward.request_uri")));
+ }
}
}
private void showLoginForm(HttpServletRequest req, HttpServletResponse resp) throws
ServletException, IOException
{
- String initialURI =
(String)req.getAttribute("javax.servlet.forward.request_uri");
+ /*String initialURI =
(String)req.getAttribute("javax.servlet.forward.request_uri");
if (initialURI == null)
{
throw new IllegalStateException("request attribute
javax.servlet.forward.request_uri should not be null here");
- }
+ }*/
+ String initialURI = getInitialURI(req);
try
{
String queryString =
(String)req.getAttribute("javax.servlet.forward.query_string");
@@ -134,23 +141,35 @@
{
initialURI = initialURI + "?" + queryString;
}
+ //req.setAttribute("org.gatein.portal.login.initial_uri",
initialURI);
+
//req.getSession(true).setAttribute("org.gatein.portal.login.initial_uri",
initialURI);
req.setAttribute("org.gatein.portal.login.initial_uri", initialURI);
getServletContext().getRequestDispatcher("/login/jsp/login.jsp").include(req,
resp);
}
finally
{
+ //req.removeAttribute("org.gatein.portal.login.initial_uri");
+
//req.getSession(true).removeAttribute("org.gatein.portal.login.initial_uri");
req.removeAttribute("org.gatein.portal.login.initial_uri");
}
}
+
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws
ServletException, IOException
{
doGet(req, resp);
}
- private void sendAuth(HttpServletResponse resp, String jUsername, String jPassword)
throws IOException
+ //private void sendAuth(HttpServletResponse resp, String jUsername, String jPassword)
throws IOException
+ private void sendAuth(HttpServletRequest req, HttpServletResponse resp, String
jUsername, String jPassword) throws IOException
{
- String url = "j_security_check?j_username=" + jUsername +
"&j_password=" + jPassword;
+ //String url = "j_security_check?j_username=" + jUsername +
"&j_password=" + jPassword;
+ String initialURI = getInitialURI(req);
+ if (!initialURI.endsWith("/"))
+ {
+ initialURI += "/";
+ }
+ String url = initialURI + "j_security_check?j_username=" + jUsername +
"&j_password=" + jPassword;
url = resp.encodeRedirectURL(url);
resp.sendRedirect(url);
}
Modified:
epp/portal/branches/EPP_5_2_Branch/component/web/security/src/main/java/org/exoplatform/web/login/RememberMeFilter.java
===================================================================
---
epp/portal/branches/EPP_5_2_Branch/component/web/security/src/main/java/org/exoplatform/web/login/RememberMeFilter.java 2011-06-22
20:22:21 UTC (rev 6716)
+++
epp/portal/branches/EPP_5_2_Branch/component/web/security/src/main/java/org/exoplatform/web/login/RememberMeFilter.java 2011-06-22
23:50:33 UTC (rev 6717)
@@ -19,9 +19,13 @@
package org.exoplatform.web.login;
+import org.exoplatform.container.ExoContainer;
+import org.exoplatform.container.web.AbstractFilter;
+import org.exoplatform.web.security.security.CookieTokenService;
import org.gatein.common.logging.Logger;
import org.gatein.common.logging.LoggerFactory;
import org.gatein.common.text.FastURLEncoder;
+import org.gatein.wci.security.Credentials;
import javax.servlet.*;
import javax.servlet.http.HttpServletRequest;
@@ -36,18 +40,14 @@
* @author <a href="mailto:julien.viet@exoplatform.com">Julien
Viet</a>
* @version $Revision$
*/
-public class RememberMeFilter implements Filter
+public class RememberMeFilter extends AbstractFilter
{
/** . */
private static final FastURLEncoder CONVERTER = FastURLEncoder.getUTF8Instance();
/** . */
private static final Logger log = LoggerFactory.getLogger(RememberMeFilter.class);
-
- public void init(FilterConfig filterConfig) throws ServletException
- {
- }
-
+
public void doFilter(ServletRequest req, ServletResponse resp, FilterChain chain)
throws IOException, ServletException
{
doFilter((HttpServletRequest)req, (HttpServletResponse)resp, chain);
@@ -60,39 +60,67 @@
String token = InitiateLoginServlet.getRememberMeTokenCookie(req);
if (token != null)
{
- StringBuilder builder = new StringBuilder();
- builder.append(req.getContextPath());
- builder.append("/private");
- String pathInfo = req.getPathInfo();
- if (pathInfo != null)
+
+ ExoContainer container = getContainer();
+ Object o =
+
((CookieTokenService)container.getComponentInstanceOfType(CookieTokenService.class)).validateToken(
+ token, false);
+ if (o instanceof Credentials)
{
- builder.append(pathInfo);
+ req.getSession().setAttribute(Credentials.CREDENTIALS, o);
+ resp.sendRedirect(resp.encodeRedirectURL(
+ loginUrl(
+ req.getContextPath(),
+ privateUri(req)
+ )
+ ));
+ resp.flushBuffer();
}
- char sep = '?';
- for (Enumeration<String> e =
req.getParameterNames();e.hasMoreElements();)
- {
- String parameterName = e.nextElement();
- for (String parameteValue : req.getParameterValues(parameterName))
- {
- builder.append(sep);
- sep = '&';
- builder.append(CONVERTER.encode(parameterName));
- builder.append('=');
- builder.append(CONVERTER.encode(parameteValue));
- }
- }
- String s = builder.toString();
- log.debug("Redirecting unauthenticated request with token " + token
+ " to URL " + s);
- resp.sendRedirect(s);
- return;
}
}
//
- chain.doFilter(req, resp);
+ if (!resp.isCommitted())
+ {
+ chain.doFilter(req, resp);
+ }
}
public void destroy()
{
}
+
+ private String privateUri(HttpServletRequest req)
+ {
+ StringBuilder builder = new StringBuilder();
+ builder.append(req.getContextPath());
+ builder.append("/private");
+ String pathInfo = req.getPathInfo();
+ if (pathInfo != null)
+ {
+ builder.append(pathInfo);
+ }
+ char sep = '?';
+ for (Enumeration<String> e = req.getParameterNames();e.hasMoreElements();)
+ {
+ String parameterName = e.nextElement();
+ for (String parameteValue : req.getParameterValues(parameterName))
+ {
+ builder.append(sep);
+ sep = '&';
+ builder.append(CONVERTER.encode(parameterName));
+ builder.append('=');
+ builder.append(CONVERTER.encode(parameteValue));
+ }
+ }
+ return builder.toString();
+ }
+
+ private String loginUrl(String context, String initUrl)
+ {
+ return String.format(
+ "%s/login?initialURI=%s",
+ context, initUrl
+ );
+ }
}
Deleted:
epp/portal/branches/EPP_5_2_Branch/component/web/security/src/main/java/org/exoplatform/web/security/Credentials.java
===================================================================
---
epp/portal/branches/EPP_5_2_Branch/component/web/security/src/main/java/org/exoplatform/web/security/Credentials.java 2011-06-22
20:22:21 UTC (rev 6716)
+++
epp/portal/branches/EPP_5_2_Branch/component/web/security/src/main/java/org/exoplatform/web/security/Credentials.java 2011-06-22
23:50:33 UTC (rev 6717)
@@ -1,81 +0,0 @@
-/**
- * Copyright (C) 2009 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-
-package org.exoplatform.web.security;
-
-import java.io.Serializable;
-
-/**
- * An immutable object that contains a username and a password.
- *
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien
Viet</a>
- * @version $Revision$
- */
-public class Credentials implements Serializable
-{
-
-
-
- /** . */
- private final String username;
-
- /** . */
- private final String password;
-
- /**
- * Construct a new instance.
- *
- * @param username the username value
- * @param password the password value
- * @throws NullPointerException if any argument is null
- */
- public Credentials(String username, String password) throws NullPointerException
- {
- if (username == null)
- {
- throw new NullPointerException("Username is null");
- }
- if (password == null)
- {
- throw new NullPointerException("Password is null");
- }
- this.username = username;
- this.password = password;
- }
-
- /**
- * Returns the username.
- *
- * @return the username
- */
- public String getUsername()
- {
- return username;
- }
-
- /**
- * Returns the password.
- *
- * @return the password
- */
- public String getPassword()
- {
- return password;
- }
-}
Modified:
epp/portal/branches/EPP_5_2_Branch/component/web/security/src/main/java/org/exoplatform/web/security/GateInToken.java
===================================================================
---
epp/portal/branches/EPP_5_2_Branch/component/web/security/src/main/java/org/exoplatform/web/security/GateInToken.java 2011-06-22
20:22:21 UTC (rev 6716)
+++
epp/portal/branches/EPP_5_2_Branch/component/web/security/src/main/java/org/exoplatform/web/security/GateInToken.java 2011-06-22
23:50:33 UTC (rev 6717)
@@ -19,7 +19,9 @@
package org.exoplatform.web.security;
+import org.gatein.wci.security.Credentials;
+
/**
* Created by The eXo Platform SAS
* Author : Tan Pham Dinh
Modified:
epp/portal/branches/EPP_5_2_Branch/component/web/security/src/main/java/org/exoplatform/web/security/PortalLoginModule.java
===================================================================
---
epp/portal/branches/EPP_5_2_Branch/component/web/security/src/main/java/org/exoplatform/web/security/PortalLoginModule.java 2011-06-22
20:22:21 UTC (rev 6716)
+++
epp/portal/branches/EPP_5_2_Branch/component/web/security/src/main/java/org/exoplatform/web/security/PortalLoginModule.java 2011-06-22
23:50:33 UTC (rev 6717)
@@ -24,8 +24,7 @@
import org.exoplatform.services.log.Log;
import org.exoplatform.services.security.jaas.AbstractLoginModule;
import org.exoplatform.web.login.InitiateLoginServlet;
-import org.exoplatform.web.security.security.CookieTokenService;
-import org.exoplatform.web.security.security.TransientTokenService;
+import org.gatein.wci.security.Credentials;
import javax.security.auth.callback.Callback;
import javax.security.auth.callback.NameCallback;
@@ -99,25 +98,23 @@
callbackHandler.handle(callbacks);
String password = new String(((PasswordCallback)callbacks[1]).getPassword());
- ExoContainer container = getContainer();
- Object o =
-
((TransientTokenService)container.getComponentInstanceOfType(TransientTokenService.class)).validateToken(
- password, true);
- if (o == null)
- o =
-
((CookieTokenService)container.getComponentInstanceOfType(CookieTokenService.class)).validateToken(
- password, false);
+ Credentials c = null;
+
//
-
// For clustered config check credentials stored and propagated in session. This
won't work in tomcat because
// of lack of JACC PolicyContext so the code must be a bit defensive
- if (o == null && getContextMethod != null &&
password.startsWith(InitiateLoginServlet.COOKIE_NAME))
+ if (getContextMethod != null &&
password.startsWith(InitiateLoginServlet.COOKIE_NAME))
{
HttpServletRequest request;
try
{
request = (HttpServletRequest)getContextMethod.invoke(null,
"javax.servlet.http.HttpServletRequest");
- o = request.getSession().getAttribute(AUTHENTICATED_CREDENTIALS);
+ Object o = request.getSession().getAttribute(AUTHENTICATED_CREDENTIALS);
+
+ if (o instanceof Credentials)
+ {
+ c = (Credentials) o;
+ }
}
catch(Throwable e)
{
@@ -125,16 +122,12 @@
log.error("LoginModule error. Turn off session credentials checking
with proper configuration option of " +
"LoginModule set to false");
}
-
}
- if (o instanceof Credentials)
+ if (c != null)
{
- Credentials wc = (Credentials)o;
-
- // Set shared state
- sharedState.put("javax.security.auth.login.name",
wc.getUsername());
- sharedState.put("javax.security.auth.login.password",
wc.getPassword());
+ sharedState.put("javax.security.auth.login.name", c.getUsername());
+ sharedState.put("javax.security.auth.login.password",
c.getPassword());
}
return true;
}
Modified:
epp/portal/branches/EPP_5_2_Branch/component/web/security/src/main/java/org/exoplatform/web/security/Token.java
===================================================================
---
epp/portal/branches/EPP_5_2_Branch/component/web/security/src/main/java/org/exoplatform/web/security/Token.java 2011-06-22
20:22:21 UTC (rev 6716)
+++
epp/portal/branches/EPP_5_2_Branch/component/web/security/src/main/java/org/exoplatform/web/security/Token.java 2011-06-22
23:50:33 UTC (rev 6717)
@@ -18,6 +18,8 @@
*/
package org.exoplatform.web.security;
+import org.gatein.wci.security.Credentials;
+
/**
* A token.
*/
Modified:
epp/portal/branches/EPP_5_2_Branch/component/web/security/src/main/java/org/exoplatform/web/security/TokenStore.java
===================================================================
---
epp/portal/branches/EPP_5_2_Branch/component/web/security/src/main/java/org/exoplatform/web/security/TokenStore.java 2011-06-22
20:22:21 UTC (rev 6716)
+++
epp/portal/branches/EPP_5_2_Branch/component/web/security/src/main/java/org/exoplatform/web/security/TokenStore.java 2011-06-22
23:50:33 UTC (rev 6717)
@@ -19,6 +19,8 @@
package org.exoplatform.web.security;
+import org.gatein.wci.security.Credentials;
+
/**
* The token store is a place where temporary tokens are held.
*
Modified:
epp/portal/branches/EPP_5_2_Branch/component/web/security/src/main/java/org/exoplatform/web/security/security/AbstractTokenService.java
===================================================================
---
epp/portal/branches/EPP_5_2_Branch/component/web/security/src/main/java/org/exoplatform/web/security/security/AbstractTokenService.java 2011-06-22
20:22:21 UTC (rev 6716)
+++
epp/portal/branches/EPP_5_2_Branch/component/web/security/src/main/java/org/exoplatform/web/security/security/AbstractTokenService.java 2011-06-22
23:50:33 UTC (rev 6717)
@@ -25,9 +25,9 @@
import org.exoplatform.management.jmx.annotations.NameTemplate;
import org.exoplatform.management.jmx.annotations.Property;
import org.exoplatform.web.login.InitiateLoginServlet;
-import org.exoplatform.web.security.Credentials;
import org.exoplatform.web.security.Token;
import org.exoplatform.web.security.TokenStore;
+import org.gatein.wci.security.Credentials;
import org.picocontainer.Startable;
import java.util.List;
Modified:
epp/portal/branches/EPP_5_2_Branch/component/web/security/src/main/java/org/exoplatform/web/security/security/CookieTokenService.java
===================================================================
---
epp/portal/branches/EPP_5_2_Branch/component/web/security/src/main/java/org/exoplatform/web/security/security/CookieTokenService.java 2011-06-22
20:22:21 UTC (rev 6716)
+++
epp/portal/branches/EPP_5_2_Branch/component/web/security/src/main/java/org/exoplatform/web/security/security/CookieTokenService.java 2011-06-22
23:50:33 UTC (rev 6717)
@@ -26,8 +26,8 @@
import org.exoplatform.commons.chromattic.SessionContext;
import org.exoplatform.container.component.ComponentPlugin;
import org.exoplatform.container.xml.InitParams;
-import org.exoplatform.web.security.Credentials;
import org.exoplatform.web.security.GateInToken;
+import org.gatein.wci.security.Credentials;
import java.util.Collection;
import java.util.Date;
Modified:
epp/portal/branches/EPP_5_2_Branch/component/web/security/src/main/java/org/exoplatform/web/security/security/TokenContainer.java
===================================================================
---
epp/portal/branches/EPP_5_2_Branch/component/web/security/src/main/java/org/exoplatform/web/security/security/TokenContainer.java 2011-06-22
20:22:21 UTC (rev 6716)
+++
epp/portal/branches/EPP_5_2_Branch/component/web/security/src/main/java/org/exoplatform/web/security/security/TokenContainer.java 2011-06-22
23:50:33 UTC (rev 6717)
@@ -21,8 +21,8 @@
import org.chromattic.api.annotations.Create;
import org.chromattic.api.annotations.PrimaryType;
import org.chromattic.api.annotations.OneToMany;
-import org.exoplatform.web.security.Credentials;
import org.exoplatform.web.security.GateInToken;
+import org.gatein.wci.security.Credentials;
import java.util.Collection;
import java.util.Date;
Modified:
epp/portal/branches/EPP_5_2_Branch/component/web/security/src/main/java/org/exoplatform/web/security/security/TokenEntry.java
===================================================================
---
epp/portal/branches/EPP_5_2_Branch/component/web/security/src/main/java/org/exoplatform/web/security/security/TokenEntry.java 2011-06-22
20:22:21 UTC (rev 6716)
+++
epp/portal/branches/EPP_5_2_Branch/component/web/security/src/main/java/org/exoplatform/web/security/security/TokenEntry.java 2011-06-22
23:50:33 UTC (rev 6717)
@@ -22,8 +22,8 @@
import org.chromattic.api.annotations.Name;
import org.chromattic.api.annotations.PrimaryType;
import org.chromattic.api.annotations.Property;
-import org.exoplatform.web.security.Credentials;
import org.exoplatform.web.security.GateInToken;
+import org.gatein.wci.security.Credentials;
import java.util.Date;
Modified:
epp/portal/branches/EPP_5_2_Branch/component/web/security/src/main/java/org/exoplatform/web/security/security/TransientTokenService.java
===================================================================
---
epp/portal/branches/EPP_5_2_Branch/component/web/security/src/main/java/org/exoplatform/web/security/security/TransientTokenService.java 2011-06-22
20:22:21 UTC (rev 6716)
+++
epp/portal/branches/EPP_5_2_Branch/component/web/security/src/main/java/org/exoplatform/web/security/security/TransientTokenService.java 2011-06-22
23:50:33 UTC (rev 6717)
@@ -20,8 +20,8 @@
package org.exoplatform.web.security.security;
import org.exoplatform.container.xml.InitParams;
-import org.exoplatform.web.security.Credentials;
import org.exoplatform.web.security.GateInToken;
+import org.gatein.wci.security.Credentials;
import java.util.concurrent.ConcurrentHashMap;
Property changes on: epp/portal/branches/EPP_5_2_Branch/examples
___________________________________________________________________
Added: svn:mergeinfo
+ /epp/portal/branches/EPP_5_1_0_GA_JBEPP-795/examples:5868
/portal/branches/branch-GTNPORTAL-1592/examples:4894
/portal/branches/branch-GTNPORTAL-1643/examples:5002,5063,5167
/portal/branches/branch-GTNPORTAL-1700/examples:5348,5402,5445
/portal/branches/branch-GTNPORTAL-1731/examples:5668
/portal/branches/branch-GTNPORTAL-1745/examples:5765
/portal/branches/branch-GTNPORTAL-1822/examples:5943
/portal/branches/branch-GTNPORTAL-1832/examples:6030,6063
/portal/trunk/examples:4891,5744,5822,5943,6168,6196,6201-6203,6205-6206
Modified:
epp/portal/branches/EPP_5_2_Branch/examples/extension/war/src/main/webapp/templates/groovy/webui/component/UIHomePagePortlet.gtmpl
===================================================================
---
epp/portal/branches/EPP_5_2_Branch/examples/extension/war/src/main/webapp/templates/groovy/webui/component/UIHomePagePortlet.gtmpl 2011-06-22
20:22:21 UTC (rev 6716)
+++
epp/portal/branches/EPP_5_2_Branch/examples/extension/war/src/main/webapp/templates/groovy/webui/component/UIHomePagePortlet.gtmpl 2011-06-22
23:50:33 UTC (rev 6717)
@@ -1,3 +1,6 @@
+<%
+ String initialURI =
_ctx.getRequestContext().getParentAppRequestContext().getRequestContextPath() +
"/private/" +
_ctx.getRequestContext().getParentAppRequestContext().getPortalOwner();
+%>
<div class="UIHomePagePortlet" id="$uicomponent.id">
<div class="TRContainer">
<div class="PortletDecoration">
Modified: epp/portal/branches/EPP_5_2_Branch/examples/portal/README.txt
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/examples/portal/README.txt 2011-06-22 20:22:21 UTC
(rev 6716)
+++ epp/portal/branches/EPP_5_2_Branch/examples/portal/README.txt 2011-06-22 23:50:33 UTC
(rev 6717)
@@ -37,6 +37,65 @@
the load order is first the gatein.ear then the sample-portal.ear and finally the
starter.ear
########################################
+# On Tomcat (tested on Tomcat 6.0.20)
+########################################
+
+We assume that you have a clean Tomcat version of GateIn: ie We assume that you have
already all the jar files of GateIn and their dependencies
+into tomcat/lib and you have the related relam name "gatein-domain" defined in
the file tomcat/conf/jaas.conf
+
+1. Add the file sample-portal.war from sample/portal/war/target/ to the tomcat/webapps
directory
+2. Add the file rest-sample-portal.war from sample/portal/rest-war/target/ to the
tomcat/webapps directory
+3. Add the folder starter from starter/war/target/ to the tomcat/webapps directory
+4. Rename the directory (unzipped folder) starter to "starter.war" (for more
details see the warning below)
+5. Add the jar file exo.portal.sample.portal.config-X.Y.Z.jar from
sample/portal/config/target/ to the tomcat/lib directory
+6. Add the jar file exo.portal.sample.portal.jar-X.Y.Z.jar from sample/portal/jar/target/
to the tomcat/lib directory
+7. Define the related realm in your file tomcat/conf/jaas.conf, as below:
+
+gatein-domain-sample-portal {
+ org.gatein.wci.security.WCILoginModule optional
+ portalContainerName="sample-portal"
+ realmName="gatein-domain-sample-portal";
+ org.exoplatform.web.security.PortalLoginModule required
+ portalContainerName="sample-portal"
+ realmName="gatein-domain-sample-portal";
+ org.exoplatform.services.security.jaas.SharedStateLoginModule required
+ portalContainerName="sample-portal"
+ realmName="gatein-domain-sample-portal";
+ org.exoplatform.services.security.j2ee.TomcatLoginModule required
+ portalContainerName="sample-portal"
+ realmName="gatein-domain-sample-portal";
+};
+8. Define the context of sample-portal by creating a file called
"sample-portal.xml" in tomcat/conf/Catalina/localhost/ with the following
content
+
+<Context path='/sample-portal' docBase='sample-portal'
debug='0' reloadable='true' crossContext='true'
privileged='true'>
+ <Logger className='org.apache.catalina.logger.SystemOutLogger'
+ prefix='localhost_portal_log.' suffix='.txt'
timestamp='true'/>
+ <Manager className='org.apache.catalina.session.PersistentManager'
saveOnRestart='false'/>
+ <Realm className='org.apache.catalina.realm.JAASRealm'
+ appName='gatein-domain-sample-portal'
+ userClassNames='org.exoplatform.services.security.jaas.UserPrincipal'
+ roleClassNames='org.exoplatform.services.security.jaas.RolePrincipal'
+ debug='0' cache='false'/>
+ <Valve className='org.apache.catalina.authenticator.FormAuthenticator'
characterEncoding='UTF-8'/></Context>
+
+9. Define the context of rest-sample-portal by creating a file called
"rest-sample-portal.xml" in tomcat/conf/Catalina/localhost/ with the following
content
+
+<Context path="/rest-sample-portal" docBase="rest-sample-portal"
reloadable="true" crossContext="false">
+
+ <Logger className='org.apache.catalina.logger.SystemOutLogger'
+ prefix='localhost_portal_log.' suffix='.txt'
timestamp='true'/>
+ <Manager className='org.apache.catalina.session.PersistentManager'
saveOnRestart='false'/>
+ <Realm className='org.apache.catalina.realm.JAASRealm'
+ appName='gatein-domain-sample-portal'
+
userClassNames="org.exoplatform.services.security.jaas.UserPrincipal"
+
roleClassNames="org.exoplatform.services.security.jaas.RolePrincipal"
+ debug='0' cache='false'/>
+</Context>
+
+WARNING: This can only work if the starter.war is the last war file to be loaded, so
don't hesitate to rename it if your war files are loaded
+following to the alphabetic order
+
+########################################
# HOW TO TEST
########################################
Modified:
epp/portal/branches/EPP_5_2_Branch/examples/portal/ear/src/main/application/META-INF/gatein-jboss-beans.xml
===================================================================
---
epp/portal/branches/EPP_5_2_Branch/examples/portal/ear/src/main/application/META-INF/gatein-jboss-beans.xml 2011-06-22
20:22:21 UTC (rev 6716)
+++
epp/portal/branches/EPP_5_2_Branch/examples/portal/ear/src/main/application/META-INF/gatein-jboss-beans.xml 2011-06-22
23:50:33 UTC (rev 6717)
@@ -2,6 +2,10 @@
<application-policy xmlns="urn:jboss:security-beans:1.0"
name="gatein-domain-sample-portal">
<authentication>
+ <login-module code="org.gatein.wci.security.WCILoginModule"
flag="optional">
+ <module-option
name="portalContainerName">sample-portal</module-option>
+ <module-option
name="realmName">gatein-domain-sample-portal</module-option>
+ </login-module>
<login-module code="org.exoplatform.web.security.PortalLoginModule"
flag="required">
<module-option
name="portalContainerName">sample-portal</module-option>
<module-option
name="realmName">gatein-domain-sample-portal</module-option>
Modified:
epp/portal/branches/EPP_5_2_Branch/examples/portal/war/src/main/webapp/WEB-INF/web.xml
===================================================================
---
epp/portal/branches/EPP_5_2_Branch/examples/portal/war/src/main/webapp/WEB-INF/web.xml 2011-06-22
20:22:21 UTC (rev 6716)
+++
epp/portal/branches/EPP_5_2_Branch/examples/portal/war/src/main/webapp/WEB-INF/web.xml 2011-06-22
23:50:33 UTC (rev 6717)
@@ -178,7 +178,7 @@
<servlet>
<servlet-name>PortalLoginController</servlet-name>
- <servlet-class>org.exoplatform.web.login.PortalLoginController</servlet-class>
+
<servlet-class>org.exoplatform.web.security.PortalLoginController</servlet-class>
</servlet>
<servlet>
<servlet-name>InitiateLoginServlet</servlet-name>
Modified:
epp/portal/branches/EPP_5_2_Branch/examples/portal/war/src/main/webapp/templates/groovy/webui/component/UIHomePagePortlet.gtmpl
===================================================================
---
epp/portal/branches/EPP_5_2_Branch/examples/portal/war/src/main/webapp/templates/groovy/webui/component/UIHomePagePortlet.gtmpl 2011-06-22
20:22:21 UTC (rev 6716)
+++
epp/portal/branches/EPP_5_2_Branch/examples/portal/war/src/main/webapp/templates/groovy/webui/component/UIHomePagePortlet.gtmpl 2011-06-22
23:50:33 UTC (rev 6717)
@@ -1,3 +1,6 @@
+<%
+ String initialURI =
_ctx.getRequestContext().getParentAppRequestContext().getRequestContextPath() +
"/private/" +
_ctx.getRequestContext().getParentAppRequestContext().getPortalOwner();
+%>
<div class="UIHomePagePortlet" id="$uicomponent.id">
<div class="TRContainer">
<div class="PortletDecoration">