[pal-cvs 3218] [955] set multiple username to cookie.

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2008年 6月 5日 (木) 09:23:21 JST


Revision: 955
          http://svn.sourceforge.jp/cgi-bin/viewcvs.cgi?root=pal&view=rev&rev=955
Author:   shinsuke
Date:     2008-06-05 09:23:20 +0900 (Thu, 05 Jun 2008)

Log Message:
-----------
set multiple username to cookie.

Modified Paths:
--------------
    pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/components/portal/src/java/jp/sf/pal/portal/filter/CookieTransferFilter.java


-------------- next part --------------
Modified: pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/components/portal/src/java/jp/sf/pal/portal/filter/CookieTransferFilter.java
===================================================================
--- pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/components/portal/src/java/jp/sf/pal/portal/filter/CookieTransferFilter.java	2008-06-04 23:57:19 UTC (rev 954)
+++ pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/components/portal/src/java/jp/sf/pal/portal/filter/CookieTransferFilter.java	2008-06-05 00:23:20 UTC (rev 955)
@@ -35,9 +35,8 @@
 
     protected static final String IS_TRANSFERRED = "jp.sf.pal.portal.login.TransferredInfo";
 
-    // see JSR 168 PLT.D
-    // an username and password are defined as "username" and "password".
-    // a format of transferrred.info is "<user-defined-value>=<PLT.D-value>,..".
+    // a format of transferred.info is "<user-defined-value>=<PLT.D-value>,..".
+    // Notes: an user name are defined as "username".
     protected static final String TRANSFERRED_INFO = "transferred.info";
 
     protected static final String PATH = "path";
@@ -58,8 +57,6 @@
 
     protected boolean secure = false;
 
-    protected String usernameKey;
-
     protected Map transferredInfo;
 
     public void init(FilterConfig filterConfig) throws ServletException
@@ -97,15 +94,7 @@
                 {
                     String k = pair.substring(0, index);
                     String v = pair.substring(index + 1);
-
-                    if (USERNAME.equals(v))
-                    {
-                        usernameKey = k;
-                    }
-                    else
-                    {
-                        transferredInfo.put(k, v);
-                    }
+                    transferredInfo.put(k, v);
                 }
             }
         }
@@ -125,7 +114,6 @@
     {
         path = null;
         domain = null;
-        usernameKey = null;
         transferredInfo = null;
     }
 
@@ -147,12 +135,6 @@
                             .getComponentManager().getComponent(
                                     "org.apache.jetspeed.security.UserManager");
 
-                    if (usernameKey != null)
-                    {
-                        hResponse.addCookie(createNewCookie(usernameKey,
-                                username));
-                    }
-
                     if (!transferredInfo.isEmpty())
                     {
                         try
@@ -165,14 +147,24 @@
                             while (itr.hasNext())
                             {
                                 Map.Entry entry = (Map.Entry) itr.next();
-                                String value = userAttributes
-                                        .get((String) entry.getValue(),
-                                                EMPTY_STRING);
-                                if (!value.equals(EMPTY_STRING))
+                                if (USERNAME.equals(entry.getValue()))
                                 {
                                     hResponse.addCookie(createNewCookie(
-                                            (String) entry.getKey(), value));
+                                            (String) entry.getKey(), username));
                                 }
+                                else
+                                {
+                                    String value = userAttributes.get(
+                                            (String) entry.getValue(),
+                                            EMPTY_STRING);
+                                    if (!value.equals(EMPTY_STRING))
+                                    {
+                                        hResponse
+                                                .addCookie(createNewCookie(
+                                                        (String) entry.getKey(),
+                                                        value));
+                                    }
+                                }
                             }
                         }
                         catch (SecurityException e)
@@ -195,11 +187,6 @@
                 if (checkTransferredInfo(hRequest, true))
                 {
 
-                    if (usernameKey != null)
-                    {
-                        hResponse.addCookie(createExpiredCookie(usernameKey));
-                    }
-
                     if (!transferredInfo.isEmpty())
                     {
                         Iterator itr = transferredInfo.entrySet().iterator();


pal-cvs メーリングリストの案内
Back to archive index