[jboss-svn-commits] JBL Code SVN: r35499 - in labs/jbossforums/branches/forums130P27: authz-jaae-plugin and 20 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Wed Oct 13 03:47:27 EDT 2010


Author: sviluppatorefico
Date: 2010-10-13 03:47:25 -0400 (Wed, 13 Oct 2010)
New Revision: 35499

Added:
   labs/jbossforums/branches/forums130P27/authz-jaae-plugin/src/main/
   labs/jbossforums/branches/forums130P27/authz-jaae-plugin/src/main/org/
   labs/jbossforums/branches/forums130P27/authz-jaae-plugin/src/main/org/jboss/
   labs/jbossforums/branches/forums130P27/authz-jaae-plugin/src/main/org/jboss/forums/
   labs/jbossforums/branches/forums130P27/authz-jaae-plugin/src/main/org/jboss/forums/security/
   labs/jbossforums/branches/forums130P27/authz-jaae-plugin/src/main/org/jboss/forums/security/AuthorizationProvider.java
   labs/jbossforums/branches/forums130P27/authz-jaae-plugin/src/main/org/jboss/forums/security/JBossPortalUtil.java
   labs/jbossforums/branches/forums130P27/authz-jaae-plugin/src/main/org/jboss/forums/security/jbportal/
   labs/jbossforums/branches/forums130P27/authz-jaae-plugin/src/main/org/jboss/forums/security/jbportal/MembershipModulePortal.java
   labs/jbossforums/branches/forums130P27/authz-jaae-plugin/src/main/org/jboss/forums/security/jbportal/RolePortal.java
   labs/jbossforums/branches/forums130P27/authz-jaae-plugin/src/main/org/jboss/forums/security/jbportal/UserModulePortal.java
   labs/jbossforums/branches/forums130P27/authz-jaae-plugin/src/main/org/jboss/forums/security/jbportal/UserPortal.java
   labs/jbossforums/branches/forums130P27/authz-jaae-plugin/src/main/org/jboss/forums/security/jbportal/UserProfileModulePortal.java
   labs/jbossforums/branches/forums130P27/authz-jaae-plugin/src/main/org/jboss/forums/security/picketlink/
   labs/jbossforums/branches/forums130P27/authz-jaae-plugin/src/main/org/jboss/forums/security/picketlink/MembershipModulePL.java
   labs/jbossforums/branches/forums130P27/authz-jaae-plugin/src/main/org/jboss/forums/security/picketlink/RolePL.java
   labs/jbossforums/branches/forums130P27/authz-jaae-plugin/src/main/org/jboss/forums/security/picketlink/UserModulePL.java
   labs/jbossforums/branches/forums130P27/authz-jaae-plugin/src/main/org/jboss/forums/security/picketlink/UserPL.java
   labs/jbossforums/branches/forums130P27/authz-jaae-plugin/src/main/org/jboss/forums/security/picketlink/UserProfileModulePL.java
   labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/auth/jbportal/
   labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/auth/jbportal/MembershipModulePortal.java
   labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/auth/jbportal/RolePortal.java
   labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/auth/jbportal/UserModulePortal.java
   labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/auth/jbportal/UserPortal.java
   labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/auth/jbportal/UserProfileModulePortal.java
   labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/auth/picketlink/
   labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/auth/picketlink/MembershipModulePL.java
   labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/auth/picketlink/RolePL.java
   labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/auth/picketlink/UserModulePL.java
   labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/auth/picketlink/UserPL.java
   labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/auth/picketlink/UserProfileModulePL.java
   labs/jbossforums/branches/forums130P27/thirdparty/picketlink/
   labs/jbossforums/branches/forums130P27/thirdparty/picketlink/README.txt
   labs/jbossforums/branches/forums130P27/thirdparty/picketlink/lib/
   labs/jbossforums/branches/forums130P27/thirdparty/picketlink/lib/picketlink-idm-1.1.5.CR01.jar
Modified:
   labs/jbossforums/branches/forums130P27/.classpath
   labs/jbossforums/branches/forums130P27/authz-jaae-plugin/build.xml
   labs/jbossforums/branches/forums130P27/forums/build.xml
   labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/PortalUtil.java
   labs/jbossforums/branches/forums130P27/forums/src/resources/portal-forums-ear/META-INF/application.xml
   labs/jbossforums/branches/forums130P27/forums/src/resources/portal-forums-ear/META-INF/security-config.xml
   labs/jbossforums/branches/forums130P27/forums/src/resources/portal-forums-ha-as5-ear/META-INF/application.xml
   labs/jbossforums/branches/forums130P27/forums/src/resources/portal-forums-ha-as5-ear/META-INF/security-config.xml
   labs/jbossforums/branches/forums130P27/forums/src/resources/portal-forums-ha-ear/META-INF/application.xml
   labs/jbossforums/branches/forums130P27/forums/src/resources/portal-forums-ha-ear/META-INF/security-config.xml
   labs/jbossforums/branches/forums130P27/tools/etc/buildfragments/libraries.ent
Log:
picketlink integration

Modified: labs/jbossforums/branches/forums130P27/.classpath
===================================================================
--- labs/jbossforums/branches/forums130P27/.classpath	2010-10-13 07:46:05 UTC (rev 35498)
+++ labs/jbossforums/branches/forums130P27/.classpath	2010-10-13 07:47:25 UTC (rev 35499)
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <classpath>
+	<classpathentry kind="src" path="cache-plugin/src/main"/>
 	<classpathentry kind="src" path="authz-jaae-plugin/src/main"/>
-	<classpathentry kind="src" path="cache-plugin/src/main"/>
 	<classpathentry kind="src" path="forums/src/main"/>
 	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
 	<classpathentry kind="lib" path="thirdparty/jbportal/lib/portal-core-lib.jar"/>
@@ -49,5 +49,6 @@
 	<classpathentry kind="lib" path="thirdparty/beanshell/lib/bsh.jar"/>
 	<classpathentry kind="lib" path="thirdparty/jboss-hibernate/lib/hibernate-entitymanager.jar"/>
 	<classpathentry kind="lib" path="thirdparty/jboss-hibernate/lib/hibernate-annotations.jar"/>
+	<classpathentry kind="lib" path="thirdparty/picketlink/lib/picketlink-idm-1.1.5.CR01.jar"/>
 	<classpathentry kind="output" path="bin"/>
 </classpath>

Modified: labs/jbossforums/branches/forums130P27/authz-jaae-plugin/build.xml
===================================================================
--- labs/jbossforums/branches/forums130P27/authz-jaae-plugin/build.xml	2010-10-13 07:46:05 UTC (rev 35498)
+++ labs/jbossforums/branches/forums130P27/authz-jaae-plugin/build.xml	2010-10-13 07:47:25 UTC (rev 35499)
@@ -69,8 +69,9 @@
       <call target="configure-libraries"/>
 		<path id="library.classpath">
 			<path refid="sun.jsf.classpath"/>			
-			<path refid="jbportal.classpath"/>				        
-			<path refid="jboss-jaae-engine.classpath"/>
+			<path refid="jbportal.classpath"/>			        
+			<path refid="jboss-jaae-engine.classpath"/>			        
+			<path refid="picketlink.classpath"/>
 			<path refid="jakarta-commons-jexl.classpath"/>	
 			<path refid="jboss.j2ee.classpath"/>	
 		</path>
@@ -159,6 +160,8 @@
 		<fileset dir="${jakarta-commons-jexl.lib}" includes="*.jar"/>
 		<!-- include jaae libs -->
 		<fileset dir="${jboss-jaae-engine.lib}" includes="*.jar"/>
+		<!-- include picketlink libs -->
+		<fileset dir="${picketlink.lib}" includes="*.jar"/>
 		<!-- sar configuration files -->
 		<fileset dir="${build.resources}/forums-authz-plugin.sar"/>
       </jar>    

Added: labs/jbossforums/branches/forums130P27/authz-jaae-plugin/src/main/org/jboss/forums/security/AuthorizationProvider.java
===================================================================
--- labs/jbossforums/branches/forums130P27/authz-jaae-plugin/src/main/org/jboss/forums/security/AuthorizationProvider.java	                        (rev 0)
+++ labs/jbossforums/branches/forums130P27/authz-jaae-plugin/src/main/org/jboss/forums/security/AuthorizationProvider.java	2010-10-13 07:47:25 UTC (rev 35499)
@@ -0,0 +1,103 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat                                               *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual                    *
+ * contributors as indicated by the @authors tag. See the                     *
+ * copyright.txt in the distribution for a full listing of                    *
+ * individual contributors.                                                   *
+ *                                                                            *
+ * 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.jboss.forums.security;
+
+
+//portal forums related
+import org.jboss.portlet.forums.auth.AuthorizationInterface;
+import org.jboss.portlet.forums.auth.JSFActionContext;
+import org.jboss.portlet.forums.auth.JSFUIContext;
+import org.jboss.portlet.forums.auth.SecurityContext;
+import org.jboss.security.acl.AccessDenied;
+import org.jboss.security.acl.AclProcessor;
+import org.jboss.security.acl.User;
+import org.jboss.security.acl.UserThreadLocal;
+
+/*
+ * Created on May 18, 2006
+ *
+ * @author <a href="mailto:sohil.shah at jboss.com">Sohil Shah</a>
+ */
+public class AuthorizationProvider implements AuthorizationInterface
+{
+    /**
+     * 
+     */
+    public AuthorizationProvider()
+    {        
+    }
+    
+    /**
+     * 
+     *
+     */
+    public boolean hasAccess(SecurityContext context)
+    {
+        boolean hasAccess = true;     
+        try
+        {
+	        //setup the engine identity based on identity provided in the security context
+            if(context.getIdentity()!=null)
+            {
+                User user = User.getUser(((org.jboss.portal.identity.User)context.getIdentity()).getUserName());
+                JBossPortalUtil.populateRoles(user);
+                UserThreadLocal.setUser(user);
+            }
+            else
+            {
+                //set an anonymous user
+                UserThreadLocal.setUser(new User());
+            }
+	        
+	        if(context instanceof JSFActionContext)
+	        {
+	            JSFActionContext securityContext = (JSFActionContext)context;
+	            
+		        //send this to the engine for access control decision
+		        AclProcessor.getInstance().processJSFActionAccess(
+		        securityContext.getFacesContext(),
+		        securityContext.getManagedBean(),
+		        securityContext.getBusinessAction());
+	        }
+	        else if(context instanceof JSFUIContext)
+	        {
+	            JSFUIContext securityContext = (JSFUIContext)context;
+	            
+		        //send this to the engine for access control decision
+		        AclProcessor.getInstance().processFragmentAccess(securityContext.getFragment(),securityContext.getContextData());		        
+	        }
+        }
+        catch(AccessDenied ade)
+        {
+            hasAccess = false;
+        }
+        catch(Exception e)
+        {
+            throw new RuntimeException(e);
+        }
+        
+        return hasAccess;
+    }
+    
+    
+}


