portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a..@apache.org
Subject svn commit: r691921 - in /portals/jetspeed-2/portal/branches/security-refactoring: components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/ jetspeed-api/src/main/java/org/apache/jetspeed/security/
Date Thu, 04 Sep 2008 08:18:01 GMT
Author: ate
Date: Thu Sep  4 01:18:01 2008
New Revision: 691921

URL: http://svn.apache.org/viewvc?rev=691921&view=rev
Log:
Generalize the Portlet API USER_INFO functionality for all JetspeedPrincipal types by providing
a readonly Map<String,String> getInfoMap()  of the SecurityAttributes.INFO_CATEGORY
attributes.

Modified:
    portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/BaseJetspeedPrincipal.java
    portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/SecurityAttributesImpl.java
    portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/UserImpl.java
    portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/JetspeedPrincipal.java
    portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/SecurityAttributes.java
    portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/User.java

Modified: portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/BaseJetspeedPrincipal.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/BaseJetspeedPrincipal.java?rev=691921&r1=691920&r2=691921&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/BaseJetspeedPrincipal.java
(original)
+++ portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/BaseJetspeedPrincipal.java
Thu Sep  4 01:18:01 2008
@@ -21,6 +21,7 @@
 import java.sql.Timestamp;
 import java.util.ArrayList;
 import java.util.Collection;
+import java.util.Map;
 
 import org.apache.jetspeed.security.JetspeedPrincipal;
 import org.apache.jetspeed.security.JetspeedPrincipalManagerProvider;
@@ -172,6 +173,11 @@
         return attributes;
     }
     
+    public Map<String, String> getInfoMap()
+    {
+        return getSecurityAttributes().getInfoMap();
+    }
+    
     /// OJB PersistenceBrokerAware interface implementation
 
     public void afterDelete(PersistenceBroker pb) throws PersistenceBrokerException

Modified: portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/SecurityAttributesImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/SecurityAttributesImpl.java?rev=691921&r1=691920&r2=691921&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/SecurityAttributesImpl.java
(original)
+++ portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/SecurityAttributesImpl.java
Thu Sep  4 01:18:01 2008
@@ -137,6 +137,19 @@
     {
         return getAttributeMap(INFO_CATEGORY);
     }
+    
+    public Map<String, String> getInfoMap()
+    {
+        HashMap<String, String> map = new HashMap<String,String>(saMap.size());
+        for (SecurityAttribute sa : saMap.values())
+        {
+            if (sa.getCategory().equals(INFO_CATEGORY))
+            {
+                map.put(sa.getName(), sa.getStringValue());
+            }
+        }
+        return Collections.unmodifiableMap(map);
+    }
 
     public SecurityAttribute getAttribute(String name)
     {

Modified: portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/UserImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/UserImpl.java?rev=691921&r1=691920&r2=691921&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/UserImpl.java
(original)
+++ portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/UserImpl.java
Thu Sep  4 01:18:01 2008
@@ -16,14 +16,13 @@
  */
 package org.apache.jetspeed.security.impl;
 
-import java.util.Iterator;
+import java.util.Collections;
 import java.util.Map;
 import java.util.HashMap;
 
 import javax.security.auth.Subject;
 
 import org.apache.jetspeed.security.SecurityAttribute;
-import org.apache.jetspeed.security.SecurityAttributes;
 import org.apache.jetspeed.security.User;
 
 /**
@@ -52,18 +51,4 @@
     {
         this.subject = subject;
     }
-
-    public Map<String, String> getUserInfo()
-    {
-        Map<String, String> userInfo = new HashMap<String, String>();
-        Map<String, SecurityAttribute> infoAttrMap = getSecurityAttributes().getInfoAttributeMap();
-        
-        for (Map.Entry entry : infoAttrMap.entrySet())
-        {
-            userInfo.put((String) entry.getKey(), ((SecurityAttribute) entry.getValue()).getStringValue());
-        }
-            
-        return userInfo;
-    }
-    
 }

Modified: portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/JetspeedPrincipal.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/JetspeedPrincipal.java?rev=691921&r1=691920&r2=691921&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/JetspeedPrincipal.java
(original)
+++ portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/JetspeedPrincipal.java
Thu Sep  4 01:18:01 2008
@@ -17,6 +17,7 @@
 package org.apache.jetspeed.security;
 
 import java.sql.Timestamp;
+import java.util.Map;
 
 /**
  * @version $Id$
@@ -46,4 +47,9 @@
     boolean isExtendable(); // true if adding associations, permissions and attributes is
allowed
 
     SecurityAttributes getSecurityAttributes();
+    
+    /**
+     * @return an unmodifiable Map<String,String> of the SecurityAttributes.INFO_CATEGORY
SecurityAttributes
+     */
+    Map<String, String> getInfoMap();
 }

Modified: portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/SecurityAttributes.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/SecurityAttributes.java?rev=691921&r1=691920&r2=691921&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/SecurityAttributes.java
(original)
+++ portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/SecurityAttributes.java
Thu Sep  4 01:18:01 2008
@@ -46,6 +46,11 @@
     
     Map<String, SecurityAttribute> getInfoAttributeMap();
 
+    /**
+     * @return an unmodifiable Map<String,String> of the SecurityAttributes.INFO_CATEGORY
SecurityAttributes
+     */
+    Map<String, String> getInfoMap();
+
     SecurityAttribute getAttribute(String name);
 
     /**

Modified: portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/User.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/User.java?rev=691921&r1=691920&r2=691921&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/User.java
(original)
+++ portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/User.java
Thu Sep  4 01:18:01 2008
@@ -16,8 +16,6 @@
  */
 package org.apache.jetspeed.security;
 
-import java.util.Map;
-
 import javax.security.auth.Subject;
 
 /**
@@ -45,11 +43,4 @@
      * @param subject The {@link Subject}.
      */
     void setSubject(Subject subject);
-
-    /**
-     * Get the Portlet API User Attributes for a given user
-     * @return a READ ONLY set of user attributes for a given user
-     */
-    Map<String, String> getUserInfo();
-    
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org


Mime
View raw message