[gatein-commits] gatein SVN: r4589 - in components/wci/branches/adf/wci/src/main/java/org/gatein/wci: impl and 1 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Thu Oct 7 10:42:11 EDT 2010


Author: alain_defrance
Date: 2010-10-07 10:42:11 -0400 (Thu, 07 Oct 2010)
New Revision: 4589

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/GenericAuthenticationResult.java
   components/wci/branches/adf/wci/src/main/java/org/gatein/wci/impl/DefaultServletContainer.java
   components/wci/branches/adf/wci/src/main/java/org/gatein/wci/security/WCILoginController.java
Log:
Some changes related to events

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-07 13:02:46 UTC (rev 4588)
+++ components/wci/branches/adf/wci/src/main/java/org/gatein/wci/authentication/AuthenticationEvent.java	2010-10-07 14:42:11 UTC (rev 4589)
@@ -19,6 +19,8 @@
 
 package org.gatein.wci.authentication;
 
+import org.gatein.wci.security.Credentials;
+
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
@@ -30,8 +32,7 @@
 {
    private final HttpServletRequest request;
    private final HttpServletResponse response;
-   private final String username;
-   private final String password;
+   private final Credentials credentials;
 
    public AuthenticationEvent(HttpServletRequest request, HttpServletResponse response)
    {
@@ -48,11 +49,10 @@
 
       this.request = request;
       this.response = response;
-      this.username = null;
-      this.password = null;
+      this.credentials = null;
   }
 
-   public AuthenticationEvent(HttpServletRequest request, HttpServletResponse response, String username, String password)
+   public AuthenticationEvent(HttpServletRequest request, HttpServletResponse response, Credentials credentials)
    {
 
       if (request == null)
@@ -65,20 +65,14 @@
          throw new IllegalArgumentException("response is null");
       }
 
-      if (username == null)
+      if (credentials == null)
       {
-         throw new IllegalArgumentException("username is null");
+         throw new IllegalArgumentException("credentials is null");
       }
 
-      if (password == null)
-      {
-         throw new IllegalArgumentException("password is null");
-      }
-
       this.request = request;
       this.response = response;
-      this.username = username;
-      this.password = password;
+      this.credentials = credentials;
    }
 
    public HttpServletRequest getRequest()
@@ -91,13 +85,8 @@
       return response;
    }
 
-   public String getUsername()
+   public Credentials getCredentials()
    {
-      return (username != null ? username: "");
+      return credentials;
    }
-
-   public String getPassword()
-   {
-      return (password != null ? password: "");
-   }
 }

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-07 13:02:46 UTC (rev 4588)
+++ components/wci/branches/adf/wci/src/main/java/org/gatein/wci/authentication/GenericAuthenticationResult.java	2010-10-07 14:42:11 UTC (rev 4589)
@@ -56,7 +56,7 @@
       Object o = DefaultServletContainerFactory.getInstance().getServletContainer();
       if (o instanceof DefaultServletContainer)
       {
-        ((DefaultServletContainer)o).fireEvent(DefaultServletContainer.EventType.LOGIN, new AuthenticationEvent(req, resp, username, ticket));  
+        ((DefaultServletContainer)o).fireEvent(DefaultServletContainer.EventType.LOGIN, new AuthenticationEvent(req, resp, new Credentials(username, ticket)));  
       }
    }
 }

Modified: components/wci/branches/adf/wci/src/main/java/org/gatein/wci/impl/DefaultServletContainer.java
===================================================================
--- components/wci/branches/adf/wci/src/main/java/org/gatein/wci/impl/DefaultServletContainer.java	2010-10-07 13:02:46 UTC (rev 4588)
+++ components/wci/branches/adf/wci/src/main/java/org/gatein/wci/impl/DefaultServletContainer.java	2010-10-07 14:42:11 UTC (rev 4589)
@@ -25,8 +25,8 @@
 import org.gatein.wci.authentication.AuthenticationEvent;
 import org.gatein.wci.authentication.AuthenticationListener;
 import org.gatein.wci.authentication.AuthenticationResult;
-import org.gatein.wci.authentication.GenericAuthentication;
 import org.gatein.wci.authentication.GenericAuthenticationResult;
+import org.gatein.wci.security.Credentials;
 import org.gatein.wci.spi.ServletContainerContext;
 import org.gatein.wci.spi.WebAppContext;
 import org.gatein.wci.WebAppListener;
@@ -106,7 +106,7 @@
       //
       if (!(result instanceof GenericAuthenticationResult))
       {
-         fireEvent(EventType.LOGIN, new AuthenticationEvent(request, response, userName, password));
+         fireEvent(EventType.LOGIN, new AuthenticationEvent(request, response, new Credentials(userName, password)));
       }
 
       return result;

Modified: components/wci/branches/adf/wci/src/main/java/org/gatein/wci/security/WCILoginController.java
===================================================================
--- components/wci/branches/adf/wci/src/main/java/org/gatein/wci/security/WCILoginController.java	2010-10-07 13:02:46 UTC (rev 4588)
+++ components/wci/branches/adf/wci/src/main/java/org/gatein/wci/security/WCILoginController.java	2010-10-07 14:42:11 UTC (rev 4589)
@@ -27,6 +27,7 @@
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
+import java.lang.reflect.Field;
 
 /**
  * @author <a href="mailto:alain.defrance at exoplatform.com">Alain Defrance</a>
@@ -37,6 +38,9 @@
    /** . */
    private static final Logger log = LoggerFactory.getLogger(WCILoginController.class);
 
+   /** . */
+   protected Credentials credentials;
+
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException
    {
       String username = req.getParameter("username");
@@ -58,29 +62,13 @@
 
       //
       log.debug("Found username and password and set credentials in http session");
-      Credentials credentials = new Credentials(username, password);
+      credentials = new Credentials(username, password);
       req.getSession().setAttribute(Credentials.CREDENTIALS, credentials);
-
-      // Obtain initial URI
-      String uri = req.getParameter("initialURI");
-
-      // otherwise compute one
-      if (uri == null || uri.length() == 0)
-      {
-         uri = req.getContextPath() + "/private/classic";
-         log.debug("No initial URI found, will use default " + uri + " instead ");
-      }
-      else
-      {
-         log.debug("Found initial URI " + uri);
-      }
-
-      //
-      resp.sendRedirect(uri);
    }
 
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException
    {
       doGet(req, resp);
+      Field f;
    }
 }



More information about the gatein-commits mailing list