Property changes on: labs/jbossforums/branches/forums130P27/authz-jaae-plugin/src/main/org/jboss/forums/security/AuthorizationProvider.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: labs/jbossforums/branches/forums130P27/authz-jaae-plugin/src/main/org/jboss/forums/security/JBossPortalUtil.java
===================================================================
--- labs/jbossforums/branches/forums130P27/authz-jaae-plugin/src/main/org/jboss/forums/security/JBossPortalUtil.java	                        (rev 0)
+++ labs/jbossforums/branches/forums130P27/authz-jaae-plugin/src/main/org/jboss/forums/security/JBossPortalUtil.java	2010-10-13 07:47:25 UTC (rev 35499)
@@ -0,0 +1,144 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat                                               *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual                    *
+ * contributors as indicated by the @authors tag. See the                     *
+ * copyright.txt in the distribution for a full listing of                    *
+ * individual contributors.                                                   *
+ *                                                                            *
+ * 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.jboss.forums.security;
+
+//core java
+import java.util.Iterator;
+import java.util.Set;
+
+import javax.naming.InitialContext;
+import javax.naming.NameNotFoundException;
+import javax.transaction.SystemException;
+import javax.transaction.UserTransaction;
+
+import org.jboss.forums.security.jbportal.MembershipModulePortal;
+import org.jboss.forums.security.jbportal.UserModulePortal;
+import org.jboss.forums.security.jbportal.UserProfileModulePortal;
+import org.jboss.forums.security.picketlink.MembershipModulePL;
+import org.jboss.forums.security.picketlink.UserModulePL;
+import org.jboss.forums.security.picketlink.UserProfileModulePL;
+import org.jboss.portal.identity.MembershipModule;
+import org.jboss.portal.identity.UserModule;
+import org.jboss.portal.identity.UserProfileModule;
+import org.jboss.security.acl.Role;
+import org.jboss.security.acl.User;
+import org.jboss.security.util.Util;
+
+
+/**
+ * 
+ * @author Sohil Shah - sohil.shah at jboss.com
+ *
+ */
+public class JBossPortalUtil 
+{
+    
+    
+    /**
+     * 
+     * @return
+     * @throws Exception
+     */
+    private static MembershipModule getMembershipModule() throws Exception
+    {
+    	MembershipModule membershipModule = null;
+		try {
+			membershipModule = MembershipModulePortal.getInstance();
+		} catch (NameNotFoundException nnfe) {
+			membershipModule = MembershipModulePL.getInstance();
+		}
+		return membershipModule;
+    }
+    
+    /**
+     * 
+     * @return
+     * @throws Exception
+     */
+    private static UserModule getUserModule() throws Exception
+    {
+    	UserModule userModule = null;
+		try {
+			userModule = UserModulePortal.getInstance();
+		} catch (NameNotFoundException nnfe) {
+			userModule = UserModulePL.getInstance();
+		}
+		return userModule;
+    }
+    
+    /**
+     * 
+     * @return
+     * @throws Exception
+     */
+	private static UserProfileModule getUserProfileModule() throws Exception {
+		UserProfileModule userProfileModule = null;
+		try {
+			userProfileModule = UserProfileModulePortal.getInstance();
+		} catch (NameNotFoundException nnfe) {
+			userProfileModule = UserProfileModulePL.getInstance();
+		}
+		return userProfileModule;
+	}
+        
+    /**
+     * 
+     * @param user
+     * @throws Exception
+     */
+    public static void populateRoles(User user) throws Exception
+    {        
+        InitialContext initialContext = new InitialContext();
+                
+        //perform this operation in the context of a JTA Transaction
+		UserTransaction ut = (UserTransaction) initialContext
+		.lookup("/UserTransaction");
+        if(user!=null && user.getIdentity()!=null)
+        {            
+            UserModule userModule = JBossPortalUtil.getUserModule();
+            try {
+               ut.begin();
+               //grab the roles for this user
+               String username = user.getIdentity().getUserName();            
+               org.jboss.portal.identity.User portalUser = userModule.findUserByUserName(username);
+               Set roles = getMembershipModule().getRoles(portalUser);
+               if(!Util.isEmpty(roles))
+               {
+                   for(Iterator itr=roles.iterator();itr.hasNext();)
+                   {
+                       String roleName = ((org.jboss.portal.identity.Role)itr.next()).getName();
+                       Role role = new Role(roleName,roleName);
+                       user.getRoles().add(role);
+                   }
+               }
+               ut.commit();
+            } catch (Exception e) {
+ 			   try {
+ 			      ut.rollback();
+ 			   } catch (SystemException se) {
+ 				  se.printStackTrace();
+ 			   }
+            }
+        }                
+    }
+}


Property changes on: labs/jbossforums/branches/forums130P27/authz-jaae-plugin/src/main/org/jboss/forums/security/JBossPortalUtil.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: labs/jbossforums/branches/forums130P27/authz-jaae-plugin/src/main/org/jboss/forums/security/jbportal/MembershipModulePortal.java
===================================================================
--- labs/jbossforums/branches/forums130P27/authz-jaae-plugin/src/main/org/jboss/forums/security/jbportal/MembershipModulePortal.java	                        (rev 0)
+++ labs/jbossforums/branches/forums130P27/authz-jaae-plugin/src/main/org/jboss/forums/security/jbportal/MembershipModulePortal.java	2010-10-13 07:47:25 UTC (rev 35499)
@@ -0,0 +1,62 @@
+package org.jboss.forums.security.jbportal;
+
+import java.util.Set;
+
+import javax.naming.InitialContext;
+
+import org.jboss.portal.identity.IdentityException;
+import org.jboss.portal.identity.MembershipModule;
+import org.jboss.portal.identity.Role;
+import org.jboss.portal.identity.User;
+
+public class MembershipModulePortal implements MembershipModule {
+	private static final String MEMBERSHIP_MODULE_JNDI_NAME = "java:portal/MembershipModule";
+
+	private org.jboss.portal.identity.MembershipModule portalModule;
+
+	private static MembershipModule currentInstance;
+
+	public MembershipModulePortal() throws Exception {
+		InitialContext ctx = new InitialContext();
+		portalModule = (org.jboss.portal.identity.MembershipModule) ctx
+					.lookup(MEMBERSHIP_MODULE_JNDI_NAME);
+	}
+
+	static public MembershipModule getInstance() throws Exception {
+		if (currentInstance == null)
+			currentInstance = new MembershipModulePortal();
+
+		return currentInstance;
+	}
+
+	@Override
+	public void assignRoles(User arg0, Set arg1) throws IdentityException,
+			IllegalArgumentException {
+			portalModule.assignRoles(arg0, arg1);
+	}
+
+	@Override
+	public void assignUsers(Role arg0, Set arg1) throws IdentityException,
+			IllegalArgumentException {
+			portalModule.assignUsers(arg0, arg1);
+	}
+
+	@Override
+	public Set findRoleMembers(String arg0, int arg1, int arg2, String arg3)
+			throws IdentityException, IllegalArgumentException {
+			return portalModule.findRoleMembers(arg0, arg1, arg2, arg3);
+	}
+
+	@Override
+	public Set getRoles(User arg0) throws IdentityException,
+			IllegalArgumentException {
+			return portalModule.getRoles(arg0);
+	}
+
+	@Override
+	public Set getUsers(Role arg0) throws IdentityException,
+			IllegalArgumentException {
+			return portalModule.getUsers(arg0);
+	}
+
+}


Property changes on: labs/jbossforums/branches/forums130P27/authz-jaae-plugin/src/main/org/jboss/forums/security/jbportal/MembershipModulePortal.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: labs/jbossforums/branches/forums130P27/authz-jaae-plugin/src/main/org/jboss/forums/security/jbportal/RolePortal.java
===================================================================
--- labs/jbossforums/branches/forums130P27/authz-jaae-plugin/src/main/org/jboss/forums/security/jbportal/RolePortal.java	                        (rev 0)
+++ labs/jbossforums/branches/forums130P27/authz-jaae-plugin/src/main/org/jboss/forums/security/jbportal/RolePortal.java	2010-10-13 07:47:25 UTC (rev 35499)
@@ -0,0 +1,31 @@
+package org.jboss.forums.security.jbportal;
+
+import org.jboss.portal.identity.Role;
+
+public class RolePortal implements Role {
+
+	@Override
+	public String getDisplayName() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public Object getId() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public String getName() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public void setDisplayName(String arg0) {
+		// TODO Auto-generated method stub
+		
+	}
+
+}


