Author: alain_defrance
Date: 2010-10-08 10:42:10 -0400 (Fri, 08 Oct 2010)
New Revision: 4612
Modified:
portal/branches/wci/component/web/security/src/main/java/org/exoplatform/web/login/InitiateLoginServlet.java
portal/branches/wci/component/web/security/src/main/java/org/exoplatform/web/login/RememberMeFilter.java
portal/branches/wci/component/web/security/src/main/java/org/exoplatform/web/security/PortalLoginModule.java
Log:
Some bugs fixed
Modified:
portal/branches/wci/component/web/security/src/main/java/org/exoplatform/web/login/InitiateLoginServlet.java
===================================================================
---
portal/branches/wci/component/web/security/src/main/java/org/exoplatform/web/login/InitiateLoginServlet.java 2010-10-08
14:41:51 UTC (rev 4611)
+++
portal/branches/wci/component/web/security/src/main/java/org/exoplatform/web/login/InitiateLoginServlet.java 2010-10-08
14:42:10 UTC (rev 4612)
@@ -19,7 +19,6 @@
package org.exoplatform.web.login;
-import org.exoplatform.container.PortalContainer;
import org.exoplatform.container.web.AbstractHttpServlet;
import org.exoplatform.web.security.security.AbstractTokenService;
import org.exoplatform.web.security.security.CookieTokenService;
@@ -27,12 +26,12 @@
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;
@@ -105,26 +104,18 @@
}
else
{
- try
- {
- // WCI authentication
- AuthenticationResult result =
DefaultServletContainerFactory.getInstance().getServletContainer()
- .login(req, resp, credentials.getUsername(), credentials.getPassword());
+ // WCI authentication
+ AuthenticationResult result =
DefaultServletContainerFactory.getInstance().getServletContainer()
+ .login(req, resp, credentials.getUsername(), credentials.getPassword());
- log.debug("Login initiated with credentials in session, performing
authentication");
- if (result instanceof GenericAuthenticationResult)
- {
- ((GenericAuthenticationResult) result).perform(req, resp);
- }
- else
- {
- resp.sendRedirect(resp.encodeRedirectURL(""));
- }
+ log.debug("Login initiated with credentials in session, performing
authentication");
+ if (result instanceof GenericAuthenticationResult)
+ {
+ ((GenericAuthenticationResult) result).perform(req, resp);
}
- catch (Exception e)
+ else if (result instanceof ProgrammaticAuthenticationResult)
{
- // TODO : login fails
-
getServletContext().getRequestDispatcher("/portal/errorlogin").forward(req,
resp);
+
resp.sendRedirect(resp.encodeRedirectURL((String)req.getAttribute("javax.servlet.forward.request_uri")));
}
}
}
Modified:
portal/branches/wci/component/web/security/src/main/java/org/exoplatform/web/login/RememberMeFilter.java
===================================================================
---
portal/branches/wci/component/web/security/src/main/java/org/exoplatform/web/login/RememberMeFilter.java 2010-10-08
14:41:51 UTC (rev 4611)
+++
portal/branches/wci/component/web/security/src/main/java/org/exoplatform/web/login/RememberMeFilter.java 2010-10-08
14:42:10 UTC (rev 4612)
@@ -78,6 +78,7 @@
if (result instanceof GenericAuthenticationResult)
{
((GenericAuthenticationResult) result).perform(req, resp);
+ resp.sendRedirect(s);
}
else if (result instanceof ProgrammaticAuthenticationResult)
{
Modified:
portal/branches/wci/component/web/security/src/main/java/org/exoplatform/web/security/PortalLoginModule.java
===================================================================
---
portal/branches/wci/component/web/security/src/main/java/org/exoplatform/web/security/PortalLoginModule.java 2010-10-08
14:41:51 UTC (rev 4611)
+++
portal/branches/wci/component/web/security/src/main/java/org/exoplatform/web/security/PortalLoginModule.java 2010-10-08
14:42:10 UTC (rev 4612)
@@ -24,7 +24,6 @@
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.gatein.wci.security.Credentials;
import javax.security.auth.callback.Callback;
Show replies by date