Author: alain_defrance
Date: 2010-09-29 10:41:48 -0400 (Wed, 29 Sep 2010)
New Revision: 4436
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/security/PortalLoginModule.java
portal/branches/wci/packaging/profiles.xml
Log:
WCI authentication in progress
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-09-29
14:30:22 UTC (rev 4435)
+++
portal/branches/wci/component/web/security/src/main/java/org/exoplatform/web/login/InitiateLoginServlet.java 2010-09-29
14:41:48 UTC (rev 4436)
@@ -26,9 +26,9 @@
import org.exoplatform.web.security.security.CookieTokenService;
import org.gatein.common.logging.Logger;
import org.gatein.common.logging.LoggerFactory;
-import org.gatein.wci.authentication.GenericAuthentication;
-import org.gatein.wci.authentication.TicketService;
-import org.gatein.wci.authentication.WCICredentials;
+import org.gatein.wci.authentication.AuthenticationResult;
+import org.gatein.wci.authentication.GenericAuthenticationResult;
+import org.gatein.wci.impl.DefaultServletContainerFactory;
import java.io.IOException;
@@ -111,14 +111,18 @@
}
else
{
- // We create a temporary token just for the login time
- TicketService ticketService = GenericAuthentication.TICKET_SERVICE;
- String ticket = ticketService.createTicket(new
WCICredentials(credentials.getUsername(), credentials.getPassword()));
- req.getSession().removeAttribute(InitiateLoginServlet.CREDENTIALS);
+ // WCI authentication
+ AuthenticationResult result =
DefaultServletContainerFactory.getInstance().getServletContainer()
+ .login(req, resp, credentials.getUsername(), credentials.getPassword());
- // Send authentication request
log.debug("Login initiated with credentials in session, performing
authentication");
- sendAuth(resp, credentials.getUsername(), ticket);
+ if (result instanceof GenericAuthenticationResult)
+ {
+ GenericAuthenticationResult genericAuthentication =
(GenericAuthenticationResult) result;
+ req.getSession().removeAttribute(InitiateLoginServlet.CREDENTIALS);
+ sendAuth(resp, credentials.getUsername(),
genericAuthentication.getTicket());
+ }
+ resp.sendRedirect(resp.encodeRedirectURL(""));
}
}
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-09-29
14:30:22 UTC (rev 4435)
+++
portal/branches/wci/component/web/security/src/main/java/org/exoplatform/web/security/PortalLoginModule.java 2010-09-29
14:41:48 UTC (rev 4436)
@@ -100,9 +100,7 @@
callbackHandler.handle(callbacks);
String password = new String(((PasswordCallback)callbacks[1]).getPassword());
- GenericAuthentication authentication = new GenericAuthentication();
- WCICredentials wciCredentials = authentication
- .login(((NameCallback)callbacks[0]).getName(), password.toCharArray());
+ WCICredentials wciCredentials =
GenericAuthentication.TICKET_SERVICE.validateToken(password, true);
Credentials c = null;
if (wciCredentials != null)
{
Modified: portal/branches/wci/packaging/profiles.xml
===================================================================
--- portal/branches/wci/packaging/profiles.xml 2010-09-29 14:30:22 UTC (rev 4435)
+++ portal/branches/wci/packaging/profiles.xml 2010-09-29 14:41:48 UTC (rev 4436)
@@ -24,25 +24,29 @@
<profile>
<id>gatein-projects</id>
<properties>
- <!--
+ <!--
Replace with the directory where uncompressed Tomcat 6 and/or JBoss 5.1 can
be found
ex: On Windows 'c:/AS'
ex: On Linux '/home/user/AS'
-->
<exo.projects.directory.dependencies>REPLACE_WITH_YOUR_OWN_DIRECTORY</exo.projects.directory.dependencies>
- <!--
+ <!--
If you want that the server is deployed always at the same place (not in
packaging/pkg/target/<server> dir)
Uncomment and Replace with the directory you prefer
-->
- <!--
+ <!--
<gatein.working.dir>REPLACE_WITH_SERVER_DIR</gatein.working.dir>
-->
<!--
Replace with the name of the directory containing Tomcat 6
- -->
+ -->
<exo.projects.app.tomcat.version>apache-tomcat-6.0.20</exo.projects.app.tomcat.version>
<!--
+ Replace with the name of the directory containing Tomcat 7
+ -->
+
<exo.projects.app.tomcat7.version>apache-tomcat-7.0.2</exo.projects.app.tomcat7.version>
+ <!--
Replace with the name of the directory containing JBoss AS 5.1
-->
<exo.projects.app.jboss.version>jboss-5.1.0.GA</exo.projects.app.jboss.version>
Show replies by date