Property changes on: labs/jbossforums/branches/forums130P27/authz-jaae-plugin/src/main/org/jboss/forums/security/jbportal/RolePortal.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: labs/jbossforums/branches/forums130P27/authz-jaae-plugin/src/main/org/jboss/forums/security/jbportal/UserModulePortal.java
===================================================================
--- labs/jbossforums/branches/forums130P27/authz-jaae-plugin/src/main/org/jboss/forums/security/jbportal/UserModulePortal.java	                        (rev 0)
+++ labs/jbossforums/branches/forums130P27/authz-jaae-plugin/src/main/org/jboss/forums/security/jbportal/UserModulePortal.java	2010-10-13 07:47:25 UTC (rev 35499)
@@ -0,0 +1,81 @@
+package org.jboss.forums.security.jbportal;
+
+import java.util.Set;
+
+import javax.naming.InitialContext;
+
+import org.jboss.portal.identity.IdentityException;
+import org.jboss.portal.identity.NoSuchUserException;
+import org.jboss.portal.identity.User;
+import org.jboss.portal.identity.UserModule;
+
+public class UserModulePortal implements UserModule {
+	private static final String USER_MODULE_JNDI_NAME = "java:portal/UserModule";
+
+	private org.jboss.portal.identity.UserModule portalModule;
+
+	private static UserModule currentInstance;
+
+	private UserModulePortal() throws Exception {
+		InitialContext ctx = new InitialContext();
+		portalModule = (org.jboss.portal.identity.UserModule) ctx
+					.lookup(USER_MODULE_JNDI_NAME);
+	}
+
+	static public UserModule getInstance() throws Exception {
+		if (currentInstance == null)
+			currentInstance = new UserModulePortal();
+
+		return currentInstance;
+	}
+
+	@Override
+	public User createUser(String arg0, String arg1) throws IdentityException,
+			IllegalArgumentException {
+		return new UserPortal(portalModule.createUser(arg0, arg1));
+	}
+
+	@Override
+	public User findUserById(Object arg0) throws IdentityException,
+			IllegalArgumentException, NoSuchUserException {
+		return new UserPortal(portalModule.findUserById(arg0));
+	}
+
+	@Override
+	public User findUserById(String arg0) throws IdentityException,
+			IllegalArgumentException, NoSuchUserException {
+		return new UserPortal(portalModule.findUserById(arg0));
+	}
+
+	@Override
+	public User findUserByUserName(String arg0) throws IdentityException,
+			IllegalArgumentException, NoSuchUserException {
+		return portalModule.findUserByUserName(arg0);
+	}
+
+	@Override
+	public Set findUsers(int arg0, int arg1) throws IdentityException,
+			IllegalArgumentException {
+		return portalModule.findUsers(arg0, arg1);
+	}
+
+	@Override
+	public Set findUsersFilteredByUserName(String arg0, int arg1, int arg2)
+			throws IdentityException, IllegalArgumentException {
+		return portalModule.findUsersFilteredByUserName(arg0, arg1, arg2);
+	}
+
+	@Override
+	public int getUserCount() throws IdentityException,
+			IllegalArgumentException {
+		return portalModule.getUserCount();
+	}
+
+	@Override
+	public void removeUser(Object arg0) throws IdentityException,
+			IllegalArgumentException {
+		portalModule.removeUser(arg0);
+
+	}
+
+}


Property changes on: labs/jbossforums/branches/forums130P27/authz-jaae-plugin/src/main/org/jboss/forums/security/jbportal/UserModulePortal.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: labs/jbossforums/branches/forums130P27/authz-jaae-plugin/src/main/org/jboss/forums/security/jbportal/UserPortal.java
===================================================================
--- labs/jbossforums/branches/forums130P27/authz-jaae-plugin/src/main/org/jboss/forums/security/jbportal/UserPortal.java	                        (rev 0)
+++ labs/jbossforums/branches/forums130P27/authz-jaae-plugin/src/main/org/jboss/forums/security/jbportal/UserPortal.java	2010-10-13 07:47:25 UTC (rev 35499)
@@ -0,0 +1,36 @@
+package org.jboss.forums.security.jbportal;
+
+import org.jboss.portal.identity.IdentityException;
+import org.jboss.portal.identity.User;
+
+public class UserPortal implements User {
+
+	public UserPortal(User user) {
+		
+	}
+	
+	@Override
+	public Object getId() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public String getUserName() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public void updatePassword(String arg0) throws IdentityException {
+		// TODO Auto-generated method stub
+		
+	}
+
+	@Override
+	public boolean validatePassword(String arg0) {
+		// TODO Auto-generated method stub
+		return false;
+	}
+
+}


Property changes on: labs/jbossforums/branches/forums130P27/authz-jaae-plugin/src/main/org/jboss/forums/security/jbportal/UserPortal.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: labs/jbossforums/branches/forums130P27/authz-jaae-plugin/src/main/org/jboss/forums/security/jbportal/UserProfileModulePortal.java
===================================================================
--- labs/jbossforums/branches/forums130P27/authz-jaae-plugin/src/main/org/jboss/forums/security/jbportal/UserProfileModulePortal.java	                        (rev 0)
+++ labs/jbossforums/branches/forums130P27/authz-jaae-plugin/src/main/org/jboss/forums/security/jbportal/UserProfileModulePortal.java	2010-10-13 07:47:25 UTC (rev 35499)
@@ -0,0 +1,59 @@
+package org.jboss.forums.security.jbportal;
+
+import java.util.Map;
+
+import javax.naming.InitialContext;
+
+import org.jboss.portal.identity.IdentityException;
+import org.jboss.portal.identity.User;
+import org.jboss.portal.identity.UserProfileModule;
+import org.jboss.portal.identity.info.ProfileInfo;
+
+public class UserProfileModulePortal implements UserProfileModule {
+	private static final String USER_PROFILE_MODULE_JNDI_NAME = "java:portal/UserProfileModule";
+
+	private org.jboss.portal.identity.UserProfileModule portalModule;
+
+	private static UserProfileModule currentInstance;
+
+	public UserProfileModulePortal() throws Exception {
+		InitialContext ctx = new InitialContext();
+		portalModule = (org.jboss.portal.identity.UserProfileModule) ctx
+					.lookup(USER_PROFILE_MODULE_JNDI_NAME);
+	}
+
+	static public UserProfileModule getInstance() throws Exception {
+		if (currentInstance == null)
+			currentInstance = new UserProfileModulePortal();
+
+		return currentInstance;
+	}
+
+	@Override
+	public ProfileInfo getProfileInfo() throws IdentityException {
+		// TODO Auto-generated method stub
+		return portalModule.getProfileInfo();
+	}
+
+	@Override
+	public Map getProperties(User arg0) throws IdentityException,
+			IllegalArgumentException {
+		// TODO Auto-generated method stub
+		return portalModule.getProperties(arg0);
+	}
+
+	@Override
+	public Object getProperty(User arg0, String arg1) throws IdentityException,
+			IllegalArgumentException {
+		// TODO Auto-generated method stub
+		return portalModule.getProperty(arg0, arg1);
+	}
+
+	@Override
+	public void setProperty(User arg0, String arg1, Object arg2)
+			throws IdentityException, IllegalArgumentException {
+		// TODO Auto-generated method stub
+		portalModule.setProperty(arg0, arg1, arg2);
+	}
+
+}


Property changes on: labs/jbossforums/branches/forums130P27/authz-jaae-plugin/src/main/org/jboss/forums/security/jbportal/UserProfileModulePortal.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: labs/jbossforums/branches/forums130P27/authz-jaae-plugin/src/main/org/jboss/forums/security/picketlink/MembershipModulePL.java
===================================================================
--- labs/jbossforums/branches/forums130P27/authz-jaae-plugin/src/main/org/jboss/forums/security/picketlink/MembershipModulePL.java	                        (rev 0)
+++ labs/jbossforums/branches/forums130P27/authz-jaae-plugin/src/main/org/jboss/forums/security/picketlink/MembershipModulePL.java	2010-10-13 07:47:25 UTC (rev 35499)
@@ -0,0 +1,94 @@
+package org.jboss.forums.security.picketlink;
+
+import java.io.File;
+import java.util.Set;
+
+import org.jboss.portal.identity.IdentityException;
+import org.jboss.portal.identity.MembershipModule;
+import org.jboss.portal.identity.Role;
+import org.jboss.portal.identity.User;
+import org.picketlink.idm.api.IdentitySession;
+import org.picketlink.idm.api.IdentitySessionFactory;
+import org.picketlink.idm.api.RelationshipManager;
+import org.picketlink.idm.impl.configuration.IdentityConfigurationImpl;
+
+public class MembershipModulePL implements MembershipModule {
+
+	private RelationshipManager relationshipManager;
+
+	private static MembershipModule currentInstance;
+
+	public MembershipModulePL() throws Exception {
+		IdentitySessionFactory identitySessionFactory = new IdentityConfigurationImpl()
+				.configure(new File("src/test/resources/example-db-config.xml"))
+				.buildIdentitySessionFactory();
+		IdentitySession identitySession = identitySessionFactory
+				.createIdentitySession("realm://JBossIdentityExample/SampleRealm");
+		relationshipManager = identitySession.getRelationshipManager();
+	}
+
+	static public MembershipModule getInstance() throws Exception {
+		if (currentInstance == null)
+			currentInstance = new MembershipModulePL();
+
+		return currentInstance;
+	}
+
+	@Override
+	public void assignRoles(User arg0, Set arg1) throws IdentityException,
+			IllegalArgumentException {
+		try {
+			relationshipManager.associateUsersByKeys(arg0.getUserName(), arg1);
+		} catch (org.picketlink.idm.common.exception.IdentityException ie) {
+			ie.printStackTrace();
+		}
+	}
+
+	@Override
+	public void assignUsers(Role arg0, Set arg1) throws IdentityException,
+			IllegalArgumentException {
+		try {
+			relationshipManager.associateGroupsByKeys(arg0.getName(), arg1);
+		} catch (org.picketlink.idm.common.exception.IdentityException ie) {
+			ie.printStackTrace();
+		}
+
+	}
+
+	@Override
+	public Set findRoleMembers(String arg0, int arg1, int arg2, String arg3)
+			throws IdentityException, IllegalArgumentException {
+		Set roleMembers = null;
+		try {
+			relationshipManager.findRelatedGroups(arg0, "", null);
+		} catch (org.picketlink.idm.common.exception.IdentityException ie) {
+			ie.printStackTrace();
+		}
+		return roleMembers;
+	}
+
+	@Override
+	public Set getRoles(User arg0) throws IdentityException,
+			IllegalArgumentException {
+		Set roles = null;
+		try {
+			relationshipManager.findAssociatedGroups(arg0.getUserName(), null);
+		} catch (org.picketlink.idm.common.exception.IdentityException ie) {
+			ie.printStackTrace();
+		}
+		return roles;
+	}
+
+	@Override
+	public Set getUsers(Role arg0) throws IdentityException,
+			IllegalArgumentException {
+		Set users = null;
+		try {
+			relationshipManager.findAssociatedUsers(arg0.getName(), true, null);
+		} catch (org.picketlink.idm.common.exception.IdentityException ie) {
+			ie.printStackTrace();
+		}
+		return users;
+	}
+
+}


