Author: alain_defrance
Date: 2010-10-01 04:44:53 -0400 (Fri, 01 Oct 2010)
New Revision: 4455
Added:
components/wci/branches/adf/test/core/src/main/java/org/gatein/wci/authentication/
components/wci/branches/adf/test/core/src/main/java/org/gatein/wci/authentication/AuthenticationTestCase.java
components/wci/branches/adf/wci/src/main/java/org/gatein/wci/authentication/AuthenticationListenerSupport.java
Removed:
components/wci/branches/adf/wci/src/main/java/org/gatein/wci/authentication/AbstractAuthentication.java
components/wci/branches/adf/wci/src/main/java/org/gatein/wci/authentication/Authentication.java
Modified:
components/wci/branches/adf/jetty/src/main/java/org/gatein/wci/jetty/Jetty6ServletContainerContext.java
components/wci/branches/adf/test/core/src/main/java/org/gatein/wci/container/ServletContainerContextImpl.java
components/wci/branches/adf/tomcat6/src/main/java/org/gatein/wci/tomcat/TC6ServletContainerContext.java
components/wci/branches/adf/tomcat7/src/main/java/org/gatein/wci/tomcat/TC7ServletContainerContext.java
components/wci/branches/adf/wci/src/main/java/org/gatein/wci/authentication/AuthenticationEvent.java
components/wci/branches/adf/wci/src/main/java/org/gatein/wci/authentication/AuthenticationResult.java
components/wci/branches/adf/wci/src/main/java/org/gatein/wci/authentication/GenericAuthentication.java
components/wci/branches/adf/wci/src/main/java/org/gatein/wci/authentication/GenericAuthenticationResult.java
components/wci/branches/adf/wci/src/main/java/org/gatein/wci/authentication/ProgrammaticAuthenticationResult.java
components/wci/branches/adf/wci/src/main/java/org/gatein/wci/authentication/Ticket.java
components/wci/branches/adf/wci/src/main/java/org/gatein/wci/impl/generic/GenericServletContainerContext.java
Log:
event & tests in progress
Modified:
components/wci/branches/adf/jetty/src/main/java/org/gatein/wci/jetty/Jetty6ServletContainerContext.java
===================================================================
---
components/wci/branches/adf/jetty/src/main/java/org/gatein/wci/jetty/Jetty6ServletContainerContext.java 2010-10-01
08:42:51 UTC (rev 4454)
+++
components/wci/branches/adf/jetty/src/main/java/org/gatein/wci/jetty/Jetty6ServletContainerContext.java 2010-10-01
08:44:53 UTC (rev 4455)
@@ -10,6 +10,8 @@
import javax.servlet.http.HttpServletResponse;
import org.gatein.wci.RequestDispatchCallback;
+import org.gatein.wci.authentication.AuthenticationEvent;
+import org.gatein.wci.authentication.AuthenticationListenerSupport;
import org.gatein.wci.authentication.AuthenticationResult;
import org.gatein.wci.authentication.GenericAuthentication;
import org.gatein.wci.command.CommandDispatcher;
@@ -31,6 +33,7 @@
private Container container;
private Server server;
private ContextHandlerCollection chc;
+ private AuthenticationListenerSupport listenerSupport = new
AuthenticationListenerSupport();
/** The monitored contexts. */
private final Set<String> monitoredContexts = new HashSet<String>();
@@ -63,11 +66,25 @@
}
public AuthenticationResult login(HttpServletRequest request, HttpServletResponse
response, String userName, String password) {
- return GenericAuthentication.getInstance().login(userName, password.toCharArray());
+ AuthenticationResult result = GenericAuthentication.getInstance().login(userName,
password, request, response);
+
+ //
+ listenerSupport.fireEvent(
+ AuthenticationListenerSupport.EventType.LOGIN,
+ new AuthenticationEvent(AuthenticationListenerSupport.EventType.LOGIN, request,
response, userName, password
+ ));
+
+ return result;
}
public void logout(HttpServletRequest request, HttpServletResponse response) {
GenericAuthentication.getInstance().logout(request, response);
+
+ //
+ listenerSupport.fireEvent(
+ AuthenticationListenerSupport.EventType.LOGOUT,
+ new AuthenticationEvent(AuthenticationListenerSupport.EventType.LOGOUT, request,
response
+ ));
}
Added:
components/wci/branches/adf/test/core/src/main/java/org/gatein/wci/authentication/AuthenticationTestCase.java
===================================================================
---
components/wci/branches/adf/test/core/src/main/java/org/gatein/wci/authentication/AuthenticationTestCase.java
(rev 0)
+++
components/wci/branches/adf/test/core/src/main/java/org/gatein/wci/authentication/AuthenticationTestCase.java 2010-10-01
08:44:53 UTC (rev 4455)
@@ -0,0 +1,38 @@
+/*
+* Copyright (C) 2003-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.gatein.wci.authentication;
+
+import org.jboss.unit.api.pojo.annotations.Test;
+
+/**
+ * @author <a href="mailto:alain.defrance@exoplatform.com">Alain
Defrance</a>
+ * @version $Revision$
+ */
+@Test
+public class AuthenticationTestCase {
+ @Test
+ void testTicket() {
+ TicketService tService = GenericAuthentication.TICKET_SERVICE;
+ WCICredentials credentials = new WCICredentials("foo", "bar");
+ String strTicket = tService.createTicket(credentials);
+ }
+
+
+}
Modified:
components/wci/branches/adf/test/core/src/main/java/org/gatein/wci/container/ServletContainerContextImpl.java
===================================================================
---
components/wci/branches/adf/test/core/src/main/java/org/gatein/wci/container/ServletContainerContextImpl.java 2010-10-01
08:42:51 UTC (rev 4454)
+++
components/wci/branches/adf/test/core/src/main/java/org/gatein/wci/container/ServletContainerContextImpl.java 2010-10-01
08:44:53 UTC (rev 4455)
@@ -22,6 +22,8 @@
******************************************************************************/
package org.gatein.wci.container;
+import org.gatein.wci.authentication.AuthenticationEvent;
+import org.gatein.wci.authentication.AuthenticationListenerSupport;
import org.gatein.wci.authentication.AuthenticationResult;
import org.gatein.wci.authentication.GenericAuthentication;
import org.gatein.wci.spi.ServletContainerContext;
@@ -64,11 +66,11 @@
public AuthenticationResult login(HttpServletRequest request, HttpServletResponse
response, String userName, String password)
{
- return GenericAuthentication.getInstance().login(userName,
password.toCharArray());
+ throw new UnsupportedOperationException();
}
public void logout(HttpServletRequest request, HttpServletResponse response)
{
- GenericAuthentication.getInstance().logout(request, response);
+ throw new UnsupportedOperationException();
}
}
Modified:
components/wci/branches/adf/tomcat6/src/main/java/org/gatein/wci/tomcat/TC6ServletContainerContext.java
===================================================================
---
components/wci/branches/adf/tomcat6/src/main/java/org/gatein/wci/tomcat/TC6ServletContainerContext.java 2010-10-01
08:42:51 UTC (rev 4454)
+++
components/wci/branches/adf/tomcat6/src/main/java/org/gatein/wci/tomcat/TC6ServletContainerContext.java 2010-10-01
08:44:53 UTC (rev 4455)
@@ -34,6 +34,8 @@
import org.gatein.common.logging.Logger;
import org.gatein.common.logging.LoggerFactory;
import org.gatein.wci.RequestDispatchCallback;
+import org.gatein.wci.authentication.AuthenticationEvent;
+import org.gatein.wci.authentication.AuthenticationListenerSupport;
import org.gatein.wci.authentication.AuthenticationResult;
import org.gatein.wci.authentication.GenericAuthentication;
import org.gatein.wci.command.CommandDispatcher;
@@ -74,6 +76,9 @@
/** . */
private Registration registration;
+ /** . */
+ private AuthenticationListenerSupport listenerSupport = new
AuthenticationListenerSupport();
+
public TC6ServletContainerContext(Engine engine)
{
this.engine = engine;
@@ -101,12 +106,26 @@
public AuthenticationResult login(HttpServletRequest request, HttpServletResponse
response, String userName, String password)
{
- return GenericAuthentication.getInstance().login(userName,
password.toCharArray());
+ AuthenticationResult result = GenericAuthentication.getInstance().login(userName,
password, request, response);
+
+ //
+ listenerSupport.fireEvent(
+ AuthenticationListenerSupport.EventType.LOGIN,
+ new AuthenticationEvent(AuthenticationListenerSupport.EventType.LOGIN, request,
response, userName, password
+ ));
+
+ return result;
}
public void logout(HttpServletRequest request, HttpServletResponse response)
{
GenericAuthentication.getInstance().logout(request, response);
+
+ //
+ listenerSupport.fireEvent(
+ AuthenticationListenerSupport.EventType.LOGOUT,
+ new AuthenticationEvent(AuthenticationListenerSupport.EventType.LOGOUT, request,
response
+ ));
}
public synchronized void containerEvent(ContainerEvent event)
Modified:
components/wci/branches/adf/tomcat7/src/main/java/org/gatein/wci/tomcat/TC7ServletContainerContext.java
===================================================================
---
components/wci/branches/adf/tomcat7/src/main/java/org/gatein/wci/tomcat/TC7ServletContainerContext.java 2010-10-01
08:42:51 UTC (rev 4454)
+++
components/wci/branches/adf/tomcat7/src/main/java/org/gatein/wci/tomcat/TC7ServletContainerContext.java 2010-10-01
08:44:53 UTC (rev 4455)
@@ -36,6 +36,8 @@
import org.gatein.common.logging.Logger;
import org.gatein.common.logging.LoggerFactory;
import org.gatein.wci.RequestDispatchCallback;
+import org.gatein.wci.authentication.AuthenticationEvent;
+import org.gatein.wci.authentication.AuthenticationListenerSupport;
import org.gatein.wci.authentication.AuthenticationResult;
import org.gatein.wci.authentication.ProgrammaticAuthenticationResult;
import org.gatein.wci.command.CommandDispatcher;
@@ -75,6 +77,9 @@
/** . */
private Registration registration;
+ /** . */
+ private AuthenticationListenerSupport listenerSupport = new
AuthenticationListenerSupport();
+
public TC7ServletContainerContext(Engine engine)
{
this.engine = engine;
@@ -105,6 +110,12 @@
try
{
request.login(userName, password);
+
+ //
+ listenerSupport.fireEvent(
+ AuthenticationListenerSupport.EventType.LOGIN,
+ new AuthenticationEvent(AuthenticationListenerSupport.EventType.LOGIN,
request, response, userName, password
+ ));
}
catch (ServletException e)
{
@@ -118,6 +129,12 @@
try
{
request.logout();
+
+ //
+ listenerSupport.fireEvent(
+ AuthenticationListenerSupport.EventType.LOGOUT,
+ new AuthenticationEvent(AuthenticationListenerSupport.EventType.LOGOUT,
request, response
+ ));
}
catch (ServletException e)
{
Deleted:
components/wci/branches/adf/wci/src/main/java/org/gatein/wci/authentication/AbstractAuthentication.java
===================================================================
---
components/wci/branches/adf/wci/src/main/java/org/gatein/wci/authentication/AbstractAuthentication.java 2010-10-01
08:42:51 UTC (rev 4454)
+++
components/wci/branches/adf/wci/src/main/java/org/gatein/wci/authentication/AbstractAuthentication.java 2010-10-01
08:44:53 UTC (rev 4455)
@@ -1,66 +0,0 @@
-/*
-* Copyright (C) 2003-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.gatein.wci.authentication;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * @author <a href="mailto:alain.defrance@exoplatform.com">Alain
Defrance</a>
- * @version $Revision$
- */
-public abstract class AbstractAuthentication implements Authentication
-{
- protected enum EventType
- {
- LOGIN, LOGOUT
- }
-
- private List<AuthenticationListener> authenticationListeners = new
ArrayList<AuthenticationListener>();
-
- public void addAuthenticationListener(AuthenticationListener listener)
- {
- authenticationListeners.add(listener);
- }
-
- protected List<AuthenticationListener> getAuthenticationListeners()
- {
- return authenticationListeners;
- }
-
- protected void fireEvent(EventType type, AuthenticationEvent ae)
- {
- String methodName = String.format(
- "on%1%2",
- type.toString().substring(0, 1).toUpperCase(),
- type.toString().substring(1)
- );
- for (AuthenticationListener currentListener : authenticationListeners)
- {
- try
- {
- currentListener.getClass().getMethod(methodName,
AuthenticationEvent.class).invoke(currentListener, ae);
- }
- catch (Exception ignore)
- {
- }
- }
- }
-}
Deleted:
components/wci/branches/adf/wci/src/main/java/org/gatein/wci/authentication/Authentication.java
===================================================================
---
components/wci/branches/adf/wci/src/main/java/org/gatein/wci/authentication/Authentication.java 2010-10-01
08:42:51 UTC (rev 4454)
+++
components/wci/branches/adf/wci/src/main/java/org/gatein/wci/authentication/Authentication.java 2010-10-01
08:44:53 UTC (rev 4455)
@@ -1,34 +0,0 @@
-/*
-* Copyright (C) 2003-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.gatein.wci.authentication;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-/**
- * @author <a href="mailto:alain.defrance@exoplatform.com">Alain
Defrance</a>
- * @version $Revision$
- */
-public interface Authentication
-{
- public AuthenticationResult login(String login, char[] password);
- public void logout(HttpServletRequest request, HttpServletResponse response);
- public void addAuthenticationListener(AuthenticationListener listener);
-}
Modified:
components/wci/branches/adf/wci/src/main/java/org/gatein/wci/authentication/AuthenticationEvent.java
===================================================================
---
components/wci/branches/adf/wci/src/main/java/org/gatein/wci/authentication/AuthenticationEvent.java 2010-10-01
08:42:51 UTC (rev 4454)
+++
components/wci/branches/adf/wci/src/main/java/org/gatein/wci/authentication/AuthenticationEvent.java 2010-10-01
08:44:53 UTC (rev 4455)
@@ -19,36 +19,72 @@
package org.gatein.wci.authentication;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
/**
* @author <a href="mailto:alain.defrance@exoplatform.com">Alain
Defrance</a>
* @version $Revision$
*/
public class AuthenticationEvent
{
+ private AuthenticationListenerSupport.EventType eventType;
+ private HttpServletRequest request;
+ private HttpServletResponse response;
private String username;
- private char[] password;
+ private String password;
- public AuthenticationEvent(String username, char[] password)
- {
- if (username == null)
- {
+ public AuthenticationEvent(AuthenticationListenerSupport.EventType eventType,
HttpServletRequest request, HttpServletResponse response) {
+
+ if (eventType == null) {
+ throw new IllegalArgumentException("eventType is null");
+ }
+
+ if (request == null) {
+ throw new IllegalArgumentException("request is null");
+ }
+
+ if (response == null) {
+ throw new IllegalArgumentException("response is null");
+ }
+
+ this.eventType = eventType;
+ this.request = request;
+ this.response = response;
+ }
+
+ public AuthenticationEvent(AuthenticationListenerSupport.EventType eventType,
HttpServletRequest request, HttpServletResponse response, String username, String
password) {
+ this(eventType, request, response);
+
+ if (username == null) {
throw new IllegalArgumentException("username is null");
}
- if (password == null)
- {
+
+ if (password == null) {
throw new IllegalArgumentException("password is null");
}
+
this.username = username;
this.password = password;
}
- public String getUsername()
- {
- return username;
+ public AuthenticationListenerSupport.EventType getEventType() {
+ return eventType;
}
- public char[] getPassword()
- {
- return password;
+ public HttpServletRequest getRequest() {
+ return request;
}
+
+ public HttpServletResponse getResponse() {
+ return response;
+ }
+
+ public String getUsername() {
+ return (username != null ? username: "");
+ }
+
+ public String getPassword() {
+ return (password != null ? password: "");
+ }
}
Copied:
components/wci/branches/adf/wci/src/main/java/org/gatein/wci/authentication/AuthenticationListenerSupport.java
(from rev 4383,
components/wci/branches/adf/wci/src/main/java/org/gatein/wci/authentication/AbstractAuthentication.java)
===================================================================
---
components/wci/branches/adf/wci/src/main/java/org/gatein/wci/authentication/AuthenticationListenerSupport.java
(rev 0)
+++
components/wci/branches/adf/wci/src/main/java/org/gatein/wci/authentication/AuthenticationListenerSupport.java 2010-10-01
08:44:53 UTC (rev 4455)
@@ -0,0 +1,68 @@
+/*
+* Copyright (C) 2003-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.gatein.wci.authentication;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author <a href="mailto:alain.defrance@exoplatform.com">Alain
Defrance</a>
+ * @version $Revision$
+ */
+public class AuthenticationListenerSupport
+{
+ public enum EventType
+ {
+ LOGIN, LOGOUT
+ }
+
+ private List<AuthenticationListener> authenticationListeners = new
ArrayList<AuthenticationListener>();
+
+ public void addAuthenticationListener(AuthenticationListener listener)
+ {
+ authenticationListeners.add(listener);
+ }
+
+ protected List<AuthenticationListener> getAuthenticationListeners()
+ {
+ return authenticationListeners;
+ }
+
+ public void fireEvent(EventType type, AuthenticationEvent ae)
+ {
+ String methodName = String.format(
+ "on%1%2",
+ type.toString().substring(0, 1).toUpperCase(),
+ type.toString().substring(1)
+ );
+ for (AuthenticationListener currentListener : authenticationListeners)
+ {
+ try
+ {
+ currentListener.getClass().getMethod(methodName,
AuthenticationEvent.class).invoke(currentListener, ae);
+ }
+ catch (Exception ignore)
+ {
+ }
+ }
+ }
+}
Modified:
components/wci/branches/adf/wci/src/main/java/org/gatein/wci/authentication/AuthenticationResult.java
===================================================================
---
components/wci/branches/adf/wci/src/main/java/org/gatein/wci/authentication/AuthenticationResult.java 2010-10-01
08:42:51 UTC (rev 4454)
+++
components/wci/branches/adf/wci/src/main/java/org/gatein/wci/authentication/AuthenticationResult.java 2010-10-01
08:44:53 UTC (rev 4455)
@@ -23,6 +23,6 @@
* @author <a href="mailto:alain.defrance@exoplatform.com">Alain
Defrance</a>
* @version $Revision$
*/
-public interface AuthenticationResult
+public abstract class AuthenticationResult
{
}
Modified:
components/wci/branches/adf/wci/src/main/java/org/gatein/wci/authentication/GenericAuthentication.java
===================================================================
---
components/wci/branches/adf/wci/src/main/java/org/gatein/wci/authentication/GenericAuthentication.java 2010-10-01
08:42:51 UTC (rev 4454)
+++
components/wci/branches/adf/wci/src/main/java/org/gatein/wci/authentication/GenericAuthentication.java 2010-10-01
08:44:53 UTC (rev 4455)
@@ -26,25 +26,25 @@
* @author <a href="mailto:alain.defrance@exoplatform.com">Alain
Defrance</a>
* @version $Revision$
*/
-public class GenericAuthentication extends AbstractAuthentication
+public class GenericAuthentication //extends AbstractAuthentication
{
public static final TicketService TICKET_SERVICE = new TicketService();
private static final GenericAuthentication GENERIC_AUTHENTICATION = new
GenericAuthentication();
private GenericAuthentication() {}
- public AuthenticationResult login(String login, char[] password)
+ public AuthenticationResult login(String login, String password, HttpServletRequest
request, HttpServletResponse response)
{
- String ticket = TICKET_SERVICE.createTicket(new WCICredentials(login, new
String(password)));
+ String ticket = TICKET_SERVICE.createTicket(new WCICredentials(login, password));
- fireEvent(EventType.LOGIN, new AuthenticationEvent(login, password));
+ //fireEvent(EventType.LOGIN, new AuthenticationEvent(EventType.LOGIN, request,
response, login, password));
return new GenericAuthenticationResult(ticket);
}
public void logout(HttpServletRequest request, HttpServletResponse response)
{
request.getSession().invalidate();
- fireEvent(EventType.LOGOUT, new AuthenticationEvent("", new char[1]));
+ //fireEvent(EventType.LOGOUT, new AuthenticationEvent(EventType.LOGIN, request,
response));
}
public static GenericAuthentication getInstance() {
Modified:
components/wci/branches/adf/wci/src/main/java/org/gatein/wci/authentication/GenericAuthenticationResult.java
===================================================================
---
components/wci/branches/adf/wci/src/main/java/org/gatein/wci/authentication/GenericAuthenticationResult.java 2010-10-01
08:42:51 UTC (rev 4454)
+++
components/wci/branches/adf/wci/src/main/java/org/gatein/wci/authentication/GenericAuthenticationResult.java 2010-10-01
08:44:53 UTC (rev 4455)
@@ -23,7 +23,7 @@
* @author <a href="mailto:alain.defrance@exoplatform.com">Alain
Defrance</a>
* @version $Revision$
*/
-public class GenericAuthenticationResult implements AuthenticationResult {
+public class GenericAuthenticationResult extends AuthenticationResult {
private String ticket;
public GenericAuthenticationResult(String ticket) {
Modified:
components/wci/branches/adf/wci/src/main/java/org/gatein/wci/authentication/ProgrammaticAuthenticationResult.java
===================================================================
---
components/wci/branches/adf/wci/src/main/java/org/gatein/wci/authentication/ProgrammaticAuthenticationResult.java 2010-10-01
08:42:51 UTC (rev 4454)
+++
components/wci/branches/adf/wci/src/main/java/org/gatein/wci/authentication/ProgrammaticAuthenticationResult.java 2010-10-01
08:44:53 UTC (rev 4455)
@@ -23,5 +23,5 @@
* @author <a href="mailto:alain.defrance@exoplatform.com">Alain
Defrance</a>
* @version $Revision$
*/
-public class ProgrammaticAuthenticationResult implements AuthenticationResult {
+public class ProgrammaticAuthenticationResult extends AuthenticationResult {
}
Modified:
components/wci/branches/adf/wci/src/main/java/org/gatein/wci/authentication/Ticket.java
===================================================================
---
components/wci/branches/adf/wci/src/main/java/org/gatein/wci/authentication/Ticket.java 2010-10-01
08:42:51 UTC (rev 4454)
+++
components/wci/branches/adf/wci/src/main/java/org/gatein/wci/authentication/Ticket.java 2010-10-01
08:44:53 UTC (rev 4455)
@@ -25,12 +25,6 @@
*/
public class Ticket
{
- //public static String EXPIRE_MILI = "expirationMilis";
-
- //public static String USERNAME = "userName"
-
- //public static String PASSWORD = "password";
-
/** . */
private final long expirationTimeMillis;
Modified:
components/wci/branches/adf/wci/src/main/java/org/gatein/wci/impl/generic/GenericServletContainerContext.java
===================================================================
---
components/wci/branches/adf/wci/src/main/java/org/gatein/wci/impl/generic/GenericServletContainerContext.java 2010-10-01
08:42:51 UTC (rev 4454)
+++
components/wci/branches/adf/wci/src/main/java/org/gatein/wci/impl/generic/GenericServletContainerContext.java 2010-10-01
08:44:53 UTC (rev 4455)
@@ -23,6 +23,8 @@
package org.gatein.wci.impl.generic;
import org.gatein.wci.RequestDispatchCallback;
+import org.gatein.wci.authentication.AuthenticationEvent;
+import org.gatein.wci.authentication.AuthenticationListenerSupport;
import org.gatein.wci.authentication.AuthenticationResult;
import org.gatein.wci.authentication.GenericAuthentication;
import org.gatein.wci.impl.DefaultServletContainerFactory;
@@ -54,6 +56,9 @@
private static GenericServletContainerContext instance;
private static HashMap<ServletContext, String> requestDispatchMap = new
HashMap<ServletContext, String>();
+
+ /** . */
+ private AuthenticationListenerSupport listenerSupport = new
AuthenticationListenerSupport();
public static GenericServletContainerContext getInstance()
{
@@ -132,12 +137,26 @@
public AuthenticationResult login(HttpServletRequest request, HttpServletResponse
response, String userName, String password)
{
- return GenericAuthentication.getInstance().login(userName,
password.toCharArray());
+ AuthenticationResult result = GenericAuthentication.getInstance().login(userName,
password, request, response);
+
+ //
+ listenerSupport.fireEvent(
+ AuthenticationListenerSupport.EventType.LOGIN,
+ new AuthenticationEvent(AuthenticationListenerSupport.EventType.LOGIN, request,
response, userName, password
+ ));
+
+ return result;
}
public void logout(HttpServletRequest request, HttpServletResponse response)
{
GenericAuthentication.getInstance().logout(request, response);
+
+ //
+ listenerSupport.fireEvent(
+ AuthenticationListenerSupport.EventType.LOGOUT,
+ new AuthenticationEvent(AuthenticationListenerSupport.EventType.LOGOUT, request,
response
+ ));
}
//