Author: julien_viet
Date: 2010-01-22 08:19:17 -0500 (Fri, 22 Jan 2010)
New Revision: 1420
Modified:
portal/trunk/component/web/src/main/java/org/exoplatform/web/login/ClusteredSSOFilter.java
portal/trunk/component/web/src/main/java/org/exoplatform/web/security/PortalLoginModule.java
portal/trunk/server/jboss/patch-ear/src/main/jboss/server/default/deploy/gatein.ear/META-INF/gatein-jboss-beans.xml
portal/trunk/web/portal/src/main/webapp/WEB-INF/web.xml
Log:
activate most part of cluster config based on the cluster profile in order to simplify
configuration
Modified:
portal/trunk/component/web/src/main/java/org/exoplatform/web/login/ClusteredSSOFilter.java
===================================================================
---
portal/trunk/component/web/src/main/java/org/exoplatform/web/login/ClusteredSSOFilter.java 2010-01-22
13:01:05 UTC (rev 1419)
+++
portal/trunk/component/web/src/main/java/org/exoplatform/web/login/ClusteredSSOFilter.java 2010-01-22
13:19:17 UTC (rev 1420)
@@ -23,6 +23,7 @@
package org.exoplatform.web.login;
+import org.exoplatform.container.ExoContainer;
import org.exoplatform.container.web.AbstractFilter;
import org.exoplatform.services.security.IdentityRegistry;
import org.exoplatform.web.security.Credentials;
@@ -43,31 +44,36 @@
public void doFilter(ServletRequest request, ServletResponse response, FilterChain
chain) throws IOException, ServletException
{
+ if (ExoContainer.getProfiles().contains("cluster"))
+ {
+ HttpServletRequest httpRequest = (HttpServletRequest)request;
- HttpServletRequest httpRequest = (HttpServletRequest)request;
+ Credentials credentials =
(Credentials)httpRequest.getSession().getAttribute(PortalLoginModule.AUTHENTICATED_CREDENTIALS);
- Credentials credentials =
(Credentials)httpRequest.getSession().getAttribute(PortalLoginModule.AUTHENTICATED_CREDENTIALS);
+ // Make programatic login if authenticated credentials are present in session -
they were set in another cluster node
+ if (credentials != null && httpRequest.getRemoteUser() == null)
+ {
+ WebAuthentication pwl = new WebAuthentication();
+ pwl.login(credentials.getUsername(), credentials.getPassword());
- // Make programatic login if authenticated credentials are present in session -
they were set in another cluster node
- if (credentials != null && httpRequest.getRemoteUser() == null)
- {
- WebAuthentication pwl = new WebAuthentication();
- pwl.login(credentials.getUsername(), credentials.getPassword());
+ }
+ chain.doFilter(request, response);
+
+ // TODO:
+ // This is a workaround... without this code this attr will vanish from session
after first request - don't ask...
+ if (credentials != null && httpRequest.getSession(false) != null)
+ {
+
httpRequest.getSession(false).setAttribute(PortalLoginModule.AUTHENTICATED_CREDENTIALS,
credentials);
+ }
}
-
- chain.doFilter(request, response);
-
- // TODO:
- // This is a workaround... without this code this attr will vanish from session
after first request - don't ask...
- if (credentials != null && httpRequest.getSession(false) != null)
+ else
{
-
httpRequest.getSession(false).setAttribute(PortalLoginModule.AUTHENTICATED_CREDENTIALS,
credentials);
+ chain.doFilter(request, response);
}
}
public void destroy()
{
- //To change body of implemented methods use File | Settings | File Templates.
}
}
Modified:
portal/trunk/component/web/src/main/java/org/exoplatform/web/security/PortalLoginModule.java
===================================================================
---
portal/trunk/component/web/src/main/java/org/exoplatform/web/security/PortalLoginModule.java 2010-01-22
13:01:05 UTC (rev 1419)
+++
portal/trunk/component/web/src/main/java/org/exoplatform/web/security/PortalLoginModule.java 2010-01-22
13:19:17 UTC (rev 1420)
@@ -55,8 +55,6 @@
*/
protected Log log = ExoLogger.getLogger(PortalLoginModule.class);
- public static final String CLUSTERED_SSO = "clusteredSSO";
-
public static final String AUTHENTICATED_CREDENTIALS =
"authenticatedCredentials";
/**
@@ -101,7 +99,7 @@
{
log.error(this,e);
log.error("LoginModule error. Turn off session credentials checking
with proper configuration option of " +
- "LoginModule set to false: " + CLUSTERED_SSO);
+ "LoginModule set to false");
}
}
@@ -151,7 +149,7 @@
{
log.error(this,e);
log.error("LoginModule error. Turn off session credentials checking with
proper configuration option of " +
- "LoginModule set to false: " + CLUSTERED_SSO);
+ "LoginModule set to false");
}
}
return true;
@@ -181,15 +179,6 @@
protected boolean isClusteredSSO()
{
- if (options != null)
- {
- String optionValue = (String)options.get(CLUSTERED_SSO);
- if (optionValue != null && optionValue.length() > 0 &&
optionValue.equalsIgnoreCase("true"))
- {
- return true;
- }
- }
- return false;
+ return ExoContainer.getProfiles().contains("cluster");
}
-
}
Modified:
portal/trunk/server/jboss/patch-ear/src/main/jboss/server/default/deploy/gatein.ear/META-INF/gatein-jboss-beans.xml
===================================================================
---
portal/trunk/server/jboss/patch-ear/src/main/jboss/server/default/deploy/gatein.ear/META-INF/gatein-jboss-beans.xml 2010-01-22
13:01:05 UTC (rev 1419)
+++
portal/trunk/server/jboss/patch-ear/src/main/jboss/server/default/deploy/gatein.ear/META-INF/gatein-jboss-beans.xml 2010-01-22
13:19:17 UTC (rev 1420)
@@ -5,10 +5,6 @@
<login-module code="org.exoplatform.web.security.PortalLoginModule"
flag="required">
<module-option
name="portalContainerName">portal</module-option>
<module-option
name="realmName">gatein-domain</module-option>
- <!--Uncomment in clustered setup-->
- <!--
- <module-option name="clusteredSSO">true</module-option>
- -->
</login-module>
<login-module
code="org.exoplatform.services.security.jaas.SharedStateLoginModule"
flag="required">
<module-option
name="portalContainerName">portal</module-option>
Modified: portal/trunk/web/portal/src/main/webapp/WEB-INF/web.xml
===================================================================
--- portal/trunk/web/portal/src/main/webapp/WEB-INF/web.xml 2010-01-22 13:01:05 UTC (rev
1419)
+++ portal/trunk/web/portal/src/main/webapp/WEB-INF/web.xml 2010-01-22 13:19:17 UTC (rev
1420)
@@ -81,19 +81,16 @@
<filter-class>org.exoplatform.web.CacheUserProfileFilter</filter-class>
</filter>
- <!--Uncomment for clustered setup-->
- <!--
<filter>
<filter-name>ClusteredSSOFilter</filter-name>
<filter-class>org.exoplatform.web.login.ClusteredSSOFilter</filter-class>
</filter>
- <filter-mapping>
+ <filter-mapping>
<filter-name>ClusteredSSOFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
- -->
-
+
<filter-mapping>
<filter-name>GenericFilter</filter-name>
<url-pattern>/*</url-pattern>
Show replies by date