Property changes on: labs/jbossforums/branches/forums130P27/authz-jaae-plugin/src/main/org/jboss/forums/security/picketlink/MembershipModulePL.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: labs/jbossforums/branches/forums130P27/authz-jaae-plugin/src/main/org/jboss/forums/security/picketlink/RolePL.java
===================================================================
--- labs/jbossforums/branches/forums130P27/authz-jaae-plugin/src/main/org/jboss/forums/security/picketlink/RolePL.java	                        (rev 0)
+++ labs/jbossforums/branches/forums130P27/authz-jaae-plugin/src/main/org/jboss/forums/security/picketlink/RolePL.java	2010-10-13 07:47:25 UTC (rev 35499)
@@ -0,0 +1,31 @@
+package org.jboss.forums.security.picketlink;
+
+import org.jboss.portal.identity.Role;
+
+public class RolePL implements Role {
+
+	@Override
+	public String getDisplayName() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public Object getId() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public String getName() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public void setDisplayName(String arg0) {
+		// TODO Auto-generated method stub
+		
+	}
+
+}


Property changes on: labs/jbossforums/branches/forums130P27/authz-jaae-plugin/src/main/org/jboss/forums/security/picketlink/RolePL.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: labs/jbossforums/branches/forums130P27/authz-jaae-plugin/src/main/org/jboss/forums/security/picketlink/UserModulePL.java
===================================================================
--- labs/jbossforums/branches/forums130P27/authz-jaae-plugin/src/main/org/jboss/forums/security/picketlink/UserModulePL.java	                        (rev 0)
+++ labs/jbossforums/branches/forums130P27/authz-jaae-plugin/src/main/org/jboss/forums/security/picketlink/UserModulePL.java	2010-10-13 07:47:25 UTC (rev 35499)
@@ -0,0 +1,138 @@
+package org.jboss.forums.security.picketlink;
+
+import java.io.File;
+import java.util.Set;
+
+import org.jboss.portal.identity.IdentityException;
+import org.jboss.portal.identity.NoSuchUserException;
+import org.jboss.portal.identity.User;
+import org.jboss.portal.identity.UserModule;
+import org.picketlink.idm.api.IdentitySearchCriteria;
+import org.picketlink.idm.api.IdentitySession;
+import org.picketlink.idm.api.IdentitySessionFactory;
+import org.picketlink.idm.api.PersistenceManager;
+import org.picketlink.idm.impl.configuration.IdentityConfigurationImpl;
+
+public class UserModulePL implements UserModule {
+
+	private PersistenceManager persistenceManager;
+
+	private static UserModule currentInstance;
+
+	private UserModulePL() throws Exception {
+		IdentitySessionFactory identitySessionFactory = new IdentityConfigurationImpl()
+				.configure(new File("src/test/resources/example-db-config.xml"))
+				.buildIdentitySessionFactory();
+		IdentitySession identitySession = identitySessionFactory
+				.createIdentitySession("realm://JBossIdentityExample/SampleRealm");
+		persistenceManager = identitySession.getPersistenceManager();
+	}
+
+	static public UserModule getInstance() throws Exception {
+		if (currentInstance == null)
+			currentInstance = new UserModulePL();
+
+		return currentInstance;
+	}
+
+	@Override
+	public User createUser(String arg0, String arg1) throws IdentityException,
+			IllegalArgumentException {
+		User user = null;
+		try {
+			user = new UserPL(persistenceManager.createUser(arg0));
+		} catch (org.picketlink.idm.common.exception.IdentityException ie) {
+			ie.printStackTrace();
+		}
+		return user;
+	}
+
+	@Override
+	public User findUserById(Object arg0) throws IdentityException,
+			IllegalArgumentException, NoSuchUserException {
+		User user = null;
+		try {
+			user = new UserPL(persistenceManager.findUser((String) arg0));
+		} catch (org.picketlink.idm.common.exception.IdentityException ie) {
+			ie.printStackTrace();
+		}
+		return user;
+	}
+
+	@Override
+	public User findUserById(String arg0) throws IdentityException,
+			IllegalArgumentException, NoSuchUserException {
+		User user = null;
+		try {
+			user = new UserPL(persistenceManager.findUser(arg0));
+		} catch (org.picketlink.idm.common.exception.IdentityException ie) {
+			ie.printStackTrace();
+		}
+		return user;
+	}
+
+	@Override
+	public User findUserByUserName(String arg0) throws IdentityException,
+			IllegalArgumentException, NoSuchUserException {
+		IdentitySearchCriteria identitySearchCriteria = null;
+		User user = null;
+		try {
+			user = new UserPL((org.picketlink.idm.api.User) persistenceManager
+					.findUser(identitySearchCriteria).toArray()[0]);
+		} catch (org.picketlink.idm.common.exception.IdentityException ie) {
+			ie.printStackTrace();
+		}
+		return user;
+	}
+
+	@Override
+	public Set findUsers(int arg0, int arg1) throws IdentityException,
+			IllegalArgumentException {
+		IdentitySearchCriteria identitySearchCriteria = null;
+		Set users = null;
+		try {
+			persistenceManager.findUser(identitySearchCriteria);
+		} catch (org.picketlink.idm.common.exception.IdentityException ie) {
+			ie.printStackTrace();
+		}
+		return users;
+	}
+
+	@Override
+	public Set findUsersFilteredByUserName(String arg0, int arg1, int arg2)
+			throws IdentityException, IllegalArgumentException {
+		IdentitySearchCriteria identitySearchCriteria = null;
+		Set users = null;
+		try {
+			persistenceManager.findUser(identitySearchCriteria);
+		} catch (org.picketlink.idm.common.exception.IdentityException ie) {
+			ie.printStackTrace();
+		}
+		return users;
+	}
+
+	@Override
+	public int getUserCount() throws IdentityException,
+			IllegalArgumentException {
+		int count = 0;
+		try {
+			count = persistenceManager.getUserCount();
+		} catch (org.picketlink.idm.common.exception.IdentityException ie) {
+			ie.printStackTrace();
+		}
+		return count;
+	}
+
+	@Override
+	public void removeUser(Object arg0) throws IdentityException,
+			IllegalArgumentException {
+		try {
+			persistenceManager.removeUser(persistenceManager
+					.findUser((String) arg0), true);
+		} catch (org.picketlink.idm.common.exception.IdentityException ie) {
+			ie.printStackTrace();
+		}
+
+	}
+
+}


Property changes on: labs/jbossforums/branches/forums130P27/authz-jaae-plugin/src/main/org/jboss/forums/security/picketlink/UserModulePL.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: labs/jbossforums/branches/forums130P27/authz-jaae-plugin/src/main/org/jboss/forums/security/picketlink/UserPL.java
===================================================================
--- labs/jbossforums/branches/forums130P27/authz-jaae-plugin/src/main/org/jboss/forums/security/picketlink/UserPL.java	                        (rev 0)
+++ labs/jbossforums/branches/forums130P27/authz-jaae-plugin/src/main/org/jboss/forums/security/picketlink/UserPL.java	2010-10-13 07:47:25 UTC (rev 35499)
@@ -0,0 +1,36 @@
+package org.jboss.forums.security.picketlink;
+
+import org.jboss.portal.identity.IdentityException;
+import org.jboss.portal.identity.User;
+
+public class UserPL implements User {
+
+	public UserPL(org.picketlink.idm.api.User user) {
+		
+	}
+
+	@Override
+	public Object getId() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public String getUserName() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public void updatePassword(String arg0) throws IdentityException {
+		// TODO Auto-generated method stub
+		
+	}
+
+	@Override
+	public boolean validatePassword(String arg0) {
+		// TODO Auto-generated method stub
+		return false;
+	}
+
+}


Property changes on: labs/jbossforums/branches/forums130P27/authz-jaae-plugin/src/main/org/jboss/forums/security/picketlink/UserPL.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: labs/jbossforums/branches/forums130P27/authz-jaae-plugin/src/main/org/jboss/forums/security/picketlink/UserProfileModulePL.java
===================================================================
--- labs/jbossforums/branches/forums130P27/authz-jaae-plugin/src/main/org/jboss/forums/security/picketlink/UserProfileModulePL.java	                        (rev 0)
+++ labs/jbossforums/branches/forums130P27/authz-jaae-plugin/src/main/org/jboss/forums/security/picketlink/UserProfileModulePL.java	2010-10-13 07:47:25 UTC (rev 35499)
@@ -0,0 +1,80 @@
+package org.jboss.forums.security.picketlink;
+
+import java.io.File;
+import java.util.Map;
+
+import org.jboss.portal.identity.IdentityException;
+import org.jboss.portal.identity.User;
+import org.jboss.portal.identity.UserProfileModule;
+import org.jboss.portal.identity.info.ProfileInfo;
+import org.picketlink.idm.api.AttributesManager;
+import org.picketlink.idm.api.IdentitySession;
+import org.picketlink.idm.api.IdentitySessionFactory;
+import org.picketlink.idm.impl.configuration.IdentityConfigurationImpl;
+
+public class UserProfileModulePL implements UserProfileModule {
+
+	private AttributesManager userProfileManager;
+
+	private static UserProfileModule currentInstance;
+
+	public UserProfileModulePL() throws Exception {
+		IdentitySessionFactory identitySessionFactory = new IdentityConfigurationImpl()
+				.configure(new File("src/test/resources/example-db-config.xml"))
+				.buildIdentitySessionFactory();
+		IdentitySession identitySession = identitySessionFactory
+				.createIdentitySession("realm://JBossIdentityExample/SampleRealm");
+		userProfileManager = identitySession.getAttributesManager();
+	}
+
+	static public UserProfileModule getInstance() throws Exception {
+		if (currentInstance == null)
+			currentInstance = new UserProfileModulePL();
+
+		return currentInstance;
+	}
+
+	@Override
+	public ProfileInfo getProfileInfo() throws IdentityException {
+		// TODO Auto-generated method stub
+		userProfileManager.getAttributeDescription("", "");
+		return null;
+	}
+
+	@Override
+	public Map getProperties(User arg0) throws IdentityException,
+			IllegalArgumentException {
+		Map properties = null;
+		try {
+			properties = userProfileManager.getAttributes(arg0.getUserName());
+		} catch (org.picketlink.idm.common.exception.IdentityException ie) {
+			ie.printStackTrace();
+		}
+		return properties;
+	}
+
+	@Override
+	public Object getProperty(User arg0, String arg1) throws IdentityException,
+			IllegalArgumentException {
+		Object property = null;
+		try {
+			property = userProfileManager
+					.getAttribute(arg0.getUserName(), arg1);
+		} catch (org.picketlink.idm.common.exception.IdentityException ie) {
+			ie.printStackTrace();
+		}
+		return property;
+	}
+
+	@Override
+	public void setProperty(User arg0, String arg1, Object arg2)
+			throws IdentityException, IllegalArgumentException {
+		try {
+			userProfileManager.addAttribute(arg0.getUserName(), arg1, arg2);
+		} catch (org.picketlink.idm.common.exception.IdentityException ie) {
+			ie.printStackTrace();
+		}
+
+	}
+
+}


Property changes on: labs/jbossforums/branches/forums130P27/authz-jaae-plugin/src/main/org/jboss/forums/security/picketlink/UserProfileModulePL.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Modified: labs/jbossforums/branches/forums130P27/forums/build.xml
===================================================================
--- labs/jbossforums/branches/forums130P27/forums/build.xml	2010-10-13 07:46:05 UTC (rev 35498)
+++ labs/jbossforums/branches/forums130P27/forums/build.xml	2010-10-13 07:47:25 UTC (rev 35499)
@@ -90,7 +90,8 @@
 			<path refid="jboss.javassist.classpath" />
 			<path refid="dom4j.dom4j.classpath" />
 			<path refid="jboss.hibernate.search.classpath"/>		
-		    <path refid="jakarta.commons.classpath"/>
+		    <path refid="jakarta.commons.classpath"/>			
+			<path refid="picketlink.classpath"/>	
 		</path>
 
       <!-- Configure modules -->
@@ -266,6 +267,7 @@
       	    <fileset dir="${jboss.hibernate.lib}" includes="hibernate-commons-annotations.jar,ejb3-persistence.jar"/>
 			<fileset dir="${build.lib}" includes="portal-forums.war,portal-forums-ui.jar,portal-forums.sar,portal-forums-authz-plugin.sar,portal-forums-uif.jar"/>
 			<fileset dir="${facelets.lib}" includes="jsf-facelets.jar,jsf-example.jar"/>
+		    <fileset dir="${picketlink.lib}" includes="picketlink-idm-1.1.5.CR01.jar"/>
 			<fileset dir="${jakarta.commons.lib}" includes="commons-beanutils.jar,commons-codec.jar,commons-collections.jar,commons-digester-1.7-brew.jar"/>
 			<fileset dir="${sun.portlet.lib}" includes="jsf-portlet.jar" />
       	    <fileset dir="${portlet.lib}" includes="portlet-api.jar" />
@@ -301,6 +303,7 @@
       	    <fileset dir="${jboss.hibernate.lib}" includes="hibernate-commons-annotations.jar"/>
 			<fileset dir="${build.lib}" includes="portal-forums.war,portal-forums-ui.jar,portal-forums-ha.sar,portal-forums-authz-plugin.sar,portal-forums-uif-ha.jar"/>
 			<fileset dir="${facelets.lib}" includes="jsf-facelets.jar,jsf-example.jar"/>
+	        <fileset dir="${picketlink.lib}" includes="picketlink-idm-1.1.5.CR01.jar"/>
 			<fileset dir="${jakarta.commons.lib}" includes="commons-beanutils.jar,commons-codec.jar,commons-collections.jar,commons-digester-1.7-brew.jar"/>
 			<fileset dir="${sun.portlet.lib}" includes="jsf-portlet.jar" />
   	        <fileset dir="${portlet.lib}" includes="portlet-api.jar" />
@@ -317,6 +320,7 @@
       	    <fileset dir="${jboss.hibernate.lib}" includes="hibernate-commons-annotations.jar"/>
 			<fileset dir="${build.lib}" includes="portal-forums.war,portal-forums-ui.jar,portal-forums-ha-jbp.sar,portal-forums-authz-plugin.sar,portal-forums-uif-ha-jbp.jar"/>
 			<fileset dir="${facelets.lib}" includes="jsf-facelets.jar,jsf-example.jar"/>
+            <fileset dir="${picketlink.lib}" includes="picketlink-idm-1.1.5.CR01.jar"/>
 			<fileset dir="${jakarta.commons.lib}" includes="commons-beanutils.jar,commons-codec.jar,commons-collections.jar,commons-digester-1.7-brew.jar"/>
 			<fileset dir="${sun.portlet.lib}" includes="jsf-portlet.jar" />
   	        <fileset dir="${portlet.lib}" includes="portlet-api.jar" />
@@ -333,6 +337,7 @@
     	    <fileset dir="${jboss.hibernate.lib}" includes="hibernate-commons-annotations.jar"/>
 			<fileset dir="${build.lib}" includes="portal-forums.war,portal-forums-ui.jar,portal-forums-ha.sar,portal-forums-authz-plugin.sar,portal-forums-uif-ha-as5.jar"/>
 			<fileset dir="${facelets.lib}" includes="jsf-facelets.jar,jsf-example.jar"/>
+            <fileset dir="${picketlink.lib}" includes="picketlink-idm-1.1.5.CR01.jar"/>
 			<fileset dir="${jakarta.commons.lib}" includes="commons-beanutils.jar,commons-codec.jar,commons-collections.jar,commons-digester-1.7-brew.jar"/>
 			<fileset dir="${sun.portlet.lib}" includes="jsf-portlet.jar" />
 	        <fileset dir="${portlet.lib}" includes="portlet-api.jar" />

Added: labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/auth/jbportal/MembershipModulePortal.java
===================================================================
--- labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/auth/jbportal/MembershipModulePortal.java	                        (rev 0)
+++ labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/auth/jbportal/MembershipModulePortal.java	2010-10-13 07:47:25 UTC (rev 35499)
@@ -0,0 +1,62 @@
+package org.jboss.portlet.forums.auth.jbportal;
+
+import java.util.Set;
+
+import javax.naming.InitialContext;
+
+import org.jboss.portal.identity.IdentityException;
+import org.jboss.portal.identity.MembershipModule;
+import org.jboss.portal.identity.Role;
+import org.jboss.portal.identity.User;
+
+public class MembershipModulePortal implements MembershipModule {
+	private static final String MEMBERSHIP_MODULE_JNDI_NAME = "java:portal/MembershipModule";
+
+	private org.jboss.portal.identity.MembershipModule portalModule;
+
+	private static MembershipModule currentInstance;
+
+	public MembershipModulePortal() throws Exception {
+		InitialContext ctx = new InitialContext();
+		portalModule = (org.jboss.portal.identity.MembershipModule) ctx
+					.lookup(MEMBERSHIP_MODULE_JNDI_NAME);
+	}
+
+	static public MembershipModule getInstance() throws Exception {
+		if (currentInstance == null)
+			currentInstance = new MembershipModulePortal();
+
+		return currentInstance;
+	}
+
+	@Override
+	public void assignRoles(User arg0, Set arg1) throws IdentityException,
+			IllegalArgumentException {
+			portalModule.assignRoles(arg0, arg1);
+	}
+
+	@Override
+	public void assignUsers(Role arg0, Set arg1) throws IdentityException,
+			IllegalArgumentException {
+			portalModule.assignUsers(arg0, arg1);
+	}
+
+	@Override
+	public Set findRoleMembers(String arg0, int arg1, int arg2, String arg3)
+			throws IdentityException, IllegalArgumentException {
+			return portalModule.findRoleMembers(arg0, arg1, arg2, arg3);
+	}
+
+	@Override
+	public Set getRoles(User arg0) throws IdentityException,
+			IllegalArgumentException {
+			return portalModule.getRoles(arg0);
+	}
+
+	@Override
+	public Set getUsers(Role arg0) throws IdentityException,
+			IllegalArgumentException {
+			return portalModule.getUsers(arg0);
+	}
+
+}


Property changes on: labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/auth/jbportal/MembershipModulePortal.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/auth/jbportal/RolePortal.java
===================================================================
--- labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/auth/jbportal/RolePortal.java	                        (rev 0)
+++ labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/auth/jbportal/RolePortal.java	2010-10-13 07:47:25 UTC (rev 35499)
@@ -0,0 +1,31 @@
+package org.jboss.portlet.forums.auth.jbportal;
+
+import org.jboss.portal.identity.Role;
+
+public class RolePortal implements Role {
+
+	@Override
+	public String getDisplayName() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public Object getId() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public String getName() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public void setDisplayName(String arg0) {
+		// TODO Auto-generated method stub
+		
+	}
+
+}


Property changes on: labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/auth/jbportal/RolePortal.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/auth/jbportal/UserModulePortal.java
===================================================================
--- labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/auth/jbportal/UserModulePortal.java	                        (rev 0)
+++ labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/auth/jbportal/UserModulePortal.java	2010-10-13 07:47:25 UTC (rev 35499)
@@ -0,0 +1,81 @@
+package org.jboss.portlet.forums.auth.jbportal;
+
+import java.util.Set;
+
+import javax.naming.InitialContext;
+
+import org.jboss.portal.identity.IdentityException;
+import org.jboss.portal.identity.NoSuchUserException;
+import org.jboss.portal.identity.User;
+import org.jboss.portal.identity.UserModule;
+
+public class UserModulePortal implements UserModule {
+	private static final String USER_MODULE_JNDI_NAME = "java:portal/UserModule";
+
+	private org.jboss.portal.identity.UserModule portalModule;
+
+	private static UserModule currentInstance;
+
+	private UserModulePortal() throws Exception {
+		InitialContext ctx = new InitialContext();
+		portalModule = (org.jboss.portal.identity.UserModule) ctx
+					.lookup(USER_MODULE_JNDI_NAME);
+	}
+
+	static public UserModule getInstance() throws Exception {
+		if (currentInstance == null)
+			currentInstance = new UserModulePortal();
+
+		return currentInstance;
+	}
+
+	@Override
+	public User createUser(String arg0, String arg1) throws IdentityException,
+			IllegalArgumentException {
+		return new UserPortal(portalModule.createUser(arg0, arg1));
+	}
+
+	@Override
+	public User findUserById(Object arg0) throws IdentityException,
+			IllegalArgumentException, NoSuchUserException {
+		return new UserPortal(portalModule.findUserById(arg0));
+	}
+
+	@Override
+	public User findUserById(String arg0) throws IdentityException,
+			IllegalArgumentException, NoSuchUserException {
+		return new UserPortal(portalModule.findUserById(arg0));
+	}
+
+	@Override
+	public User findUserByUserName(String arg0) throws IdentityException,
+			IllegalArgumentException, NoSuchUserException {
+		return portalModule.findUserByUserName(arg0);
+	}
+
+	@Override
+	public Set findUsers(int arg0, int arg1) throws IdentityException,
+			IllegalArgumentException {
+		return portalModule.findUsers(arg0, arg1);
+	}
+
+	@Override
+	public Set findUsersFilteredByUserName(String arg0, int arg1, int arg2)
+			throws IdentityException, IllegalArgumentException {
+		return portalModule.findUsersFilteredByUserName(arg0, arg1, arg2);
+	}
+
+	@Override
+	public int getUserCount() throws IdentityException,
+			IllegalArgumentException {
+		return portalModule.getUserCount();
+	}
+
+	@Override
+	public void removeUser(Object arg0) throws IdentityException,
+			IllegalArgumentException {
+		portalModule.removeUser(arg0);
+
+	}
+
+}


Property changes on: labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/auth/jbportal/UserModulePortal.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/auth/jbportal/UserPortal.java
===================================================================
--- labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/auth/jbportal/UserPortal.java	                        (rev 0)
+++ labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/auth/jbportal/UserPortal.java	2010-10-13 07:47:25 UTC (rev 35499)
@@ -0,0 +1,36 @@
+package org.jboss.portlet.forums.auth.jbportal;
+
+import org.jboss.portal.identity.IdentityException;
+import org.jboss.portal.identity.User;
+
+public class UserPortal implements User {
+
+	public UserPortal(User user) {
+		
+	}
+	
+	@Override
+	public Object getId() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public String getUserName() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public void updatePassword(String arg0) throws IdentityException {
+		// TODO Auto-generated method stub
+		
+	}
+
+	@Override
+	public boolean validatePassword(String arg0) {
+		// TODO Auto-generated method stub
+		return false;
+	}
+
+}


Property changes on: labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/auth/jbportal/UserPortal.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/auth/jbportal/UserProfileModulePortal.java
===================================================================
--- labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/auth/jbportal/UserProfileModulePortal.java	                        (rev 0)
+++ labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/auth/jbportal/UserProfileModulePortal.java	2010-10-13 07:47:25 UTC (rev 35499)
@@ -0,0 +1,59 @@
+package org.jboss.portlet.forums.auth.jbportal;
+
+import java.util.Map;
+
+import javax.naming.InitialContext;
+
+import org.jboss.portal.identity.IdentityException;
+import org.jboss.portal.identity.User;
+import org.jboss.portal.identity.UserProfileModule;
+import org.jboss.portal.identity.info.ProfileInfo;
+
+public class UserProfileModulePortal implements UserProfileModule {
+	private static final String USER_PROFILE_MODULE_JNDI_NAME = "java:portal/UserProfileModule";
+
+	private org.jboss.portal.identity.UserProfileModule portalModule;
+
+	private static UserProfileModule currentInstance;
+
+	public UserProfileModulePortal() throws Exception {
+		InitialContext ctx = new InitialContext();
+		portalModule = (org.jboss.portal.identity.UserProfileModule) ctx
+					.lookup(USER_PROFILE_MODULE_JNDI_NAME);
+	}
+
+	static public UserProfileModule getInstance() throws Exception {
+		if (currentInstance == null)
+			currentInstance = new UserProfileModulePortal();
+
+		return currentInstance;
+	}
+
+	@Override
+	public ProfileInfo getProfileInfo() throws IdentityException {
+		// TODO Auto-generated method stub
+		return portalModule.getProfileInfo();
+	}
+
+	@Override
+	public Map getProperties(User arg0) throws IdentityException,
+			IllegalArgumentException {
+		// TODO Auto-generated method stub
+		return portalModule.getProperties(arg0);
+	}
+
+	@Override
+	public Object getProperty(User arg0, String arg1) throws IdentityException,
+			IllegalArgumentException {
+		// TODO Auto-generated method stub
+		return portalModule.getProperty(arg0, arg1);
+	}
+
+	@Override
+	public void setProperty(User arg0, String arg1, Object arg2)
+			throws IdentityException, IllegalArgumentException {
+		// TODO Auto-generated method stub
+		portalModule.setProperty(arg0, arg1, arg2);
+	}
+
+}


Property changes on: labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/auth/jbportal/UserProfileModulePortal.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/auth/picketlink/MembershipModulePL.java
===================================================================
--- labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/auth/picketlink/MembershipModulePL.java	                        (rev 0)
+++ labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/auth/picketlink/MembershipModulePL.java	2010-10-13 07:47:25 UTC (rev 35499)
@@ -0,0 +1,94 @@
+package org.jboss.portlet.forums.auth.picketlink;
+
+import java.io.File;
+import java.util.Set;
+
+import org.jboss.portal.identity.IdentityException;
+import org.jboss.portal.identity.MembershipModule;
+import org.jboss.portal.identity.Role;
+import org.jboss.portal.identity.User;
+import org.picketlink.idm.api.IdentitySession;
+import org.picketlink.idm.api.IdentitySessionFactory;
+import org.picketlink.idm.api.RelationshipManager;
+import org.picketlink.idm.impl.configuration.IdentityConfigurationImpl;
+
+public class MembershipModulePL implements MembershipModule {
+
+	private RelationshipManager relationshipManager;
+
+	private static MembershipModule currentInstance;
+
+	public MembershipModulePL() throws Exception {
+		IdentitySessionFactory identitySessionFactory = new IdentityConfigurationImpl()
+				.configure(new File("src/test/resources/example-db-config.xml"))
+				.buildIdentitySessionFactory();
+		IdentitySession identitySession = identitySessionFactory
+				.createIdentitySession("realm://JBossIdentityExample/SampleRealm");
+		relationshipManager = identitySession.getRelationshipManager();
+	}
+
+	static public MembershipModule getInstance() throws Exception {
+		if (currentInstance == null)
+			currentInstance = new MembershipModulePL();
+
+		return currentInstance;
+	}
+
+	@Override
+	public void assignRoles(User arg0, Set arg1) throws IdentityException,
+			IllegalArgumentException {
+		try {
+			relationshipManager.associateUsersByKeys(arg0.getUserName(), arg1);
+		} catch (org.picketlink.idm.common.exception.IdentityException ie) {
+			ie.printStackTrace();
+		}
+	}
+
+	@Override
+	public void assignUsers(Role arg0, Set arg1) throws IdentityException,
+			IllegalArgumentException {
+		try {
+			relationshipManager.associateGroupsByKeys(arg0.getName(), arg1);
+		} catch (org.picketlink.idm.common.exception.IdentityException ie) {
+			ie.printStackTrace();
+		}
+
+	}
+
+	@Override
+	public Set findRoleMembers(String arg0, int arg1, int arg2, String arg3)
+			throws IdentityException, IllegalArgumentException {
+		Set roleMembers = null;
+		try {
+			relationshipManager.findRelatedGroups(arg0, "", null);
+		} catch (org.picketlink.idm.common.exception.IdentityException ie) {
+			ie.printStackTrace();
+		}
+		return roleMembers;
+	}
+
+	@Override
+	public Set getRoles(User arg0) throws IdentityException,
+			IllegalArgumentException {
+		Set roles = null;
+		try {
+			relationshipManager.findAssociatedGroups(arg0.getUserName(), null);
+		} catch (org.picketlink.idm.common.exception.IdentityException ie) {
+			ie.printStackTrace();
+		}
+		return roles;
+	}
+
+	@Override
+	public Set getUsers(Role arg0) throws IdentityException,
+			IllegalArgumentException {
+		Set users = null;
+		try {
+			relationshipManager.findAssociatedUsers(arg0.getName(), true, null);
+		} catch (org.picketlink.idm.common.exception.IdentityException ie) {
+			ie.printStackTrace();
+		}
+		return users;
+	}
+
+}


Property changes on: labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/auth/picketlink/MembershipModulePL.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/auth/picketlink/RolePL.java
===================================================================
--- labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/auth/picketlink/RolePL.java	                        (rev 0)
+++ labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/auth/picketlink/RolePL.java	2010-10-13 07:47:25 UTC (rev 35499)
@@ -0,0 +1,31 @@
+package org.jboss.portlet.forums.auth.picketlink;
+
+import org.jboss.portal.identity.Role;
+
+public class RolePL implements Role {
+
+	@Override
+	public String getDisplayName() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public Object getId() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public String getName() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public void setDisplayName(String arg0) {
+		// TODO Auto-generated method stub
+		
+	}
+
+}


Property changes on: labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/auth/picketlink/RolePL.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/auth/picketlink/UserModulePL.java
===================================================================
--- labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/auth/picketlink/UserModulePL.java	                        (rev 0)
+++ labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/auth/picketlink/UserModulePL.java	2010-10-13 07:47:25 UTC (rev 35499)
@@ -0,0 +1,138 @@
+package org.jboss.portlet.forums.auth.picketlink;
+
+import java.io.File;
+import java.util.Set;
+
+import org.jboss.portal.identity.IdentityException;
+import org.jboss.portal.identity.NoSuchUserException;
+import org.jboss.portal.identity.User;
+import org.jboss.portal.identity.UserModule;
+import org.picketlink.idm.api.IdentitySearchCriteria;
+import org.picketlink.idm.api.IdentitySession;
+import org.picketlink.idm.api.IdentitySessionFactory;
+import org.picketlink.idm.api.PersistenceManager;
+import org.picketlink.idm.impl.configuration.IdentityConfigurationImpl;
+
+public class UserModulePL implements UserModule {
+
+	private PersistenceManager persistenceManager;
+
+	private static UserModule currentInstance;
+
+	private UserModulePL() throws Exception {
+		IdentitySessionFactory identitySessionFactory = new IdentityConfigurationImpl()
+				.configure(new File("src/test/resources/example-db-config.xml"))
+				.buildIdentitySessionFactory();
+		IdentitySession identitySession = identitySessionFactory
+				.createIdentitySession("realm://JBossIdentityExample/SampleRealm");
+		persistenceManager = identitySession.getPersistenceManager();
+	}
+
+	static public UserModule getInstance() throws Exception {
+		if (currentInstance == null)
+			currentInstance = new UserModulePL();
+
+		return currentInstance;
+	}
+
+	@Override
+	public User createUser(String arg0, String arg1) throws IdentityException,
+			IllegalArgumentException {
+		User user = null;
+		try {
+			user = new UserPL(persistenceManager.createUser(arg0));
+		} catch (org.picketlink.idm.common.exception.IdentityException ie) {
+			ie.printStackTrace();
+		}
+		return user;
+	}
+
+	@Override
+	public User findUserById(Object arg0) throws IdentityException,
+			IllegalArgumentException, NoSuchUserException {
+		User user = null;
+		try {
+			user = new UserPL(persistenceManager.findUser((String) arg0));
+		} catch (org.picketlink.idm.common.exception.IdentityException ie) {
+			ie.printStackTrace();
+		}
+		return user;
+	}
+
+	@Override
+	public User findUserById(String arg0) throws IdentityException,
+			IllegalArgumentException, NoSuchUserException {
+		User user = null;
+		try {
+			user = new UserPL(persistenceManager.findUser(arg0));
+		} catch (org.picketlink.idm.common.exception.IdentityException ie) {
+			ie.printStackTrace();
+		}
+		return user;
+	}
+
+	@Override
+	public User findUserByUserName(String arg0) throws IdentityException,
+			IllegalArgumentException, NoSuchUserException {
+		IdentitySearchCriteria identitySearchCriteria = null;
+		User user = null;
+		try {
+			user = new UserPL((org.picketlink.idm.api.User) persistenceManager
+					.findUser(identitySearchCriteria).toArray()[0]);
+		} catch (org.picketlink.idm.common.exception.IdentityException ie) {
+			ie.printStackTrace();
+		}
+		return user;
+	}
+
+	@Override
+	public Set findUsers(int arg0, int arg1) throws IdentityException,
+			IllegalArgumentException {
+		IdentitySearchCriteria identitySearchCriteria = null;
+		Set users = null;
+		try {
+			persistenceManager.findUser(identitySearchCriteria);
+		} catch (org.picketlink.idm.common.exception.IdentityException ie) {
+			ie.printStackTrace();
+		}
+		return users;
+	}
+
+	@Override
+	public Set findUsersFilteredByUserName(String arg0, int arg1, int arg2)
+			throws IdentityException, IllegalArgumentException {
+		IdentitySearchCriteria identitySearchCriteria = null;
+		Set users = null;
+		try {
+			persistenceManager.findUser(identitySearchCriteria);
+		} catch (org.picketlink.idm.common.exception.IdentityException ie) {
+			ie.printStackTrace();
+		}
+		return users;
+	}
+
+	@Override
+	public int getUserCount() throws IdentityException,
+			IllegalArgumentException {
+		int count = 0;
+		try {
+			count = persistenceManager.getUserCount();
+		} catch (org.picketlink.idm.common.exception.IdentityException ie) {
+			ie.printStackTrace();
+		}
+		return count;
+	}
+
+	@Override
+	public void removeUser(Object arg0) throws IdentityException,
+			IllegalArgumentException {
+		try {
+			persistenceManager.removeUser(persistenceManager
+					.findUser((String) arg0), true);
+		} catch (org.picketlink.idm.common.exception.IdentityException ie) {
+			ie.printStackTrace();
+		}
+
+	}
+
+}


Property changes on: labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/auth/picketlink/UserModulePL.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/auth/picketlink/UserPL.java
===================================================================
--- labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/auth/picketlink/UserPL.java	                        (rev 0)
+++ labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/auth/picketlink/UserPL.java	2010-10-13 07:47:25 UTC (rev 35499)
@@ -0,0 +1,36 @@
+package org.jboss.portlet.forums.auth.picketlink;
+
+import org.jboss.portal.identity.IdentityException;
+import org.jboss.portal.identity.User;
+
+public class UserPL implements User {
+
+	public UserPL(org.picketlink.idm.api.User user) {
+		
+	}
+
+	@Override
+	public Object getId() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public String getUserName() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public void updatePassword(String arg0) throws IdentityException {
+		// TODO Auto-generated method stub
+		
+	}
+
+	@Override
+	public boolean validatePassword(String arg0) {
+		// TODO Auto-generated method stub
+		return false;
+	}
+
+}


Property changes on: labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/auth/picketlink/UserPL.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/auth/picketlink/UserProfileModulePL.java
===================================================================
--- labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/auth/picketlink/UserProfileModulePL.java	                        (rev 0)
+++ labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/auth/picketlink/UserProfileModulePL.java	2010-10-13 07:47:25 UTC (rev 35499)
@@ -0,0 +1,80 @@
+package org.jboss.portlet.forums.auth.picketlink;
+
+import java.io.File;
+import java.util.Map;
+
+import org.jboss.portal.identity.IdentityException;
+import org.jboss.portal.identity.User;
+import org.jboss.portal.identity.UserProfileModule;
+import org.jboss.portal.identity.info.ProfileInfo;
+import org.picketlink.idm.api.AttributesManager;
+import org.picketlink.idm.api.IdentitySession;
+import org.picketlink.idm.api.IdentitySessionFactory;
+import org.picketlink.idm.impl.configuration.IdentityConfigurationImpl;
+
+public class UserProfileModulePL implements UserProfileModule {
+
+	private AttributesManager userProfileManager;
+
+	private static UserProfileModule currentInstance;
+
+	public UserProfileModulePL() throws Exception {
+		IdentitySessionFactory identitySessionFactory = new IdentityConfigurationImpl()
+				.configure(new File("src/test/resources/example-db-config.xml"))
+				.buildIdentitySessionFactory();
+		IdentitySession identitySession = identitySessionFactory
+				.createIdentitySession("realm://JBossIdentityExample/SampleRealm");
+		userProfileManager = identitySession.getAttributesManager();
+	}
+
+	static public UserProfileModule getInstance() throws Exception {
+		if (currentInstance == null)
+			currentInstance = new UserProfileModulePL();
+
+		return currentInstance;
+	}
+
+	@Override
+	public ProfileInfo getProfileInfo() throws IdentityException {
+		// TODO Auto-generated method stub
+		userProfileManager.getAttributeDescription("", "");
+		return null;
+	}
+
+	@Override
+	public Map getProperties(User arg0) throws IdentityException,
+			IllegalArgumentException {
+		Map properties = null;
+		try {
+			properties = userProfileManager.getAttributes(arg0.getUserName());
+		} catch (org.picketlink.idm.common.exception.IdentityException ie) {
+			ie.printStackTrace();
+		}
+		return properties;
+	}
+
+	@Override
+	public Object getProperty(User arg0, String arg1) throws IdentityException,
+			IllegalArgumentException {
+		Object property = null;
+		try {
+			property = userProfileManager
+					.getAttribute(arg0.getUserName(), arg1);
+		} catch (org.picketlink.idm.common.exception.IdentityException ie) {
+			ie.printStackTrace();
+		}
+		return property;
+	}
+
+	@Override
+	public void setProperty(User arg0, String arg1, Object arg2)
+			throws IdentityException, IllegalArgumentException {
+		try {
+			userProfileManager.addAttribute(arg0.getUserName(), arg1, arg2);
+		} catch (org.picketlink.idm.common.exception.IdentityException ie) {
+			ie.printStackTrace();
+		}
+
+	}
+
+}


Property changes on: labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/auth/picketlink/UserProfileModulePL.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Modified: labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/PortalUtil.java
===================================================================
--- labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/PortalUtil.java	2010-10-13 07:46:05 UTC (rev 35498)
+++ labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/PortalUtil.java	2010-10-13 07:47:25 UTC (rev 35499)
@@ -51,14 +51,14 @@
 import javax.transaction.UserTransaction;
 
 import org.apache.log4j.Logger;
-import org.jboss.forums.security.jbportal.UserProfileModulePortal;
-import org.jboss.forums.security.picketlink.UserProfileModulePL;
 import org.jboss.portal.core.modules.ModuleConstants;
 import org.jboss.portal.identity.NoSuchUserException;
 import org.jboss.portal.identity.User;
 import org.jboss.portal.identity.UserModule;
 import org.jboss.portal.identity.UserProfileModule;
 import org.jboss.portlet.forums.ForumsConstants;
+import org.jboss.portlet.forums.auth.jbportal.UserProfileModulePortal;
+import org.jboss.portlet.forums.auth.picketlink.UserProfileModulePL;
 import org.jboss.portlet.forums.feeds.FeedConstants;
 import org.jboss.portlet.forums.format.render.bbcodehtml.ToHTMLConfig;
 import org.jboss.portlet.forums.format.render.bbcodehtml.ToHTMLRenderer;

Modified: labs/jbossforums/branches/forums130P27/forums/src/resources/portal-forums-ear/META-INF/application.xml
===================================================================
--- labs/jbossforums/branches/forums130P27/forums/src/resources/portal-forums-ear/META-INF/application.xml	2010-10-13 07:46:05 UTC (rev 35498)
+++ labs/jbossforums/branches/forums130P27/forums/src/resources/portal-forums-ear/META-INF/application.xml	2010-10-13 07:47:25 UTC (rev 35499)
@@ -37,6 +37,9 @@
 	   <java>jsf-example.jar</java>
    </module>
    <module>
+	   <java>picketlink-idm-1.1.5.CR01.jar</java>
+   </module>
+   <module>
 	   <java>portletbridge-api.jar</java>
    </module>
    <module>

Modified: labs/jbossforums/branches/forums130P27/forums/src/resources/portal-forums-ear/META-INF/security-config.xml
===================================================================
--- labs/jbossforums/branches/forums130P27/forums/src/resources/portal-forums-ear/META-INF/security-config.xml	2010-10-13 07:46:05 UTC (rev 35498)
+++ labs/jbossforums/branches/forums130P27/forums/src/resources/portal-forums-ear/META-INF/security-config.xml	2010-10-13 07:47:25 UTC (rev 35499)
@@ -23,7 +23,7 @@
 <policy>
 	<application-policy name="forums">       
        <authentication>
-          <login-module code="org.jboss.portal.identity.auth.IdentityLoginModule" flag="required">
+          <login-module code="org.jboss.portal.identity.auth.IdentityLoginModule" flag="sufficient">
             <module-option name="unauthenticatedIdentity">guest</module-option>
             <module-option name="userModuleJNDIName">java:/portal/UserModule</module-option>
             <module-option name="roleModuleJNDIName">java:/portal/RoleModule</module-option>
@@ -32,6 +32,15 @@
             <module-option name="additionalRole">Authenticated</module-option>
             <module-option name="password-stacking">useFirstPass</module-option>
          </login-module>
+         <login-module code="org.picketlink.idm.auth.JBossIdentityIDMLoginModule" flag="required">
+            <module-option name="unauthenticatedIdentity">guest</module-option>
+            <module-option name="userModuleJNDIName">java:/portal/UserModule</module-option>
+            <module-option name="roleModuleJNDIName">java:/portal/RoleModule</module-option>
+            <module-option name="userProfileModuleJNDIName">java:/portal/UserProfileModule</module-option>
+            <module-option name="membershipModuleJNDIName">java:/portal/MembershipModule</module-option>
+            <module-option name="additionalRole">Authenticated</module-option>
+            <module-option name="password-stacking">useFirstPass</module-option>
+         </login-module>
        </authentication>
     </application-policy>
 </policy>

Modified: labs/jbossforums/branches/forums130P27/forums/src/resources/portal-forums-ha-as5-ear/META-INF/application.xml
===================================================================
--- labs/jbossforums/branches/forums130P27/forums/src/resources/portal-forums-ha-as5-ear/META-INF/application.xml	2010-10-13 07:46:05 UTC (rev 35498)
+++ labs/jbossforums/branches/forums130P27/forums/src/resources/portal-forums-ha-as5-ear/META-INF/application.xml	2010-10-13 07:47:25 UTC (rev 35499)
@@ -23,6 +23,9 @@
 	   <java>jsf-example.jar</java>
    </module>
    <module>
+	   <java>picketlink-idm-1.1.5.CR01.jar</java>
+   </module>
+   <module>
 	   <java>portletbridge-api.jar</java>
    </module>
    <module>

Modified: labs/jbossforums/branches/forums130P27/forums/src/resources/portal-forums-ha-as5-ear/META-INF/security-config.xml
===================================================================
--- labs/jbossforums/branches/forums130P27/forums/src/resources/portal-forums-ha-as5-ear/META-INF/security-config.xml	2010-10-13 07:46:05 UTC (rev 35498)
+++ labs/jbossforums/branches/forums130P27/forums/src/resources/portal-forums-ha-as5-ear/META-INF/security-config.xml	2010-10-13 07:47:25 UTC (rev 35499)
@@ -23,7 +23,7 @@
 <policy>
 	<application-policy name="forums">       
        <authentication>
-<login-module code="org.jboss.portal.identity.auth.IdentityLoginModule" flag="required">             
+<login-module code="org.jboss.portal.identity.auth.IdentityLoginModule" flag="sufficient">             
     <module-option name="unauthenticatedIdentity">guest</module-option>
 	<module-option name="userModuleJNDIName">java:/portal/UserModule</module-option>
 	<module-option name="roleModuleJNDIName">java:/portal/RoleModule</module-option>
@@ -32,6 +32,15 @@
 	<module-option name="additionalRole">Authenticated</module-option>
 	<module-option name="password-stacking">useFirstPass</module-option>
 </login-module>
+         <login-module code="org.picketlink.idm.auth.JBossIdentityIDMLoginModule" flag="required">
+            <module-option name="unauthenticatedIdentity">guest</module-option>
+            <module-option name="userModuleJNDIName">java:/portal/UserModule</module-option>
+            <module-option name="roleModuleJNDIName">java:/portal/RoleModule</module-option>
+            <module-option name="userProfileModuleJNDIName">java:/portal/UserProfileModule</module-option>
+            <module-option name="membershipModuleJNDIName">java:/portal/MembershipModule</module-option>
+            <module-option name="additionalRole">Authenticated</module-option>
+            <module-option name="password-stacking">useFirstPass</module-option>
+         </login-module>
 </authentication>
 </application-policy>
 </policy>

Modified: labs/jbossforums/branches/forums130P27/forums/src/resources/portal-forums-ha-ear/META-INF/application.xml
===================================================================
--- labs/jbossforums/branches/forums130P27/forums/src/resources/portal-forums-ha-ear/META-INF/application.xml	2010-10-13 07:46:05 UTC (rev 35498)
+++ labs/jbossforums/branches/forums130P27/forums/src/resources/portal-forums-ha-ear/META-INF/application.xml	2010-10-13 07:47:25 UTC (rev 35499)
@@ -23,6 +23,9 @@
 	   <java>jsf-example.jar</java>
    </module>
    <module>
+	   <java>picketlink-idm-1.1.5.CR01.jar</java>
+   </module>
+   <module>
 	   <java>portletbridge-api.jar</java>
    </module>
    <module>

Modified: labs/jbossforums/branches/forums130P27/forums/src/resources/portal-forums-ha-ear/META-INF/security-config.xml
===================================================================
--- labs/jbossforums/branches/forums130P27/forums/src/resources/portal-forums-ha-ear/META-INF/security-config.xml	2010-10-13 07:46:05 UTC (rev 35498)
+++ labs/jbossforums/branches/forums130P27/forums/src/resources/portal-forums-ha-ear/META-INF/security-config.xml	2010-10-13 07:47:25 UTC (rev 35499)
@@ -23,7 +23,7 @@
 <policy>
 	<application-policy name="forums">       
        <authentication>
-<login-module code="org.jboss.portal.identity.auth.IdentityLoginModule" flag="required">             
+<login-module code="org.jboss.portal.identity.auth.IdentityLoginModule" flag="sufficient">             
     <module-option name="unauthenticatedIdentity">guest</module-option>
 	<module-option name="userModuleJNDIName">java:/portal/UserModule</module-option>
 	<module-option name="roleModuleJNDIName">java:/portal/RoleModule</module-option>
@@ -32,6 +32,15 @@
 	<module-option name="additionalRole">Authenticated</module-option>
 	<module-option name="password-stacking">useFirstPass</module-option>
 </login-module>
+         <login-module code="org.picketlink.idm.auth.JBossIdentityIDMLoginModule" flag="required">
+            <module-option name="unauthenticatedIdentity">guest</module-option>
+            <module-option name="userModuleJNDIName">java:/portal/UserModule</module-option>
+            <module-option name="roleModuleJNDIName">java:/portal/RoleModule</module-option>
+            <module-option name="userProfileModuleJNDIName">java:/portal/UserProfileModule</module-option>
+            <module-option name="membershipModuleJNDIName">java:/portal/MembershipModule</module-option>
+            <module-option name="additionalRole">Authenticated</module-option>
+            <module-option name="password-stacking">useFirstPass</module-option>
+         </login-module>
 </authentication>
 </application-policy>
 </policy>

Added: labs/jbossforums/branches/forums130P27/thirdparty/picketlink/README.txt
===================================================================
--- labs/jbossforums/branches/forums130P27/thirdparty/picketlink/README.txt	                        (rev 0)
+++ labs/jbossforums/branches/forums130P27/thirdparty/picketlink/README.txt	2010-10-13 07:47:25 UTC (rev 35499)
@@ -0,0 +1,3 @@
+picketlink-idm-1.1.5.CR01.jar
+licence : LGPL
+


Property changes on: labs/jbossforums/branches/forums130P27/thirdparty/picketlink/README.txt
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: labs/jbossforums/branches/forums130P27/thirdparty/picketlink/lib/picketlink-idm-1.1.5.CR01.jar
===================================================================
(Binary files differ)


Property changes on: labs/jbossforums/branches/forums130P27/thirdparty/picketlink/lib/picketlink-idm-1.1.5.CR01.jar
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Modified: labs/jbossforums/branches/forums130P27/tools/etc/buildfragments/libraries.ent
===================================================================
--- labs/jbossforums/branches/forums130P27/tools/etc/buildfragments/libraries.ent	2010-10-13 07:46:05 UTC (rev 35498)
+++ labs/jbossforums/branches/forums130P27/tools/etc/buildfragments/libraries.ent	2010-10-13 07:47:25 UTC (rev 35499)
@@ -140,6 +140,13 @@
     <filelist dir="${facelets.lib}" files="jsf-facelets.jar,el-api.jar,el-ri.jar,jsf-example.jar"/>
   </path>
 
+  <!-- Picketlink -->
+  <property name="picketlink.root" value="${project.thirdparty}/picketlink"/>
+  <property name="picketlink.lib" value="${picketlink.root}/lib"/>
+  <path id="picketlink.classpath">
+    <filelist dir="${picketlink.lib}" files="picketlink-idm-1.1.5.CR01.jar"/>
+  </path>
+
   <!-- Hibernate -->
   <property name="jboss.hibernate.root" value="${project.thirdparty}/jboss-hibernate"/>
   <property name="jboss.hibernate.lib" value="${jboss.hibernate.root}/lib"/>
@@ -170,6 +177,15 @@
     <filelist dir="${portlet.lib}" files="portlet-api.jar"/>
   </path>
 
+  <!-- Picketlink dependency -->
+  <property name="picketlink.root" value="${project.thirdparty}/picketlink"/>
+  <property name="picketlink.lib" value="${picketlink.root}/lib"/>
+  <path id="picketlink.classpath">
+    <filelist dir="${picketlink.lib}" 
+		files="picketlink-idm-1.1.5.CR01.jar"
+   />
+  </path>
+
   <!-- JBoss Portal Core dependency -->
   <property name="jbportal.root" value="${project.thirdparty}/jbportal"/>
   <property name="jbportal.lib" value="${jbportal.root}/lib"/>



More information about the jboss-svn-commits mailing list