JBoss Portal SVN: r6243 - in trunk/core-search/src/resources/portal-search-war/WEB-INF: classes and 1 other directory.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2007-02-13 06:35:34 -0500 (Tue, 13 Feb 2007)
New Revision: 6243
Added:
trunk/core-search/src/resources/portal-search-war/WEB-INF/classes/
trunk/core-search/src/resources/portal-search-war/WEB-INF/classes/Resource.properties
Modified:
trunk/core-search/src/resources/portal-search-war/WEB-INF/default-object.xml
trunk/core-search/src/resources/portal-search-war/WEB-INF/portlet.xml
Log:
Search portlet localization (easiest part of)
Added: trunk/core-search/src/resources/portal-search-war/WEB-INF/classes/Resource.properties
===================================================================
--- trunk/core-search/src/resources/portal-search-war/WEB-INF/classes/Resource.properties (rev 0)
+++ trunk/core-search/src/resources/portal-search-war/WEB-INF/classes/Resource.properties 2007-02-13 11:35:34 UTC (rev 6243)
@@ -0,0 +1,25 @@
+################################################################################
+# 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. #
+################################################################################
+
+SEARCH_SEARCH=Search
+
\ No newline at end of file
Modified: trunk/core-search/src/resources/portal-search-war/WEB-INF/default-object.xml
===================================================================
--- trunk/core-search/src/resources/portal-search-war/WEB-INF/default-object.xml 2007-02-13 03:52:54 UTC (rev 6242)
+++ trunk/core-search/src/resources/portal-search-war/WEB-INF/default-object.xml 2007-02-13 11:35:34 UTC (rev 6243)
@@ -30,7 +30,7 @@
<deployment>
<parent-ref>default</parent-ref>
<page>
- <page-name>default</page-name>
+ <page-name>search</page-name>
<window>
<window-name>SearchPortletWindow</window-name>
<instance-ref>SearchPortletInstance</instance-ref>
Modified: trunk/core-search/src/resources/portal-search-war/WEB-INF/portlet.xml
===================================================================
--- trunk/core-search/src/resources/portal-search-war/WEB-INF/portlet.xml 2007-02-13 03:52:54 UTC (rev 6242)
+++ trunk/core-search/src/resources/portal-search-war/WEB-INF/portlet.xml 2007-02-13 11:35:34 UTC (rev 6243)
@@ -37,6 +37,8 @@
<mime-type>text/html</mime-type>
<portlet-mode>VIEW</portlet-mode>
</supports>
+ <supported-locale>en</supported-locale>
+ <resource-bundle>Resource</resource-bundle>
<portlet-info>
<title>Search Portlet</title>
</portlet-info>
19 years, 2 months
JBoss Portal SVN: r6242 - in trunk: identity/src/main/org/jboss/portal/identity and 5 other directories.
by portal-commits@lists.jboss.org
Author: bdaw
Date: 2007-02-12 22:52:54 -0500 (Mon, 12 Feb 2007)
New Revision: 6242
Added:
trunk/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPExtUserModuleTestCase.java
trunk/identity/src/resources/test/config/extuser/
trunk/identity/src/resources/test/config/extuser/opends-config.xml
trunk/test/src/etc/directories-extusermodule.xml
Modified:
trunk/identity/build.xml
trunk/identity/src/main/org/jboss/portal/identity/IdentityConfiguration.java
trunk/identity/src/main/org/jboss/portal/identity/ldap/LDAPExtRoleModuleImpl.java
trunk/identity/src/main/org/jboss/portal/identity/ldap/LDAPExtUserModuleImpl.java
trunk/identity/src/main/org/jboss/portal/identity/ldap/LDAPRoleImpl.java
trunk/identity/src/main/org/jboss/portal/identity/ldap/LDAPRoleModule.java
trunk/identity/src/main/org/jboss/portal/identity/ldap/LDAPRoleModuleImpl.java
trunk/identity/src/main/org/jboss/portal/identity/ldap/LDAPStaticGroupMembershipModuleImpl.java
trunk/identity/src/main/org/jboss/portal/identity/ldap/LDAPStaticRoleMembershipModuleImpl.java
trunk/identity/src/main/org/jboss/portal/identity/ldap/LDAPUserModule.java
trunk/identity/src/main/org/jboss/portal/identity/ldap/LDAPUserModuleImpl.java
trunk/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPSimpleRoleModuleTestCase.java
trunk/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPSimpleUserModuleTestCase.java
trunk/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPTestCase.java
Log:
- ext implementation of LDAP user module
- ext implementation of LDAP role module
- change ldap role impl to use DN as an id
Modified: trunk/identity/build.xml
===================================================================
--- trunk/identity/build.xml 2007-02-13 03:37:46 UTC (rev 6241)
+++ trunk/identity/build.xml 2007-02-13 03:52:54 UTC (rev 6242)
@@ -394,6 +394,7 @@
<test todir="${test.reports}" name="org.jboss.portal.test.identity.ldap.LDAPStaticGroupMembershipModuleTestCase"/>
<test todir="${test.reports}" name="org.jboss.portal.test.identity.ldap.LDAPStaticRoleMembershipModuleTestCase"/>
<test todir="${test.reports}" name="org.jboss.portal.test.identity.ldap.LDAPUserProfileModuleTestCase"/>
+ <test todir="${test.reports}" name="org.jboss.portal.test.identity.ldap.LDAPExtUserModuleTestCase"/>
</x-test>
@@ -457,6 +458,7 @@
<test todir="${test.reports}" name="org.jboss.portal.test.identity.ldap.LDAPStaticGroupMembershipModuleTestCase"/>
<test todir="${test.reports}" name="org.jboss.portal.test.identity.ldap.LDAPStaticRoleMembershipModuleTestCase"/>
<test todir="${test.reports}" name="org.jboss.portal.test.identity.ldap.LDAPUserProfileModuleTestCase"/>
+ <test todir="${test.reports}" name="org.jboss.portal.test.identity.ldap.LDAPExtUserModuleTestCase"/>
</x-test>
<x-classpath>
<pathelement location="${build.lib}/portal-identity-lib.jar"/>
Modified: trunk/identity/src/main/org/jboss/portal/identity/IdentityConfiguration.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/identity/IdentityConfiguration.java 2007-02-13 03:37:46 UTC (rev 6241)
+++ trunk/identity/src/main/org/jboss/portal/identity/IdentityConfiguration.java 2007-02-13 03:52:54 UTC (rev 6242)
@@ -70,9 +70,10 @@
public static final String USER_EMAIL_ATTRIBUTE_ID = "emailAttributeID";
- //TODO:
- public static final String USER_BASE_FILTER = "userBaseFilter";
+ public static final String USER_SEARCH_CTX_DN = "userSearchCtxDN";
+ public static final String USER_SEARCH_FILTER = "userSearchFilter";
+
public static final String ROLE_CONTAINER_DN = "roleContainerDN";
public static final String ROLE_RID_ATTRIBUTE_ID = "ridAttributeID";
@@ -83,7 +84,7 @@
public static final String ROLE_RECURSION = "roleRecursion";
//TODO:
- public static final String ROLE_BASE_FILTER = "roleBaseFilter";
+ public static final String ROLE_SEARCH_FILTER = "roleSearchFilter";
//TODO:
public static final String ROLE_CONTEXT_DN = "rolesCtxDN";
@@ -93,10 +94,10 @@
public static final String MEMBERSHIP_ATTRIBUTE_IS_DN = "membershipAttributeIsDN";
- //TODO:
+ //TODO: check if this is applied to every search in modules
public static final String SEARCH_TIME_LIMIT = "searchTimeLimit";
- //TODO:
+ //TODO: check if this is applied to role searches in role and membership modules
public static final String SEARCH_SCOPE = "searchScope";
Modified: trunk/identity/src/main/org/jboss/portal/identity/ldap/LDAPExtRoleModuleImpl.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/identity/ldap/LDAPExtRoleModuleImpl.java 2007-02-13 03:37:46 UTC (rev 6241)
+++ trunk/identity/src/main/org/jboss/portal/identity/ldap/LDAPExtRoleModuleImpl.java 2007-02-13 03:52:54 UTC (rev 6242)
@@ -24,8 +24,18 @@
import org.jboss.portal.identity.IdentityException;
import org.jboss.portal.identity.Role;
+import org.jboss.portal.common.util.Tools;
+import javax.naming.NamingEnumeration;
+import javax.naming.NamingException;
+import javax.naming.directory.SearchControls;
+import javax.naming.directory.SearchResult;
+import javax.naming.directory.DirContext;
import java.util.Set;
+import java.util.List;
+import java.util.NoSuchElementException;
+import java.util.HashSet;
+import java.util.Iterator;
/**
* @author <a href="mailto:boleslaw.dawidowicz@jboss.org">Boleslaw Dawidowicz</a>
@@ -33,25 +43,90 @@
*/
public class LDAPExtRoleModuleImpl extends LDAPRoleModuleImpl
{
+ private static final org.jboss.logging.Logger log = org.jboss.logging.Logger.getLogger(LDAPExtRoleModuleImpl.class);
public Role findRoleByName(String name) throws IdentityException, IllegalArgumentException
{
- throw new UnsupportedOperationException("Not yet implemented");
+ try
+ {
+ log.debug("findRoleByName(): name = " + name);
+
+ if (name == null)
+ {
+ throw new IdentityException("Role name canot be null");
+ }
+
+
+ String filter = getRoleSearchFilter();
+ log.debug("Search filter: " + filter);
+
+
+ Object[] filterArgs = {name};
+ NamingEnumeration results = searchRoles(filter, filterArgs);
+ List sr = Tools.toList(results);
+ if (sr.size() > 1)
+ {
+ throw new IdentityException("Found more than one role with id: " + name + "" +
+ "Posible data inconsistency");
+ }
+ SearchResult res = (SearchResult)sr.iterator().next();
+ DirContext ctx = (DirContext)res.getObject();
+ return createRoleInstance(res.getAttributes(),ctx.getNameInNamespace());
+
+ }
+ catch (NoSuchElementException e)
+ {
+ log.debug("No role found with name: " + name, e);
+ }
+ catch (NamingException e)
+ {
+ throw new IdentityException("Role search failed.", e);
+ }
+ throw new IdentityException("No role found with name: " + name);
}
public Set findRolesByNames(String[] names) throws IdentityException, IllegalArgumentException
{
- throw new UnsupportedOperationException("Not yet implemented");
- }
+ if (names == null)
+ {
+ throw new IllegalArgumentException("null argument");
+ }
- public Role findRoleById(Object id) throws IdentityException, IllegalArgumentException
- {
- throw new UnsupportedOperationException("Not yet implemented");
- }
+ Set roles = new HashSet();
- public Role findRoleById(String id) throws IdentityException, IllegalArgumentException
- {
- throw new UnsupportedOperationException("Not yet implemented");
+ try
+ {
+ //construct a filter with all role names
+ StringBuffer filter = new StringBuffer("(| ");
+
+ String searchFilter = getRoleSearchFilter();
+
+ for (int i = 0; i < names.length; i++)
+ {
+ String name = names[i];
+
+ String namedFilter = searchFilter.replaceAll("\\{0\\}", name);
+ filter.append(namedFilter);
+ }
+ filter.append(")");
+
+ NamingEnumeration results = searchRoles(filter.toString(), null);
+ List sr = Tools.toList(results);
+ log.debug("Roles found: " + sr.size());
+ for (Iterator iterator = sr.iterator(); iterator.hasNext();)
+ {
+ SearchResult res = (SearchResult)iterator.next();
+ DirContext ctx = (DirContext)res.getObject();
+ roles.add(createRoleInstance(res.getAttributes(),ctx.getNameInNamespace()));
+ }
+ }
+ catch (Exception e)
+ {
+ throw new IdentityException("Can't retreive roles", e);
+ }
+
+ return roles;
+
}
public Role createRole(String name, String displayName) throws IdentityException, IllegalArgumentException
@@ -66,11 +141,93 @@
public int getRolesCount() throws IdentityException
{
- throw new UnsupportedOperationException("Not yet implemented");
+ try
+ {
+ //search all entries
+ String filter = getRoleSearchFilter();
+ //* chars are escaped in filterArgs so we must replace it manually
+ filter = filter.replaceAll("\\{0\\}", "*");
+ log.debug("Search filter: " + filter);
+
+ NamingEnumeration results = searchRoles(filter, null);
+ List sr = Tools.toList(results);
+
+ return sr.size();
+
+ }
+ catch (NoSuchElementException e)
+ {
+ log.debug("No roles found", e);
+ }
+ catch (Exception e)
+ {
+ throw new IdentityException("Role search failed.", e);
+ }
+ return 0;
}
public Set findRoles() throws IdentityException
{
- throw new UnsupportedOperationException("Not yet implemented");
+ Set rf = new HashSet();
+ try
+ {
+ //search all entries
+ String filter = getRoleSearchFilter();
+ //* chars are escaped in filterArgs so we must replace it manually
+ filter = filter.replaceAll("\\{0\\}", "*");
+ log.debug("Search filter: " + filter);
+
+ NamingEnumeration results = searchRoles(filter, null);
+ while (results.hasMoreElements())
+ {
+ SearchResult res = (SearchResult)results.nextElement();
+ DirContext ctx = (DirContext)res.getObject();
+ rf.add(createRoleInstance(res.getAttributes(),ctx.getNameInNamespace()));
+ }
+ }
+ catch (NoSuchElementException e)
+ {
+ log.debug("No roles found", e);
+ }
+ catch (Exception e)
+ {
+ throw new IdentityException("Role search failed.", e);
+ }
+ return rf;
}
+
+ /**
+ * This method should be used by over modules to perform searches. It will allow user module
+ * implementation to apply proper filter and search scope from the configuration
+ *
+ * @param filter that will be concatenated with proper user search filter from the module
+ * @return
+ */
+ public NamingEnumeration searchRoles(String filter, Object[] filterArgs) throws NamingException, IdentityException
+ {
+ SearchControls controls = new SearchControls();
+ controls.setSearchScope(getSearchScope());
+ controls.setReturningObjFlag(true);
+ controls.setTimeLimit(getSearchTimeLimit());
+
+ log.debug("Search filter: " + filter);
+ if (log.isDebugEnabled() && filterArgs != null)
+ {
+ for (int i = 0; i < filterArgs.length; i++)
+ {
+ Object filterArg = filterArgs[i];
+ log.debug("Search filterArg: {" + i + "}: " + filterArg);
+ }
+ }
+ log.debug("Search ctx: " + getRoleCtxDN());
+
+ if (filterArgs == null)
+ {
+ return getConnectionContext().createInitialContext().search(getRoleCtxDN(), filter, controls);
+ }
+ else
+ {
+ return getConnectionContext().createInitialContext().search(getRoleCtxDN(), filter, filterArgs, controls);
+ }
+ }
}
Modified: trunk/identity/src/main/org/jboss/portal/identity/ldap/LDAPExtUserModuleImpl.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/identity/ldap/LDAPExtUserModuleImpl.java 2007-02-13 03:37:46 UTC (rev 6241)
+++ trunk/identity/src/main/org/jboss/portal/identity/ldap/LDAPExtUserModuleImpl.java 2007-02-13 03:52:54 UTC (rev 6242)
@@ -25,8 +25,18 @@
import org.jboss.portal.identity.IdentityException;
import org.jboss.portal.identity.NoSuchUserException;
import org.jboss.portal.identity.User;
+import org.jboss.portal.common.util.Tools;
+import javax.naming.NamingEnumeration;
+import javax.naming.Context;
+import javax.naming.NamingException;
+import javax.naming.directory.SearchResult;
+import javax.naming.directory.SearchControls;
import java.util.Set;
+import java.util.List;
+import java.util.NoSuchElementException;
+import java.util.HashSet;
+import java.util.Collections;
/**
* @author <a href="mailto:boleslaw.dawidowicz@jboss.org">Boleslaw Dawidowicz</a>
@@ -34,20 +44,56 @@
*/
public class LDAPExtUserModuleImpl extends LDAPUserModuleImpl
{
+ private static final org.jboss.logging.Logger log = org.jboss.logging.Logger.getLogger(LDAPExtUserModuleImpl.class);
public User findUserByUserName(String userName) throws IdentityException, IllegalArgumentException, NoSuchUserException
{
- throw new UnsupportedOperationException("Not yet implemented");
- }
+ try
+ {
+ log.debug("findUserByUserName(): username = " + userName);
- public User findUserById(Object id) throws IdentityException, IllegalArgumentException, NoSuchUserException
- {
- throw new UnsupportedOperationException("Not yet implemented");
+ if (userName == null)
+ {
+ throw new IdentityException("User name canot be null");
+ }
+
+ String filter = getUserSearchFilter();
+ log.debug("Search filter: " + filter);
+
+ Object[] filterArgs = {userName};
+ NamingEnumeration results = searchUsers(filter, filterArgs);
+ List sr = Tools.toList(results);
+ if (sr.size() > 1)
+ {
+ throw new IdentityException("Found more than one user with id: " + userName + "" +
+ "Posible data inconsistency");
+ }
+ SearchResult res = (SearchResult)sr.iterator().next();
+ Context ctx = (Context)res.getObject();
+ String dn = ctx.getNameInNamespace();
+ return createUserInstance(res.getAttributes(), dn);
+
+ }
+ catch (NoSuchElementException e)
+ {
+ log.debug("No user found with name: " + userName, e);
+
+ }
+ catch (NamingException e)
+ {
+ throw new IdentityException("User search failed.", e);
+ }
+ throw new NoSuchUserException("No user found with name: " + userName);
}
- public User findUserById(String id) throws IdentityException, IllegalArgumentException, NoSuchUserException
+ //findUserById(Object id) from super
+
+
+ //findUserById(String id) from super
+
+ public User createUser(String userName, String password) throws IdentityException, IllegalArgumentException
{
- throw new UnsupportedOperationException("Not yet implemented");
+ throw new UnsupportedOperationException("User management is not supported in this implementation of UserModule");
}
public User createUser(String userName, String password, String realEmail) throws IdentityException, IllegalArgumentException
@@ -60,18 +106,126 @@
throw new UnsupportedOperationException("User management is not supported in this implementation of UserModule");
}
+
+ //TODO: offset limit
public Set findUsers(int offset, int limit) throws IdentityException, IllegalArgumentException
{
- throw new UnsupportedOperationException("Not yet implemented");
+ return findUsersFilteredByUserName("*", offset, limit);
}
public Set findUsersFilteredByUserName(String filter, int offset, int limit) throws IdentityException, IllegalArgumentException
{
- throw new UnsupportedOperationException("Not yet implemented");
+ Set uf = new HashSet();
+ try
+ {
+ log.debug("findUserFilteredByUserName(): filter = " + filter);
+
+ if (filter == null)
+ {
+ throw new IllegalArgumentException("Null user name filter");
+ }
+
+ log.info("Current implementation of findUsersFilteredByUserName returns all users and is not \"offset\" and \"limit\" sensitive ");
+
+ if (filter.length() == 0)
+ {
+ filter = "*";
+ }
+ else if (!(filter.length() == 1 && filter.equals("*")))
+ {
+ filter = "*" + filter + "*";
+ }
+
+ String ldap_filter = getUserSearchFilter();
+
+ //* chars are escaped in filterArgs so we must replace it manually
+ ldap_filter = ldap_filter.replaceAll("\\{0\\}", filter);
+ log.debug("Search filter: " + ldap_filter);
+
+ //Object[] filterArgs = {filter};
+ NamingEnumeration results = searchUsers(ldap_filter, null);
+ while (results.hasMoreElements())
+ {
+ SearchResult res = (SearchResult)results.nextElement();
+ Context ctx = (Context)res.getObject();
+ String dn = ctx.getNameInNamespace();
+ uf.add(createUserInstance(res.getAttributes(), dn));
+ }
+
+ }
+ catch (NoSuchElementException e)
+ {
+ log.debug("No user found using filter: " + filter, e);
+
+ }
+ catch (NamingException e)
+ {
+ throw new IdentityException("User search failed.", e);
+ }
+ return uf;
}
public int getUserCount() throws IdentityException, IllegalArgumentException
{
- throw new UnsupportedOperationException("Not yet implemented");
+ try
+ {
+ //search all entries containing "uid" attribute
+ String filter = getUserSearchFilter();
+ log.debug("Search filter: " + filter);
+
+ //* chars are escaped in filterArgs so we must replace it manually
+ filter = filter.replaceAll("\\{0\\}", "*");
+ NamingEnumeration results = searchUsers(filter, null);
+ List sr = Tools.toList(results);
+
+ return sr.size();
+ }
+ catch (NoSuchElementException e)
+ {
+ log.debug("No users found", e);
+ }
+ catch (Exception e)
+ {
+ throw new IdentityException("User search failed.", e);
+ }
+ return 0;
}
+
+
+
+
+ /**
+ * This method should be used by over modules to perform searches. It will allow user module
+ * implementation to apply proper filter and search scope from the configuration
+ *
+ * @param filter that will be concatenated with proper user search filter from the module
+ * @return
+ */
+ public NamingEnumeration searchUsers(String filter, Object[] filterArgs) throws NamingException, IdentityException
+ {
+ SearchControls controls = new SearchControls();
+ controls.setSearchScope(SearchControls.SUBTREE_SCOPE);
+ controls.setReturningObjFlag(true);
+ controls.setTimeLimit(getSearchTimeLimit());
+
+ log.debug("Search filter: " + filter);
+ if (log.isDebugEnabled() && filterArgs != null)
+ {
+ for (int i = 0; i < filterArgs.length; i++)
+ {
+ Object filterArg = filterArgs[i];
+ log.debug("Search filterArg: {" + i + "}: " + filterArg);
+ }
+ }
+ log.debug("Search ctx: " + getUserSearchCtxDN());
+
+ if (filterArgs == null)
+ {
+ return getConnectionContext().createInitialContext().search(getUserSearchCtxDN(), filter, controls);
+ }
+ else
+ {
+ return getConnectionContext().createInitialContext().search(getUserSearchCtxDN(), filter, filterArgs, controls);
+ }
+ }
}
Modified: trunk/identity/src/main/org/jboss/portal/identity/ldap/LDAPRoleImpl.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/identity/ldap/LDAPRoleImpl.java 2007-02-13 03:37:46 UTC (rev 6241)
+++ trunk/identity/src/main/org/jboss/portal/identity/ldap/LDAPRoleImpl.java 2007-02-13 03:52:54 UTC (rev 6242)
@@ -38,6 +38,8 @@
private String dn;
+ private String name;
+
private String id;
private String displayName;
@@ -49,7 +51,7 @@
}
- protected LDAPRoleImpl(String dn, IdentityContext context, String id, String display)
+ protected LDAPRoleImpl(String dn, IdentityContext context, String id, String name, String displayName)
{
if (dn == null)
{
@@ -67,20 +69,26 @@
throw new IllegalArgumentException("Id can't be null");
}
- if (display == null)
+ if (name == null)
{
- throw new IllegalArgumentException("displayName can't be null");
+ throw new IllegalArgumentException("Name can't be null");
}
+ if (displayName == null)
+ {
+ throw new IllegalArgumentException("DisplayName can't be null");
+ }
+
this.identityContext = context;
this.id = id;
- this.displayName = display;
+ this.name = name;
+ this.displayName = displayName;
this.dn = dn;
}
public String getName()
{
- return this.id;
+ return this.name;
}
public String getDisplayName()
@@ -88,6 +96,7 @@
return displayName;
}
+ //TODO: testcase this
public void setDisplayName(String name)
{
if (name == null)
Modified: trunk/identity/src/main/org/jboss/portal/identity/ldap/LDAPRoleModule.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/identity/ldap/LDAPRoleModule.java 2007-02-13 03:37:46 UTC (rev 6241)
+++ trunk/identity/src/main/org/jboss/portal/identity/ldap/LDAPRoleModule.java 2007-02-13 03:52:54 UTC (rev 6242)
@@ -31,6 +31,7 @@
import javax.naming.directory.BasicAttributes;
import javax.naming.directory.BasicAttribute;
import javax.naming.directory.DirContext;
+import javax.naming.directory.SearchControls;
import javax.naming.NamingException;
import javax.naming.NamingEnumeration;
import javax.naming.InitialContext;
@@ -103,7 +104,8 @@
{
throw new IdentityException("LDAP entry doesn't contain proper attribute:" + getDisplayNameAttributeID());
}
- ldapr = new LDAPRoleImpl(dn, getIdentityContext(), uida.get().toString(), display.get().toString());
+ ldapr = new LDAPRoleImpl(dn, getIdentityContext(), dn, uida.get().toString(), display.get().toString());
+ //ldapr.setDisplayName(display.get().toString());
@@ -139,7 +141,7 @@
if (attrs == null)
{
- throw new IdentityException("Can't find user entry with DN: " + dn);
+ throw new IdentityException("Can't find role entry with DN: " + dn);
}
return createRoleInstance(attrs, dn);
@@ -147,11 +149,11 @@
}
catch (NoSuchElementException e)
{
- log.debug("No user found with dn: " + dn, e);
+ log.debug("No role found with dn: " + dn, e);
}
catch (NamingException e)
{
- throw new IdentityException("User search failed.", e);
+ throw new IdentityException("Role search failed.", e);
}
return null;
}
@@ -163,7 +165,7 @@
* @param filter that will be concatenated with proper role search filter from the module
* @return
*/
- public abstract NamingEnumeration searchRoles(String filter) throws NamingException, IdentityException;
+ public abstract NamingEnumeration searchRoles(String filter, Object[] filterArgs) throws NamingException, IdentityException;
//**************************
//*** Getter and Setters
@@ -209,6 +211,80 @@
return display;
}
+ protected int getSearchTimeLimit() throws IdentityException
+ {
+ int searchTimeout = 10000;
+ String limit = getIdentityConfiguration().getValue(IdentityConfiguration.SEARCH_TIME_LIMIT);
+ if (limit != null)
+ {
+ try
+ {
+ searchTimeout = Integer.parseInt(limit);
+ }
+ catch (NumberFormatException e)
+ {
+ log.info(IdentityConfiguration.SEARCH_TIME_LIMIT + "wrong value:" + e);
+ }
+ }
+ return searchTimeout;
+ }
+
+ protected int getSearchScope() throws IdentityException
+ {
+ int searchScope = SearchControls.ONELEVEL_SCOPE;
+ String scope = getIdentityConfiguration().getValue(IdentityConfiguration.SEARCH_SCOPE);
+ if (scope != null)
+ {
+ if ("OBJECT_SCOPE".equalsIgnoreCase(scope))
+ searchScope = SearchControls.OBJECT_SCOPE;
+ else if ("ONELEVEL_SCOPE".equalsIgnoreCase(scope))
+ searchScope = SearchControls.ONELEVEL_SCOPE;
+ else if ("SUBTREE_SCOPE".equalsIgnoreCase(scope))
+ searchScope = SearchControls.SUBTREE_SCOPE;
+ }
+ return searchScope;
+ }
+
+ protected String getRoleCtxDN() throws IdentityException
+ {
+ String roleCtx = getIdentityConfiguration().getValue(IdentityConfiguration.ROLE_CONTEXT_DN);
+ if (roleCtx == null)
+ {
+ throw new IdentityException("Configuration option missing: " + IdentityConfiguration.ROLE_CONTEXT_DN);
+ }
+ return roleCtx;
+ }
+
+ protected String getRoleSearchFilter() throws IdentityException
+ {
+ String searchFilter = getIdentityConfiguration().getValue(IdentityConfiguration.ROLE_SEARCH_FILTER);
+ if (searchFilter == null)
+ {
+ throw new IdentityException(IdentityConfiguration.ROLE_SEARCH_FILTER + " missing in configuration");
+ }
+ else
+ {
+ return searchFilter;
+ }
+ }
+
+ protected int getRoleRecurtion() throws IdentityException
+ {
+ int recurtion = 0;
+ String rr = getIdentityConfiguration().getValue(IdentityConfiguration.ROLE_RECURSION);
+ if (rr != null)
+ {
+ try
+ {
+ recurtion = Integer.parseInt(rr);
+ }
+ catch (NumberFormatException e)
+ {
+ log.warn(IdentityConfiguration.ROLE_RECURSION + " wrong value - disabling recurtion:" + e);
+ }
+ }
+ return recurtion;
+ }
}
Modified: trunk/identity/src/main/org/jboss/portal/identity/ldap/LDAPRoleModuleImpl.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/identity/ldap/LDAPRoleModuleImpl.java 2007-02-13 03:37:46 UTC (rev 6241)
+++ trunk/identity/src/main/org/jboss/portal/identity/ldap/LDAPRoleModuleImpl.java 2007-02-13 03:52:54 UTC (rev 6242)
@@ -71,7 +71,7 @@
log.debug("Search filter: " + filter);
- NamingEnumeration results = searchRoles(filter);
+ NamingEnumeration results = searchRoles(filter, null);
List sr = Tools.toList(results);
if (sr.size() > 1)
{
@@ -117,8 +117,9 @@
}
filter.append(")");
- NamingEnumeration results = searchRoles(filter.toString());
+ NamingEnumeration results = searchRoles(filter.toString(), null);
List sr = Tools.toList(results);
+ log.debug("Roles found: " + sr.size());
for (Iterator iterator = sr.iterator(); iterator.hasNext();)
{
SearchResult res = (SearchResult)iterator.next();
@@ -150,7 +151,7 @@
public Role findRoleById(String id) throws IdentityException, IllegalArgumentException
{
- return findRoleByName(id);
+ return findRoleByDN(id);
}
public Role createRole(String name, String displayName) throws IdentityException, IllegalArgumentException
@@ -247,7 +248,7 @@
String filter = getRidAttributeID().concat("=").concat("*");
log.debug("Search filter: " + filter);
- NamingEnumeration results = searchRoles(filter);
+ NamingEnumeration results = searchRoles(filter, null);
List sr = Tools.toList(results);
return sr.size();
@@ -273,7 +274,7 @@
String filter = "(".concat(getRidAttributeID()).concat("=").concat("*").concat(")");
log.debug("Search filter: " + filter);
- NamingEnumeration results = searchRoles(filter);
+ NamingEnumeration results = searchRoles(filter, null);
while (results.hasMoreElements())
{
SearchResult res = (SearchResult)results.nextElement();
@@ -299,7 +300,7 @@
* @param filter that will be concatenated with proper role search filter from the module
* @return
*/
- public NamingEnumeration searchRoles(String filter) throws NamingException, IdentityException
+ public NamingEnumeration searchRoles(String filter, Object[] filterArgs) throws NamingException, IdentityException
{
SearchControls controls = new SearchControls();
controls.setSearchScope(SearchControls.ONELEVEL_SCOPE);
@@ -308,7 +309,14 @@
//String filter = getUidAttributeID().concat("=").concat(userName);
log.debug("Search filter: " + filter);
- return getConnectionContext().createInitialContext().search(getContainerDN(), filter, controls);
+ if (filterArgs == null)
+ {
+ return getConnectionContext().createInitialContext().search(getContainerDN(), filter, controls);
+ }
+ else
+ {
+ return getConnectionContext().createInitialContext().search(getContainerDN(), filter, filterArgs, controls);
+ }
}
//TODO:remove this - it's only a fasade to make this implementation compatible with old RoleModule interface
Modified: trunk/identity/src/main/org/jboss/portal/identity/ldap/LDAPStaticGroupMembershipModuleImpl.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/identity/ldap/LDAPStaticGroupMembershipModuleImpl.java 2007-02-13 03:37:46 UTC (rev 6241)
+++ trunk/identity/src/main/org/jboss/portal/identity/ldap/LDAPStaticGroupMembershipModuleImpl.java 2007-02-13 03:52:54 UTC (rev 6242)
@@ -91,7 +91,7 @@
String filter = getMemberAttributeID().concat("=").concat(memberName);
log.debug("Search filter: " + filter);
- NamingEnumeration results = getRoleModule().searchRoles(filter);
+ NamingEnumeration results = getRoleModule().searchRoles(filter, null);
List sr = Tools.toList(results);
@@ -324,7 +324,7 @@
String filter = getMemberAttributeID().concat("=").concat(memberName);
log.debug("Search filter: " + filter);
- NamingEnumeration results = getRoleModule().searchRoles(filter);
+ NamingEnumeration results = getRoleModule().searchRoles(filter, null);
List sr = Tools.toList(results);
//iterate over roles that contain a user
for (Iterator iterator = sr.iterator(); iterator.hasNext();)
Modified: trunk/identity/src/main/org/jboss/portal/identity/ldap/LDAPStaticRoleMembershipModuleImpl.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/identity/ldap/LDAPStaticRoleMembershipModuleImpl.java 2007-02-13 03:37:46 UTC (rev 6241)
+++ trunk/identity/src/main/org/jboss/portal/identity/ldap/LDAPStaticRoleMembershipModuleImpl.java 2007-02-13 03:52:54 UTC (rev 6242)
@@ -172,7 +172,7 @@
}
else
{
- memberOfName = ldapRole.getId().toString();
+ memberOfName = ldapRole.getName();
}
String filter = getMemberAttributeID().concat("=").concat(memberOfName);
@@ -180,7 +180,7 @@
//NamingEnumeration results = getConnectionContext().createInitialContext().search(getUserContainerDN(), filter, controls);
- NamingEnumeration results = getUserModule().searchUsers(filter);
+ NamingEnumeration results = getUserModule().searchUsers(filter, null);
List sr = Tools.toList(results);
@@ -254,7 +254,7 @@
}
else
{
- memberOfName = ldapRole.getId().toString();
+ memberOfName = ldapRole.getName();
}
@@ -263,7 +263,7 @@
String filter = getMemberAttributeID().concat("=").concat(memberOfName);
log.debug("Search filter: " + filter);
- NamingEnumeration results = getUserModule().searchUsers(filter);
+ NamingEnumeration results = getUserModule().searchUsers(filter, null);
List sr = Tools.toList(results);
//iterate over users that contain a role
for (Iterator iterator = sr.iterator(); iterator.hasNext();)
@@ -360,7 +360,7 @@
}
else
{
- member.add(role.getId().toString());
+ member.add(role.getName());
}
}
catch (ClassCastException e)
Modified: trunk/identity/src/main/org/jboss/portal/identity/ldap/LDAPUserModule.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/identity/ldap/LDAPUserModule.java 2007-02-13 03:37:46 UTC (rev 6241)
+++ trunk/identity/src/main/org/jboss/portal/identity/ldap/LDAPUserModule.java 2007-02-13 03:52:54 UTC (rev 6242)
@@ -34,6 +34,7 @@
import javax.naming.directory.BasicAttributes;
import javax.naming.directory.BasicAttribute;
import javax.naming.directory.DirContext;
+import javax.naming.directory.SearchControls;
import javax.naming.NamingException;
import javax.naming.NamingEnumeration;
import javax.naming.InitialContext;
@@ -209,9 +210,10 @@
* implementation to apply proper filter and search scope from the configuration
*
* @param filter that will be concatenated with proper user search filter from the module
+ * @param filterArgs
* @return
*/
- public abstract NamingEnumeration searchUsers(String filter) throws NamingException, IdentityException;
+ public abstract NamingEnumeration searchUsers(String filter, Object[] filterArgs) throws NamingException, IdentityException;
//**************************
@@ -282,6 +284,70 @@
}
}
+ protected String getUserSearchFilter() throws IdentityException
+ {
+ String searchFilter = getIdentityConfiguration().getValue(IdentityConfiguration.USER_SEARCH_FILTER);
+ if (searchFilter == null)
+ {
+ throw new IdentityException(IdentityConfiguration.USER_SEARCH_FILTER + " missing in configuration");
+ }
+ else
+ {
+ return searchFilter;
+ }
+ }
+
+ protected String getUserSearchCtxDN() throws IdentityException
+ {
+ String searchCtx = getIdentityConfiguration().getValue(IdentityConfiguration.USER_SEARCH_CTX_DN);
+ if (searchCtx == null)
+ {
+ throw new IdentityException(IdentityConfiguration.USER_SEARCH_CTX_DN + " missing in configuration");
+ }
+ else
+ {
+ return searchCtx;
+ }
+ }
+
+ protected int getSearchTimeLimit() throws IdentityException
+ {
+ int searchTimeout = 10000;
+ String limit = getIdentityConfiguration().getValue(IdentityConfiguration.SEARCH_TIME_LIMIT);
+ if (limit != null)
+ {
+ try
+ {
+ searchTimeout = Integer.parseInt(limit);
+ }
+ catch (NumberFormatException e)
+ {
+ log.warn(IdentityConfiguration.SEARCH_TIME_LIMIT + "wrong value falling back to defaults:" + e);
+ }
+ }
+ return searchTimeout;
+ }
+
+ protected int getSearchScope() throws IdentityException
+ {
+ int searchScope = SearchControls.ONELEVEL_SCOPE;
+ String scope = getIdentityConfiguration().getValue(IdentityConfiguration.USER_SEARCH_CTX_DN);
+ if (scope != null)
+ {
+ if ("OBJECT_SCOPE".equalsIgnoreCase(scope))
+ searchScope = SearchControls.OBJECT_SCOPE;
+ else if ("ONELEVEL_SCOPE".equalsIgnoreCase(scope))
+ searchScope = SearchControls.ONELEVEL_SCOPE;
+ else if ("SUBTREE_SCOPE".equalsIgnoreCase(scope))
+ searchScope = SearchControls.SUBTREE_SCOPE;
+ }
+ return searchScope;
+ }
+
+
+
+
+
/*protected String getEmailAttributeId() throws IdentityException
{
String email = getIdentityConfiguration().getValue(IdentityConfiguration.USER_EMAIL_ATTRIBUTE_ID);
Modified: trunk/identity/src/main/org/jboss/portal/identity/ldap/LDAPUserModuleImpl.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/identity/ldap/LDAPUserModuleImpl.java 2007-02-13 03:37:46 UTC (rev 6241)
+++ trunk/identity/src/main/org/jboss/portal/identity/ldap/LDAPUserModuleImpl.java 2007-02-13 03:52:54 UTC (rev 6242)
@@ -73,7 +73,7 @@
String filter = "(".concat(getUidAttributeID()).concat("=").concat(userName).concat(")");
log.debug("Search filter: " + filter);
- NamingEnumeration results = searchUsers(filter);
+ NamingEnumeration results = searchUsers(filter, null);
List sr = Tools.toList(results);
if (sr.size() > 1)
{
@@ -259,7 +259,7 @@
log.debug("Search filter: " + filter);
- NamingEnumeration results = searchUsers(ldap_filter);
+ NamingEnumeration results = searchUsers(ldap_filter, null);
while (results.hasMoreElements())
{
SearchResult res = (SearchResult)results.nextElement();
@@ -289,7 +289,7 @@
log.debug("Search filter: " + filter);
- NamingEnumeration results = searchUsers(filter);
+ NamingEnumeration results = searchUsers(filter, null);
List sr = Tools.toList(results);
return sr.size();
@@ -314,17 +314,23 @@
* @param filter that will be concatenated with proper user search filter from the module
* @return
*/
- public NamingEnumeration searchUsers(String filter) throws NamingException, IdentityException
+ public NamingEnumeration searchUsers(String filter, Object[] filterArgs) throws NamingException, IdentityException
{
SearchControls controls = new SearchControls();
controls.setSearchScope(SearchControls.ONELEVEL_SCOPE);
controls.setReturningObjFlag(true);
+ controls.setTimeLimit(getSearchTimeLimit());
- //String filter = getUidAttributeID().concat("=").concat(userName);
log.debug("Search filter: " + filter);
-
- return getConnectionContext().createInitialContext().search(getContainerDN(), filter, controls);
+ if (filterArgs == null)
+ {
+ return getConnectionContext().createInitialContext().search(getContainerDN(), filter, controls);
+ }
+ else
+ {
+ return getConnectionContext().createInitialContext().search(getContainerDN(), filter, filterArgs, controls);
+ }
}
}
Added: trunk/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPExtUserModuleTestCase.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPExtUserModuleTestCase.java (rev 0)
+++ trunk/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPExtUserModuleTestCase.java 2007-02-13 03:52:54 UTC (rev 6242)
@@ -0,0 +1,132 @@
+package org.jboss.portal.test.identity.ldap;
+
+import junit.framework.TestSuite;
+import org.jboss.portal.identity.UserModule;
+import org.jboss.portal.identity.RoleModule;
+import org.jboss.portal.identity.MembershipModule;
+import org.jboss.portal.identity.UserProfileModule;
+import org.jboss.portal.identity.IdentityServiceControllerImpl;
+import org.jboss.portal.identity.IdentityContext;
+import org.jboss.portal.identity.IdentityConfiguration;
+import org.jboss.portal.identity.IdentityException;
+import org.jboss.portal.identity.User;
+import org.jboss.portal.identity.Role;
+import org.jboss.portal.identity.ldap.LDAPUserImpl;
+import org.apache.log4j.Appender;
+import org.apache.log4j.ConsoleAppender;
+import org.apache.log4j.SimpleLayout;
+import org.apache.log4j.Logger;
+import org.apache.log4j.Level;
+
+import java.util.Set;
+import java.util.HashSet;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz@jboss.org">Boleslaw Dawidowicz</a>
+ * @version $Revision: 1.1 $
+ */
+public class LDAPExtUserModuleTestCase extends LDAPTestCase
+{
+ private static final org.jboss.logging.Logger log = org.jboss.logging.Logger.getLogger(LDAPExtUserModuleTestCase.class);
+
+ public static TestSuite suite() throws Exception
+ {
+ System.out.println("###");
+ return createTestSuite(LDAPExtUserModuleTestCase.class, "directories-extusermodule.xml", "datasources.xml");
+ }
+
+ static
+ {
+ Appender appender = new ConsoleAppender(new SimpleLayout());
+ Logger.getRoot().addAppender(appender);
+ Logger.getRoot().setLevel(Level.INFO);
+ Logger.getLogger("org.jboss.portal.identity").setLevel(Level.DEBUG);
+ }
+
+ UserModule userModule;
+
+ RoleModule roleModule;
+
+ MembershipModule membershipModule;
+
+ UserProfileModule userProfileModule;
+
+
+
+ private String suffix;
+
+ private String userPrefix;
+
+ public void setUp() throws Exception
+ {
+ super.setUp();
+
+ IdentityServiceControllerImpl controller = new IdentityServiceControllerImpl();
+ controller.setConfigFile(getDirectoryServerConfigParameter().getConfigFile());
+ controller.setDefaultConfigFile("test/config/standardidentity-config.xml");
+ controller.setRegisterMBeans(false);
+ controller.start();
+ identityContext = controller.getIdentityContext();
+ userModule = (UserModule)identityContext.getObject(IdentityContext.TYPE_USER_MODULE);
+ userModule = (UserModule)identityContext.getObject(IdentityContext.TYPE_USER_MODULE);
+ roleModule = (RoleModule)identityContext.getObject(IdentityContext.TYPE_ROLE_MODULE);
+ membershipModule = (MembershipModule)identityContext.getObject(IdentityContext.TYPE_MEMBERSHIP_MODULE);
+ userProfileModule = (UserProfileModule)identityContext.getObject(IdentityContext.TYPE_USER_PROFILE_MODULE);
+
+
+ suffix = getDirectoryServerConfigParameter().getCleanUpDN();
+ userPrefix = ((IdentityConfiguration)controller.getIdentityContext().getObject(IdentityContext.TYPE_IDENTITY_CONFIGURATION)).getValue(IdentityConfiguration.USER_UID_ATTRIBUTE_ID);
+
+ populate();
+ }
+
+
+ public void testFirstSimple() throws Exception
+ {
+ log.info("test framework works ;]");
+ }
+
+ public void testFindUserByName() throws Exception
+ {
+ LDAPUserImpl ldapu = (LDAPUserImpl)userModule.findUserByUserName("jduke");
+ assertEquals(ldapu.getDn().toLowerCase(), (userPrefix + "=jduke,ou=People," + suffix).toLowerCase());
+ assertEquals(ldapu.getUserName(), "jduke");
+ }
+
+ public void testgetUserCount() throws Exception
+ {
+ LDAPUserImpl ldapu = (LDAPUserImpl)userModule.findUserByUserName("jduke");
+ assertEquals(ldapu.getDn().toLowerCase(),(userPrefix + "=jduke,ou=People," + suffix).toLowerCase());
+ assertEquals(ldapu.getUserName(), "jduke");
+
+ int count = userModule.getUserCount();
+ assertEquals(5, count);
+ }
+
+ //TODO: test findUsers
+
+ public void testFindUsersFilteredByName() throws Exception
+ {
+ userModule.findUsersFilteredByUserName("jduke",0,1);
+ //assertEquals(ldapu.getUserName(), "jduke");
+
+ }
+
+ public void testPassword() throws Exception
+ {
+ //userModule.createUser("testUser", "testPassword");
+ User u = userModule.findUserByUserName("jduke");
+ assertNotNull(u);
+ assertEquals("jduke", u.getUserName());
+ assertTrue(u.validatePassword("theduke"));
+
+ userProfileModule.setProperty(u, User.INFO_USER_EMAIL_REAL, "testRealEmail");
+ assertTrue(u.validatePassword("theduke"));
+
+
+ assertTrue(!u.validatePassword("dodo"));
+ u.updatePassword("dodo");
+ assertTrue(u.validatePassword("dodo"));
+
+ }
+}
Modified: trunk/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPSimpleRoleModuleTestCase.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPSimpleRoleModuleTestCase.java 2007-02-13 03:37:46 UTC (rev 6241)
+++ trunk/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPSimpleRoleModuleTestCase.java 2007-02-13 03:52:54 UTC (rev 6242)
@@ -92,27 +92,27 @@
}
- public void testFirstSimple() throws Exception
+ /*public void testFirstSimple() throws Exception
{
log.info("test framework works ;]");
- }
+ }*/
public void testFindRoleByName() throws Exception
{
- LDAPRoleImpl ldapr = (LDAPRoleImpl)roleModule.findRoleById("Echo");
+ LDAPRoleImpl ldapr = (LDAPRoleImpl)roleModule.findRoleByName("Echo");
assertEquals(ldapr.getDn().toLowerCase(), ("cn=Echo,ou=Roles," + suffix).toLowerCase());
assertEquals(ldapr.getName(), "Echo");
}
public void testRemoveRole() throws Exception
{
- LDAPRoleImpl ldapr = (LDAPRoleImpl)roleModule.findRoleById("Echo");
+ LDAPRoleImpl ldapr = (LDAPRoleImpl)roleModule.findRoleByName("Echo");
assertEquals(ldapr.getDn().toLowerCase(), ("cn=Echo,ou=Roles," + suffix).toLowerCase());
assertEquals(ldapr.getName(), "Echo");
- roleModule.removeRole("Echo");
+ roleModule.removeRole(ldapr.getId());
try
{
- ldapr = (LDAPRoleImpl)roleModule.findRoleById("Echo");
+ ldapr = (LDAPRoleImpl)roleModule.findRoleByName("Echo");
fail();
}
catch (IdentityException e)
@@ -129,14 +129,14 @@
assertEquals("testRole", ldapr.getName());
//assertEquals("testDisplayName",ldapr.getDisplayName());
- ldapr = (LDAPRoleImpl)roleModule.findRoleById("testRole");
+ ldapr = (LDAPRoleImpl)roleModule.findRoleByName("testRole");
assertNotNull(ldapr);
- roleModule.removeRole("testRole");
+ roleModule.removeRole(ldapr.getId());
try
{
- roleModule.findRoleById("testRole");
+ roleModule.findRoleByName("testRole");
fail("shouldn reach this");
}
catch (Exception e)
@@ -149,7 +149,7 @@
public void testgetRoleCount() throws Exception
{
- LDAPRoleImpl ldapr = (LDAPRoleImpl)roleModule.findRoleById("Echo");
+ LDAPRoleImpl ldapr = (LDAPRoleImpl)roleModule.findRoleByName("Echo");
assertEquals(ldapr.getDn().toLowerCase(), ("cn=Echo,ou=Roles," + suffix).toLowerCase());
assertEquals(ldapr.getName(), "Echo");
Modified: trunk/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPSimpleUserModuleTestCase.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPSimpleUserModuleTestCase.java 2007-02-13 03:37:46 UTC (rev 6241)
+++ trunk/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPSimpleUserModuleTestCase.java 2007-02-13 03:52:54 UTC (rev 6242)
@@ -174,9 +174,9 @@
assertTrue(u.validatePassword("testPassword"));
-// assertTrue(!u.validatePassword("1testPassword1"));
-// u.updatePassword("1testPassword1");
-// assertTrue(u.validatePassword("1testPassword1"));
+ assertTrue(!u.validatePassword("1testPassword1"));
+ u.updatePassword("1testPassword1");
+ assertTrue(u.validatePassword("1testPassword1"));
}
}
Modified: trunk/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPTestCase.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPTestCase.java 2007-02-13 03:37:46 UTC (rev 6241)
+++ trunk/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPTestCase.java 2007-02-13 03:52:54 UTC (rev 6242)
@@ -66,7 +66,7 @@
Appender appender = new ConsoleAppender(new SimpleLayout());
Logger.getRoot().addAppender(appender);
Logger.getRoot().setLevel(Level.INFO);
- Logger.getLogger("org.jboss.portal.identity").setLevel(Level.INFO);
+ Logger.getLogger("org.jboss.portal.identity").setLevel(Level.DEBUG);
}
public static TestSuite createTestSuite(Class clazz, String directories, String datasources) throws Exception
Added: trunk/identity/src/resources/test/config/extuser/opends-config.xml
===================================================================
--- trunk/identity/src/resources/test/config/extuser/opends-config.xml (rev 0)
+++ trunk/identity/src/resources/test/config/extuser/opends-config.xml 2007-02-13 03:52:54 UTC (rev 6242)
@@ -0,0 +1,129 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+ <!--<!DOCTYPE identity-configuration PUBLIC
+ "-//JBoss Portal//DTD JBoss Identity Configuration 1.0//EN"
+ "http://www.jboss.org/portal/dtd/identity-config_1_0.dtd">-->
+
+<identity-configuration>
+ <datasources>
+ <datasource>
+ <name>LDAP</name>
+ <config>
+ <option>
+ <name>host</name>
+ <value>localhost</value>
+ </option>
+ <option>
+ <name>port</name>
+ <value>10389</value>
+ </option>
+ <option>
+ <name>adminDN</name>
+ <value>cn=Directory Manager</value>
+ </option>
+ <option>
+ <name>adminPassword</name>
+ <value>password</value>
+ </option>
+ </config>
+ </datasource>
+ </datasources>
+ <modules>
+ <module>
+ <!--type used to correctly map in IdentityContext registry-->
+ <type>User</type>
+ <implementation>LDAP</implementation>
+ <class>org.jboss.portal.identity.ldap.LDAPExtUserModuleImpl</class>
+ <config/>
+ </module>
+ <module>
+ <type>Role</type>
+ <implementation>LDAP</implementation>
+ <config/>
+ </module>
+ <module>
+ <type>Membership</type>
+ <implementation>LDAP</implementation>
+ <config/>
+ </module>
+
+ <module>
+ <type>UserProfile</type>
+ <implementation>DELEGATING</implementation>
+ <config>
+ <option>
+ <name>profileConfigFile</name>
+ <value>test/config/profile-config.xml</value>
+ </option>
+ <option>
+ <name>ldapModuleJNDIName</name>
+ <value>java:/portal/LDAPUserProfileModule</value>
+ </option>
+ </config>
+ </module>
+ <module>
+ <type>DBDelegateUserProfile</type>
+ <implementation>DB</implementation>
+ <config/>
+ </module>
+ <module>
+ <type>LDAPDelegateUserProfile</type>
+ <implementation>LDAP</implementation>
+ <config/>
+ </module>
+ </modules>
+
+ <options>
+ <option-group>
+ <group-name>common</group-name>
+ <option>
+ <name>userSearchCtxDN</name>
+ <value>ou=People,dc=testsuite,dc=portal,dc=qa,dc=atl,dc=jboss,dc=com</value>
+ </option>
+ <option>
+ <name>userSearchFilter</name>
+ <value>(uid={0})</value>
+ </option>
+ <option>
+ <name>roleContainerDN</name>
+ <value>ou=Roles,dc=testsuite,dc=portal,dc=qa,dc=atl,dc=jboss,dc=com</value>
+ </option>
+ </option-group>
+ <option-group>
+ <group-name>roleCreateAttibutes</group-name>
+ <!--Schema requires those to have initial value-->
+ <option>
+ <name>cn</name>
+ <value>none</value>
+ </option>
+ <!--Some directory servers require this attribute to be valid DN-->
+ <!--For safety reasons point to the admin user here-->
+ <option>
+ <name>member</name>
+ <value>uid=admin,ou=People,dc=testsuite,dc=portal,dc=qa,dc=atl,dc=jboss,dc=com</value>
+ </option>
+ </option-group>
+ </options>
+</identity-configuration>
\ No newline at end of file
Added: trunk/test/src/etc/directories-extusermodule.xml
===================================================================
--- trunk/test/src/etc/directories-extusermodule.xml (rev 0)
+++ trunk/test/src/etc/directories-extusermodule.xml 2007-02-13 03:52:54 UTC (rev 6242)
@@ -0,0 +1,98 @@
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<directories>
+ <directory>
+ <directory-name>OpenDS</directory-name>
+ <description>OpenDS service deployed on JBoss AS as an mbean - StaticRoleMembership config</description>
+ <config-file>test/config/extuser/opends-config.xml</config-file>
+ <host>localhost</host>
+ <port>10389</port>
+ <context-factory>com.sun.jndi.ldap.LdapCtxFactory</context-factory>
+ <admin-dn>cn=Directory Manager</admin-dn>
+ <admin-password>password</admin-password>
+ <populate-ldif>ldap/ldif/initial-tests-qa.ldif</populate-ldif>
+ <cleanup-dn>dc=testsuite,dc=portal,dc=qa,dc=atl,dc=jboss,dc=com</cleanup-dn>
+ </directory>
+ <!--<directory>
+ <directory-name>RedHatDS</directory-name>
+ <description>RedHat Directory in QA Labs (need vpn access) - StaticGroupMembership config</description>
+
+ <config-file>test/config/identity/rhds-config.xml</config-file>
+ <host>dev39.qa.atl.jboss.com</host>
+ <port>10389</port>
+ <context-factory>com.sun.jndi.ldap.LdapCtxFactory</context-factory>
+ <admin-dn>cn=Directory Manager</admin-dn>
+ <admin-password>qpq123qpq</admin-password>
+
+ <populate-ldif>ldap/ldif/initial-tests-notpopulated.ldif</populate-ldif>
+
+ <cleanup-dn>dc=testsuite,dc=portal,dc=qa,dc=atl,dc=jboss,dc=com</cleanup-dn>
+ </directory>
+ <directory>
+ <directory-name>RedHatDS</directory-name>
+ <description>RedHat Directory in QA Labs (need vpn access) - StaticRoleMembership config</description>
+
+ <config-file>test/config/identity/rhds-config-staticrole.xml</config-file>
+ <host>dev39.qa.atl.jboss.com</host>
+ <port>10389</port>
+ <context-factory>com.sun.jndi.ldap.LdapCtxFactory</context-factory>
+ <admin-dn>cn=Directory Manager</admin-dn>
+ <admin-password>qpq123qpq</admin-password>
+
+ <populate-ldif>ldap/ldif/initial-tests-notpopulated.ldif</populate-ldif>
+
+ <cleanup-dn>dc=testsuite,dc=portal,dc=qa,dc=atl,dc=jboss,dc=com</cleanup-dn>
+ </directory>
+
+ <directory>
+ <directory-name>OpenLDAP</directory-name>
+ <description>OpenLDAP Directory in QA Labs (need vpn access) - StaticGroupMembership config</description>
+
+ <config-file>test/config/identity/openldap-config.xml</config-file>
+ <host>dev09.qa.atl.jboss.com</host>
+ <port>389</port>
+ <context-factory>com.sun.jndi.ldap.LdapCtxFactory</context-factory>
+ <admin-dn>cn=Manager,dc=my-domain,dc=com</admin-dn>
+ <admin-password>jbossqa</admin-password>
+
+ <populate-ldif>ldap/ldif/initial-tests-notpopulated-openldap.ldif</populate-ldif>
+
+ <cleanup-dn>dc=testsuite,dc=portal,dc=my-domain,dc=com</cleanup-dn>
+ </directory>-->
+ <!--<directory>
+ <directory-name>MSAD</directory-name>
+ <description>Microsoft Active Directory in QA Labs (need vpn access)</description>
+
+ <config-file>test/config/msad-config.xml</config-file>
+ <host>dev44.qa.atl.jboss.com</host>
+ <port>389</port>
+ <context-factory>com.sun.jndi.ldap.LdapCtxFactory</context-factory>
+ <admin-dn>JBOSS\jbossqa</admin-dn>
+ <admin-password>jboss42</admin-password>
+
+ <populate-ldif>ldap/ldif/initial-tests-qa-msad.ldif</populate-ldif>
+
+ <cleanup-dn>ou=testsuite,ou=portal,dc=jboss,dc=test</cleanup-dn>
+ </directory>-->
+</directories>
19 years, 2 months
JBoss Portal SVN: r6241 - in trunk: wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer and 1 other directory.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2007-02-12 22:37:46 -0500 (Mon, 12 Feb 2007)
New Revision: 6241
Modified:
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletUtils.java
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/MarkupTestCase.java
Log:
- Reverted changes that somehow got lost...
- Fixed test case.
Modified: trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletUtils.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletUtils.java 2007-02-13 02:10:52 UTC (rev 6240)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletUtils.java 2007-02-13 03:37:46 UTC (rev 6241)
@@ -38,16 +38,12 @@
public class PortletUtils
{
public static final String PREFIX = "jbpns";
- public static final String SUFFIX = "snjbp";
+ public static final String SUFFIX = "snpbj";
/**
- * Check that provided map follow the constraints :
- * <ul>
- * <li>Not null</li>
- * <li>Keys are non null string</li>
- * <li>Values are non null string arrays</li>
- * </ul>
- * If a constraint is not respected then an IllegalArgumentException is thrown.
+ * Check that provided map follow the constraints : <ul> <li>Not null</li> <li>Keys are non null string</li>
+ * <li>Values are non null string arrays</li> </ul> If a constraint is not respected then an IllegalArgumentException
+ * is thrown.
*
* @param map the map to check
* @throws IllegalArgumentException
@@ -192,7 +188,7 @@
{
StringBuffer tmp = new StringBuffer(PREFIX.length() + windowId.length() * 2);
tmp.append(PREFIX);
- for (int i = 0;i < windowId.length();i++)
+ for (int i = 0; i < windowId.length(); i++)
{
char c = windowId.charAt(i);
if (Character.isLetterOrDigit(c))
@@ -206,6 +202,7 @@
tmp.append(Character.forDigit((((int)c) & 0X0F), 16));
}
}
+ tmp.append(SUFFIX);
return tmp.toString();
}
}
Modified: trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/MarkupTestCase.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/MarkupTestCase.java 2007-02-13 02:10:52 UTC (rev 6240)
+++ trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/MarkupTestCase.java 2007-02-13 03:37:46 UTC (rev 6241)
@@ -113,7 +113,7 @@
MarkupResponse response = markupService.getMarkup(getMarkup);
checkMarkupResponse(response, "<form method='post' action='wsrp_rewrite?wsrp-urlType=blockingAction&wsrp" +
- "-interactionState=JBPNS_/wsrp_rewrite' id='jbpns_2ftest_2dmarkup_2dportlet_2eMarkup_20Test_20PortletportfolioManager'><table><tr><td>Stock symbol</t" +
+ "-interactionState=JBPNS_/wsrp_rewrite' id='wsrp_rewrite_portfolioManager'><table><tr><td>Stock symbol</t" +
"d><td><input name='symbol'/></td></tr><tr><td><input type='submit' value='Submit'></td></tr></table></form>");
}
19 years, 2 months
JBoss Portal SVN: r6240 - trunk/wsrp/src/main/org/jboss/portal/wsrp/producer.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2007-02-12 21:10:52 -0500 (Mon, 12 Feb 2007)
New Revision: 6240
Modified:
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/MarkupHandler.java
Log:
- Added comment in releaseSessions implementation to remind me that we don't need to implement it!
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/MarkupHandler.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/MarkupHandler.java 2007-02-12 23:00:07 UTC (rev 6239)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/MarkupHandler.java 2007-02-13 02:10:52 UTC (rev 6240)
@@ -153,6 +153,7 @@
public ReturnAny releaseSessions(ReleaseSessions releaseSessions)
throws InvalidRegistrationFault, OperationFailedFault, MissingParametersFault, AccessDeniedFault, RemoteException
{
+ // our producer never sends session ids so a Consumer trying to release sessions is an error condition
throwOperationFaultOnSessionOperation();
return null;
}
19 years, 2 months
JBoss Portal SVN: r6239 - docs/trunk/referenceGuide/en/modules.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-02-12 18:00:07 -0500 (Mon, 12 Feb 2007)
New Revision: 6239
Modified:
docs/trunk/referenceGuide/en/modules/identity.xml
Log:
big monkey format on identity
Modified: docs/trunk/referenceGuide/en/modules/identity.xml
===================================================================
--- docs/trunk/referenceGuide/en/modules/identity.xml 2007-02-12 22:47:26 UTC (rev 6238)
+++ docs/trunk/referenceGuide/en/modules/identity.xml 2007-02-12 23:00:07 UTC (rev 6239)
@@ -22,37 +22,33 @@
The <emphasis role="bold">org.jboss.portal.identity.User</emphasis>
interface represents a user and exposes the following operations:
</para>
- <programlisting>
- <![CDATA[
- /** The user identifier. */
- public Object getId();
+ <programlisting><![CDATA[
+ /** The user identifier. */
+ public Object getId();
- /** The user name. */
- public String getUserName();
+ /** The user name. */
+ public String getUserName();
- /** Set the password using proper encoding. */
- public void updatePassword(String password);
+ /** Set the password using proper encoding. */
+ public void updatePassword(String password);
- /** Return true if the password is valid. */
- public boolean validatePassword(String password);
- ]]>
- </programlisting>
+ /** Return true if the password is valid. */
+ public boolean validatePassword(String password);
+ ]]></programlisting>
<warning>
Important Note! The proper usage of getId() method is:
- <programlisting>
- <![CDATA[
- // Always use it like this:
- user.getId().toString();
+ <programlisting><![CDATA[
+// Always use it like this:
+user.getId().toString();
- // Do not use it like this:
+// Do not use it like this:
- // We would get a Long object if we are using the database implementation
- (Long)user.getId();
+// We would get a Long object if we are using the database implementation
+(Long)user.getId();
- // We would get a String with an LDAP server
- (String)user.getId();
- ]]>
- </programlisting>
+// We would get a String with an LDAP server
+(String)user.getId();
+]]></programlisting>
This is because the ID value depends on the User implementation. It'll probably be String object with the LDAP
implementation and a Long object with the database implementation but it could be something else
if one has chosen to make its own implementation.
@@ -63,109 +59,103 @@
The <emphasis role="bold">org.jboss.portal.identity.Role</emphasis> interface represents a Role
and exposes the following operations:
</para>
- <programlisting>
- <![CDATA[
- /** The role identifier. */
- public Object getId();
+ <programlisting><![CDATA[
+/** The role identifier. */
+public Object getId();
- /** The role name used in security rules. This name can not be modified */
- public String getName();
+/** The role name used in security rules. This name can not be modified */
+public String getName();
- /** The role display name used on screens. This name can be modified */
- public String getDisplayName();
+/** The role display name used on screens. This name can be modified */
+public String getDisplayName();
- /** */
- public void setDisplayName(String name);
- ]]>
- </programlisting>
+/** */
+public void setDisplayName(String name);
+]]></programlisting>
</listitem>
<listitem>
<para>
The <emphasis role="bold">org.jboss.portal.identity.UserModule</emphasis>
interface exposes operations for users management:
</para>
- <programlisting>
- <![CDATA[
- /**Retrieve a user by its name.*/
- User findUserByUserName(String userName) throws IdentityException, IllegalArgumentException, NoSuchUserException;
+ <programlisting><![CDATA[
+/**Retrieve a user by its name.*/
+User findUserByUserName(String userName) throws IdentityException, IllegalArgumentException, NoSuchUserException;
- /**Retrieve a user by its id.*/
- User findUserById(Object id) throws IdentityException, IllegalArgumentException, NoSuchUserException;
+/**Retrieve a user by its id.*/
+User findUserById(Object id) throws IdentityException, IllegalArgumentException, NoSuchUserException;
- /**Retrieve a user by its id.*/
- User findUserById(String id) throws IdentityException, IllegalArgumentException, NoSuchUserException;
+/**Retrieve a user by its id.*/
+User findUserById(String id) throws IdentityException, IllegalArgumentException, NoSuchUserException;
- /** Creates a new user with the specified name.*/
- User createUser(String userName, String password) throws IdentityException, IllegalArgumentException;
+/** Creates a new user with the specified name.*/
+User createUser(String userName, String password) throws IdentityException, IllegalArgumentException;
- /** Remove a user.*/
- void removeUser(Object id) throws IdentityException, IllegalArgumentException;
+/** Remove a user.*/
+void removeUser(Object id) throws IdentityException, IllegalArgumentException;
- /** Get a range of users.*/
- Set findUsers(int offset, int limit) throws IdentityException, IllegalArgumentException;
+/** Get a range of users.*/
+Set findUsers(int offset, int limit) throws IdentityException, IllegalArgumentException;
- /** Get a range of users.*/
- Set findUsersFilteredByUserName(String filter, int offset, int limit) throws IdentityException, IllegalArgumentException;
+/** Get a range of users.*/
+Set findUsersFilteredByUserName(String filter, int offset, int limit) throws IdentityException, IllegalArgumentException;
- /**Returns the number of users.*/
- int getUserCount() throws IdentityException, IllegalArgumentException;
- ]]>
- </programlisting>
+/**Returns the number of users.*/
+int getUserCount() throws IdentityException, IllegalArgumentException;
+]]></programlisting>
</listitem>
<listitem>
<para>
The <emphasis role="bold">org.jboss.portal.identity.RoleModule</emphasis>
interface exposes operations for roles management:
</para>
- <programlisting>
- <![CDATA[
- /** Retrieves a role by its name*/
- Role findRoleByName(String name) throws IdentityException, IllegalArgumentException;
+ <programlisting><![CDATA[
+/** Retrieves a role by its name*/
+Role findRoleByName(String name) throws IdentityException, IllegalArgumentException;
- /**Retrieve a collection of role from the role names.*/
- Set findRolesByNames(String[] names) throws IdentityException, IllegalArgumentException;
+/**Retrieve a collection of role from the role names.*/
+Set findRolesByNames(String[] names) throws IdentityException, IllegalArgumentException;
- /** Retrieves a role by its id.*/
- Role findRoleById(Object id) throws IdentityException, IllegalArgumentException;
+/** Retrieves a role by its id.*/
+Role findRoleById(Object id) throws IdentityException, IllegalArgumentException;
- /** Retrieves a role by its id.*/
- Role findRoleById(String id) throws IdentityException, IllegalArgumentException;
+/** Retrieves a role by its id.*/
+Role findRoleById(String id) throws IdentityException, IllegalArgumentException;
- /** Create a new role with the specified name.*/
- Role createRole(String name, String displayName) throws IdentityException, IllegalArgumentException;
+/** Create a new role with the specified name.*/
+Role createRole(String name, String displayName) throws IdentityException, IllegalArgumentException;
- /** Remove a role.*/
- void removeRole(Object id) throws IdentityException, IllegalArgumentException;
+/** Remove a role.*/
+void removeRole(Object id) throws IdentityException, IllegalArgumentException;
- /** Returns the number of roles. */
- int getRolesCount() throws IdentityException;
+/** Returns the number of roles. */
+int getRolesCount() throws IdentityException;
- /** Get all the roles */
- Set findRoles() throws IdentityException;/** Retrieves a role by its name*/
- Role findRoleByName(String name) throws IdentityException, IllegalArgumentException;
+/** Get all the roles */
+Set findRoles() throws IdentityException;/** Retrieves a role by its name*/
+Role findRoleByName(String name) throws IdentityException, IllegalArgumentException;
- /**Retrieve a collection of role from the role names.*/
- Set findRolesByNames(String[] names) throws IdentityException, IllegalArgumentException;
+/**Retrieve a collection of role from the role names.*/
+Set findRolesByNames(String[] names) throws IdentityException, IllegalArgumentException;
- /** Retrieves a role by its id.*/
- Role findRoleById(Object id) throws IdentityException, IllegalArgumentException;
+/** Retrieves a role by its id.*/
+Role findRoleById(Object id) throws IdentityException, IllegalArgumentException;
- /** Retrieves a role by its id.*/
- Role findRoleById(String id) throws IdentityException, IllegalArgumentException;
+/** Retrieves a role by its id.*/
+Role findRoleById(String id) throws IdentityException, IllegalArgumentException;
- /** Create a new role with the specified name.*/
- Role createRole(String name, String displayName) throws IdentityException, IllegalArgumentException;
+/** Create a new role with the specified name.*/
+Role createRole(String name, String displayName) throws IdentityException, IllegalArgumentException;
- /** Remove a role.*/
- void removeRole(Object id) throws IdentityException, IllegalArgumentException;
+/** Remove a role.*/
+void removeRole(Object id) throws IdentityException, IllegalArgumentException;
- /** Returns the number of roles. */
- int getRolesCount() throws IdentityException;
+/** Returns the number of roles. */
+int getRolesCount() throws IdentityException;
- /** Get all the roles */
- Set findRoles() throws IdentityException;
- ]]>
- </programlisting>
+/** Get all the roles */
+Set findRoles() throws IdentityException;
+]]></programlisting>
</listitem>
<listitem>
<para>
@@ -176,40 +166,36 @@
a many to many relationship with an intermediary table), with an LDAP server there a different
ways to define relationships between users and roles.
</para>
- <programlisting>
- <![CDATA[
- /** Return the set of role objects that a given user has.*/
- Set getRoles(User user) throws IdentityException, IllegalArgumentException;
+ <programlisting><![CDATA[
+/** Return the set of role objects that a given user has.*/
+Set getRoles(User user) throws IdentityException, IllegalArgumentException;
- Set getUsers(Role role) throws IdentityException, IllegalArgumentException;
+Set getUsers(Role role) throws IdentityException, IllegalArgumentException;
- /** Creates a relationship beetween a role and set of users. Other roles that have assotiontions with those users remain unaffected.*/
- void assignUsers(Role role, Set users) throws IdentityException, IllegalArgumentException;
+/** Creates a relationship beetween a role and set of users. Other roles that have assotiontions with those users remain unaffected.*/
+void assignUsers(Role role, Set users) throws IdentityException, IllegalArgumentException;
- /** Creates a relationship beetween a user and set of roles. This operation will erase any other assotientions beetween the user and roles not specified in the provided set.*/
- void assignRoles(User user, Set roles) throws IdentityException, IllegalArgumentException;
+/** Creates a relationship beetween a user and set of roles. This operation will erase any other assotientions beetween the user and roles not specified in the provided set.*/
+void assignRoles(User user, Set roles) throws IdentityException, IllegalArgumentException;
- /** Returns role members based on rolename - depreciated method ethod here only for compatibility with old RoleModule interface */
- Set findRoleMembers(String roleName, int offset, int limit, String userNameFilter) throws IdentityException, IllegalArgumentException;
- ]]>
- </programlisting>
+/** Returns role members based on rolename - depreciated method ethod here only for compatibility with old RoleModule interface */
+Set findRoleMembers(String roleName, int offset, int limit, String userNameFilter) throws IdentityException, IllegalArgumentException;
+]]></programlisting>
</listitem>
<listitem>
<para>
The <emphasis role="bold">UserProfileModule</emphasis>
interface exposes operations to access and manage informations stored in User profile:
</para>
- <programlisting>
- <![CDATA[
- public Object getProperty(User user, String propertyName) throws IdentityException, IllegalArgumentException;
+ <programlisting><![CDATA[
+public Object getProperty(User user, String propertyName) throws IdentityException, IllegalArgumentException;
- public void setProperty(User user, String name, Object property) throws IdentityException, IllegalArgumentException;
+public void setProperty(User user, String name, Object property) throws IdentityException, IllegalArgumentException;
- public Map getProperties(User user) throws IdentityException, IllegalArgumentException;
+public Map getProperties(User user) throws IdentityException, IllegalArgumentException;
- public ProfileInfo getProfileInfo() throws IdentityException;
- ]]>
- </programlisting>
+public ProfileInfo getProfileInfo() throws IdentityException;
+]]></programlisting>
<warning>
UserProfileModule.getProperty() method returns an Object.
In most cases with DB backend it will always be String object. But normally you should check what
@@ -223,52 +209,48 @@
<emphasis role="bold">UserProfileModule</emphasis>
and exposes meta information of a profile:
</para>
- <programlisting>
- <![CDATA[
- /** Returns a Map o PropertyInfo objects describing profile properties */
- public Map getPropertiesInfo();
+ <programlisting><![CDATA[
+/** Returns a Map o PropertyInfo objects describing profile properties */
+public Map getPropertiesInfo();
- public PropertyInfo getPropertyInfo(String name);
- ]]>
- </programlisting>
+public PropertyInfo getPropertyInfo(String name);
+]]></programlisting>
</listitem>
<listitem>
<para>
<emphasis role="bold">PropertyInfo</emphasis>
interface expose methods to obtain information about accessible property in User profile
</para>
- <programlisting>
- <![CDATA[
- public static final String ACCESS_MODE_READ_ONLY = "read-only";
- public static final String ACCESS_MODE_READ_WRITE = "read-write";
- public static final String USAGE_MANDATORY = "mandatory";
- public static final String USAGE_OPTIONAL = "optional";
- public static final String MAPPING_DB_TYPE_COLUMN = "column";
- public static final String MAPPING_DB_TYPE_DYNAMIC = "dynamic";
+ <programlisting><![CDATA[
+public static final String ACCESS_MODE_READ_ONLY = "read-only";
+public static final String ACCESS_MODE_READ_WRITE = "read-write";
+public static final String USAGE_MANDATORY = "mandatory";
+public static final String USAGE_OPTIONAL = "optional";
+public static final String MAPPING_DB_TYPE_COLUMN = "column";
+public static final String MAPPING_DB_TYPE_DYNAMIC = "dynamic";
- public String getName();
+public String getName();
- public String getType();
+public String getType();
- public String getAccessMode();
+public String getAccessMode();
- public String getUsage();
+public String getUsage();
- public LocalizedString getDisplayName();
+public LocalizedString getDisplayName();
- public LocalizedString getDescription();
+public LocalizedString getDescription();
- public String getMappingDBType();
+public String getMappingDBType();
- public String getMappingLDAPValue();
+public String getMappingLDAPValue();
- public String getMappingDBValue();
+public String getMappingDBValue();
- public boolean isMappedDB();
+public boolean isMappedDB();
- public boolean isMappedLDAP();
- ]]>
- </programlisting>
+public boolean isMappedLDAP();
+]]></programlisting>
</listitem>
</itemizedlist>
@@ -279,27 +261,23 @@
The best way to access identity modules is by using JNDI:
</para>
<programlisting>
- import org.jboss.portal.identity.UserModule;
- import org.jboss.portal.identity.RoleModule;
- import org.jboss.portal.identity.MembershipModule;
- import org.jboss.portal.identity.UserProfileModule;
+import org.jboss.portal.identity.UserModule;
+import org.jboss.portal.identity.RoleModule;
+import org.jboss.portal.identity.MembershipModule;
+import org.jboss.portal.identity.UserProfileModule;
- [...]
+[...]
- (UserModule)new InitialContext().lookup("java:portal/UserModule");
- (RoleModule)new InitialContext().lookup("java:portal/RoleModule");
- (MembershipModule)new InitialContext().lookup("java:portal/MembershipModule");
- (UserProfileModule)new InitialContext().lookup("java:portal/UserProfileModule");
-
- </programlisting>
+(UserModule)new InitialContext().lookup("java:portal/UserModule");
+(RoleModule)new InitialContext().lookup("java:portal/RoleModule");
+(MembershipModule)new InitialContext().lookup("java:portal/MembershipModule");
+(UserProfileModule)new InitialContext().lookup("java:portal/UserProfileModule");</programlisting>
<para>
Another way to do this is, if you are fimiliar with JBoss Mikrokernel architecture is to
get the <emphasis role="bold">IdentityServiceController</emphasis>
mbean. You may want to inject it into your services like this:
</para>
- <programlisting>
- <![CDATA[<depends optional-attribute-name="IdentityServiceController" proxy-type="attribute">portal:service=Module,type=IdentityServiceController</depends>]]>
- </programlisting>
+ <programlisting><![CDATA[<depends optional-attribute-name="IdentityServiceController" proxy-type="attribute">portal:service=Module,type=IdentityServiceController</depends>]]></programlisting>
<para>
or simply obtain in your code by doing a lookup using
the <emphasis role="bold">portal:service=Module,type=IdentityServiceController</emphasis>
@@ -308,11 +286,10 @@
</para>
<programlisting>
- (UserModule)identityServiceController.getIdentityContext().getObject(IdentityContext.TYPE_USER_MODULE);
- (RoleModule)identityServiceController.getIdentityContext().getObject(IdentityContext.TYPE_ROLE_MODULE);
- (MembershipModule)identityServiceController.getIdentityContext().getObject(IdentityContext.TYPE_MEMBERSHIP_MODULE);
- (UserProfileModule)identityServiceController.getIdentityContext().getObject(IdentityContext.TYPE_USER_PROFILE_MODULE);
- </programlisting>
+(UserModule)identityServiceController.getIdentityContext().getObject(IdentityContext.TYPE_USER_MODULE);
+(RoleModule)identityServiceController.getIdentityContext().getObject(IdentityContext.TYPE_ROLE_MODULE);
+(MembershipModule)identityServiceController.getIdentityContext().getObject(IdentityContext.TYPE_MEMBERSHIP_MODULE);
+(UserProfileModule)identityServiceController.getIdentityContext().getObject(IdentityContext.TYPE_USER_PROFILE_MODULE);</programlisting>
</sect2>
<sect2>
@@ -333,65 +310,61 @@
<para>
For the <emphasis role="bold">User</emphasis> interface:
</para>
- <programlisting>
- <![CDATA[
- // Instead of: user.getEnabled()
- userProfileModule.getProperty(user, User.INFO_USER_ENABLED);
+ <programlisting><![CDATA[
+// Instead of: user.getEnabled()
+userProfileModule.getProperty(user, User.INFO_USER_ENABLED);
- // Instead of: user.setEnabled(value)
- userProfileModule.setProperty(user, User.INFO_USER_ENABLED, value);
+// Instead of: user.setEnabled(value)
+userProfileModule.setProperty(user, User.INFO_USER_ENABLED, value);
- // In a similar way you should change rest of methods that are missing in User interface in 2.6 by the call to the UserProfileModule
+// In a similar way you should change rest of methods that are missing in User interface in 2.6 by the call to the UserProfileModule
- // Instead of: user.getProperties()
- userProfileModule.getProperties(user);
+// Instead of: user.getProperties()
+userProfileModule.getProperties(user);
- // Instead of: user.getGivenName()
- userProfileModule.getProperty(user, User.INFO_USER_NAME_GIVEN);
+// Instead of: user.getGivenName()
+userProfileModule.getProperty(user, User.INFO_USER_NAME_GIVEN);
- // Instead of: user.getFamilyName()
- userProfileModule.getProperty(user, User.INFO_USER_NAME_FAMILY);
+// Instead of: user.getFamilyName()
+userProfileModule.getProperty(user, User.INFO_USER_NAME_FAMILY);
- // Instead of: user.getRealEmail()
- userProfileModule.getProperty(user, User.INFO_USER_EMAIL_REAL);
+// Instead of: user.getRealEmail()
+userProfileModule.getProperty(user, User.INFO_USER_EMAIL_REAL);
- // Instead of: user.getFakeEmail()
- userProfileModule.getProperty(user, User.INFO_USER_EMAIL_FAKE);
+// Instead of: user.getFakeEmail()
+userProfileModule.getProperty(user, User.INFO_USER_EMAIL_FAKE);
- // Instead of: user.getRegistrationDate()
- userProfileModule.getProperty(user, User.INFO_USER_REGISTRATION_DATE);
+// Instead of: user.getRegistrationDate()
+userProfileModule.getProperty(user, User.INFO_USER_REGISTRATION_DATE);
- // Instead of: user.getViewRealEmail()
- userProfileModule.getProperty(user, User.INFO_USER_VIEW_EMAIL_VIEW_REAL);
+// Instead of: user.getViewRealEmail()
+userProfileModule.getProperty(user, User.INFO_USER_VIEW_EMAIL_VIEW_REAL);
- // Instead of: user.getPreferredLocale()
- userProfileModule.getProperty(user, User.INFO_USER_LOCALE);
+// Instead of: user.getPreferredLocale()
+userProfileModule.getProperty(user, User.INFO_USER_LOCALE);
- // Instead of: user.getSignature()
- userProfileModule.getProperty(user, User.INFO_USER_SIGNATURE);
+// Instead of: user.getSignature()
+userProfileModule.getProperty(user, User.INFO_USER_SIGNATURE);
- // Instead of: user.getLastVisitDate()
- userProfileModule.getProperty(user, User.INFO_USER_LAST_LOGIN_DATE);]]>
- </programlisting>
+// Instead of: user.getLastVisitDate()
+userProfileModule.getProperty(user, User.INFO_USER_LAST_LOGIN_DATE);]]></programlisting>
</listitem>
<listitem>
<para>
The <emphasis role="bold">RoleModule</emphasis> interface:
</para>
- <programlisting>
- <![CDATA[
- // Instead of
- // RoleModule.findRoleMembers(String roleName, int offset, int limit, String userNameFilter) throws IdentityException;
- membershipModule.findRoleMembers(String roleName, int offset, int limit, String userNameFilter)
+ <programlisting><![CDATA[
+// Instead of
+// RoleModule.findRoleMembers(String roleName, int offset, int limit, String userNameFilter) throws IdentityException;
+membershipModule.findRoleMembers(String roleName, int offset, int limit, String userNameFilter)
- // Instead of
- // RoleModule.setRoles(User user, Set roles) throws IdentityException;
- membershipModule.assignRoles(User user, Set roles)
+// Instead of
+// RoleModule.setRoles(User user, Set roles) throws IdentityException;
+membershipModule.assignRoles(User user, Set roles)
- // Instead of
- // RoleModule.getRoles(User user) throws IdentityException;
- membershipModule.getRoles(User user)]]>
- </programlisting>
+// Instead of
+// RoleModule.getRoles(User user) throws IdentityException;
+membershipModule.getRoles(User user)]]></programlisting>
</listitem>
</itemizedlist>
</sect2>
@@ -407,23 +380,20 @@
<emphasis role="bold">jboss-porta.sar/META-INF/jboss-service.xml</emphasis>
in section:
</para>
- <programlisting>
- <![CDATA[
- <mbean
- code="org.jboss.portal.identity.IdentityServiceControllerImpl"
- name="portal:service=Module,type=IdentityServiceController"
- xmbean-dd=""
- xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
- <xmbean/>
- <depends>portal:service=Hibernate</depends>
- <!--<depends>jboss.jca:service=DataSourceBinding,name=@portal.datasource.name@</depends>-->
- <attribute name="JndiName">java:/portal/IdentityServiceController</attribute>
- <attribute name="RegisterMBeans">true</attribute>
- <attribute name="ConfigFile">conf/identity/identity-config.xml</attribute>
- <attribute name="DefaultConfigFile">conf/identity/standardidentity-config.xml</attribute>
- </mbean>
- ]]>
- </programlisting>
+ <programlisting><![CDATA[
+<mbean
+ code="org.jboss.portal.identity.IdentityServiceControllerImpl"
+ name="portal:service=Module,type=IdentityServiceController"
+ xmbean-dd=""
+ xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
+ <xmbean/>
+ <depends>portal:service=Hibernate</depends>
+ <!--<depends>jboss.jca:service=DataSourceBinding,name=@portal.datasource.name@</depends>-->
+ <attribute name="JndiName">java:/portal/IdentityServiceController</attribute>
+ <attribute name="RegisterMBeans">true</attribute>
+ <attribute name="ConfigFile">conf/identity/identity-config.xml</attribute>
+ <attribute name="DefaultConfigFile">conf/identity/standardidentity-config.xml</attribute>
+</mbean>]]></programlisting>
<para>
change
<emphasis role="bold">identity-config.xml</emphasis>
@@ -444,49 +414,43 @@
After doing on of above changes you need to edit configuration file that you choose to
use (identity-config.xml or ldap_identity-config.xml) and configure LDAP connection options in section:
</para>
- <programlisting>
- <![CDATA[
- <datasource>
- <name>LDAP</name>
- <config>
- <option>
- <name>host</name>
- <value>jboss.com</value>
- </option>
- <option>
- <name>port</name>
- <value>10389</value>
- </option>
- <option>
- <name>adminDN</name>
- <value>cn=Directory Manager</value>
- </option>
- <option>
- <name>adminPassword</name>
- <value>qpq123qpq</value>
- </option>
- </config>
- </datasource>
- ]]>
- </programlisting>
+ <programlisting><![CDATA[
+<datasource>
+ <name>LDAP</name>
+ <config>
+ <option>
+ <name>host</name>
+ <value>jboss.com</value>
+ </option>
+ <option>
+ <name>port</name>
+ <value>10389</value>
+ </option>
+ <option>
+ <name>adminDN</name>
+ <value>cn=Directory Manager</value>
+ </option>
+ <option>
+ <name>adminPassword</name>
+ <value>qpq123qpq</value>
+ </option>
+ </config>
+</datasource>]]></programlisting>
<para>
You also need to specify options for your LDAP tree (described in configuration documentation) like those:
</para>
- <programlisting>
- <![CDATA[
- <option-group>
- <group-name>common</group-name>
- <option>
- <name>userContainerDN</name>
- <value>ou=People,dc=portal26,dc=jboss,dc=com</value>
- </option>
- <option>
- <name>roleContainerDN</name>
- <value>ou=Roles,dc=portal26,dc=jboss,dc=com</value>
- </option>
- </option-group>
- ]]>
- </programlisting>
+ <programlisting><![CDATA[
+<option-group>
+ <group-name>common</group-name>
+ <option>
+ <name>userContainerDN</name>
+ <value>ou=People,dc=portal26,dc=jboss,dc=com</value>
+ </option>
+ <option>
+ <name>roleContainerDN</name>
+ <value>ou=Roles,dc=portal26,dc=jboss,dc=com</value>
+ </option>
+</option-group>]]></programlisting>
<note>
Under <emphasis role="bold">PORTAL_SOURCES/identity/src/resources/example/</emphasis> you can find a sample ldif that
@@ -500,35 +464,29 @@
<title>SSL</title>
<para>The setup is very similar to the one described in LdapLoginModule <ulink url="http://www.jboss.org/wiki/Wiki.jsp?page=LdapLoginModule">wiki page</ulink></para>
<para>You need to modify your identity configuration file and add "protocol"</para>
- <programlisting>
- <![CDATA[
- <datasource>
- <name>LDAP</name>
- <config>
- ...
- <option>
- <name>protocol</name>
- <value>ssl</value>
- </option>
- ...
- </config>
- </datasource>
- ]]>
- </programlisting>
+ <programlisting><![CDATA[
+<datasource>
+ <name>LDAP</name>
+ <config>
+ ...
+ <option>
+ <name>protocol</name>
+ <value>ssl</value>
+ </option>
+ ...
+ </config>
+</datasource>]]></programlisting>
<para>
Then you need to have LDAP server certificate imported into your keystore. You can use following command:
<programlisting>keytool -import -file ldapcert.der -keystore ldap.truststore</programlisting>
</para>
<para>
Now you need to change the settings to use the alternative truststore. That can be done in the properties-service.xml in deploy directory:
- <programlisting>
- <![CDATA[
- <attribute name="Properties">
- javax.net.ssl.trustStore=../some/path/to/ldap.truststore
- javax.net.ssl.trustStorePassword=somepw
- </attribute>
- ]]>
- </programlisting>
+ <programlisting><![CDATA[
+<attribute name="Properties">
+ javax.net.ssl.trustStore=../some/path/to/ldap.truststore
+ javax.net.ssl.trustStorePassword=somepw
+</attribute>]]></programlisting>
</para>
</sect2>
<sect2>
@@ -536,19 +494,16 @@
<para>Instead of configuring your own connection you can use JNDI context federation mechanism in JBoss Application Server. Configuration of
ExternalContext is described in <ulink url="http://docs.jboss.com/jbossas/guides/j2eeguide/r2/en/html_single/#d0e6877">JBoss Application Server documentation</ulink></para>
<para>When you have ExternalContext configured you can use it in JBoss Portal by providing proper JNDI name in the configuration:
- <programlisting>
- <![CDATA[
- <datasource>
- <name>LDAP</name>
- <config>
- <option>
- <name>externalContextJndiName</name>
- <value>external/ldap/jboss</value>
- </option>
- </config>
- </datasource>
- ]]>
- </programlisting>
+ <programlisting><![CDATA[
+<datasource>
+ <name>LDAP</name>
+ <config>
+ <option>
+ <name>externalContextJndiName</name>
+ <value>external/ldap/jboss</value>
+ </option>
+ </config>
+</datasource>]]></programlisting>
<note>When using "externalContextJndiName" you don't need to specify any other option for this datasource</note>
</para>
</sect2>
@@ -583,23 +538,20 @@
<emphasis>jboss-portal.sar/META-INF/jboss-service.xml</emphasis>
</para>
- <programlisting>
- <![CDATA[
- <mbean
- code="org.jboss.portal.identity.IdentityServiceControllerImpl"
- name="portal:service=Module,type=IdentityServiceController"
- xmbean-dd=""
- xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
- <xmbean/>
- <depends>portal:service=Hibernate</depends>
- <!--<depends>jboss.jca:service=DataSourceBinding,name=@portal.datasource.name@</depends>-->
- <attribute name="JndiName">java:/portal/IdentityServiceController</attribute>
- <attribute name="RegisterMBeans">true</attribute>
- <attribute name="ConfigFile">conf/identity/identity-config.xml</attribute>
- <attribute name="DefaultConfigFile">conf/identity/standardidentity-config.xml</attribute>
- </mbean>
- ]]>
- </programlisting>
+ <programlisting><![CDATA[
+<mbean
+ code="org.jboss.portal.identity.IdentityServiceControllerImpl"
+ name="portal:service=Module,type=IdentityServiceController"
+ xmbean-dd=""
+ xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
+ <xmbean/>
+ <depends>portal:service=Hibernate</depends>
+ <!--<depends>jboss.jca:service=DataSourceBinding,name=@portal.datasource.name@</depends>-->
+ <attribute name="JndiName">java:/portal/IdentityServiceController</attribute>
+ <attribute name="RegisterMBeans">true</attribute>
+ <attribute name="ConfigFile">conf/identity/identity-config.xml</attribute>
+ <attribute name="DefaultConfigFile">conf/identity/standardidentity-config.xml</attribute>
+</mbean>]]></programlisting>
<para>
We can specify few options here:
<itemizedlist>
@@ -631,66 +583,60 @@
<para>
The file describing portal identity services contains three sections:
</para>
- <programlisting>
- <![CDATA[
- <identity-configuration>
- <datasources>
- <!-- Datasources section -->
- <datasource> ... </datasource>
- <datasource> ... </datasource>
- ...
- </datasources>
- <modules>
- <!-- Modules section -->
- <module> ... </module>
- <module> ... </module>
- ...
- </modules>
- <options>
- <!-- Options section -->
- <option-group> ... </option-group>
- <option-group> ... </option-group>
- ...
- </options>
- </identity-configuration>
- ]]>
- </programlisting>
+ <programlisting><![CDATA[
+<identity-configuration>
+ <datasources>
+ <!-- Datasources section -->
+ <datasource> ... </datasource>
+ <datasource> ... </datasource>
+ ...
+ </datasources>
+ <modules>
+ <!-- Modules section -->
+ <module> ... </module>
+ <module> ... </module>
+ ...
+ </modules>
+ <options>
+ <!-- Options section -->
+ <option-group> ... </option-group>
+ <option-group> ... </option-group>
+ ...
+ </options>
+</identity-configuration>]]></programlisting>
<sect3>
<title>Datasources</title>
<para>This section defines datasource components. They will be processed and instantiated before components in
<emphasis role="bold">Module</emphasis> section, so they will be ready to serve them.</para>
<note>This section isn't used whith Database configuration as in JBoss Portal services exposing Hibernate
are defined separately. It's used by LDAP configuration and we'll use it as an example</note>
- <programlisting>
- <![CDATA[
- <datasource>
- <name>LDAP</name>
- <service-name>portal:service=Module,type=LDAPConnectionContext</service-name>
- <class>org.jboss.portal.identity.ldap.LDAPConnectionContext</class>
- <config>
- <option>
- <name>host</name>
- <value>jboss.com</value>
- </option>
- <option>
- <name>port</name>
- <value>10389</value>
- </option>
- <option>
- <name>adminDN</name>
- <value>cn=Directory Manager</value>
- </option>
- <option>
- <name>adminPassword</name>
- <value>xxxxx</value>
- </option>
+ <programlisting><![CDATA[
+<datasource>
+ <name>LDAP</name>
+ <service-name>portal:service=Module,type=LDAPConnectionContext</service-name>
+ <class>org.jboss.portal.identity.ldap.LDAPConnectionContext</class>
+ <config>
+ <option>
+ <name>host</name>
+ <value>jboss.com</value>
+ </option>
+ <option>
+ <name>port</name>
+ <value>10389</value>
+ </option>
+ <option>
+ <name>adminDN</name>
+ <value>cn=Directory Manager</value>
+ </option>
+ <option>
+ <name>adminPassword</name>
+ <value>xxxxx</value>
+ </option>
- <!-- Other options here.... -->
+ <!-- Other options here.... -->
- </config>
- </datasource>
- ]]>
- </programlisting>
+ </config>
+</datasource>]]></programlisting>
<note>If you look into JBoss Portal configuration files you will find that <![CDATA[<service-name/> and <class/>]]>
are specified in <emphasis role="bold">DefaultConfigFile</emphasis> and not in <emphasis role="bold">ConfigFile</emphasis>.
So this is how it works. Those two will be picked up from default configuration. The same rule takes place
@@ -700,31 +646,28 @@
<sect3>
<title>Modules</title>
<para>Modules are core service components like UserModule, RoleModule and etc. </para>
- <programlisting>
- <![CDATA[
- <module>
- <!--type used to correctly map in IdentityContext registry-->
- <type>User</type>
- <implementation>DB</implementation>
+ <programlisting><![CDATA[
+<module>
+ <!--type used to correctly map in IdentityContext registry-->
+ <type>User</type>
+ <implementation>DB</implementation>
- <!--name of service and class for creating mbean-->
- <service-name>portal:service=Module,type=User</service-name>
- <class>org.jboss.portal.identity.db.HibernateUserModuleImpl</class>
+ <!--name of service and class for creating mbean-->
+ <service-name>portal:service=Module,type=User</service-name>
+ <class>org.jboss.portal.identity.db.HibernateUserModuleImpl</class>
- <!--set of options that are passed to a class constructor-->
- <config>
- <option>
- <name>sessionFactoryJNDIName</name>
- <value>java:/portal/IdentitySessionFactory</value>
- </option>
- <option>
- <name>jndiName</name>
- <value>java:/portal/UserModule</value>
- </option>
- </config>
- </module>
- ]]>
- </programlisting>
+ <!--set of options that are passed to a class constructor-->
+ <config>
+ <option>
+ <name>sessionFactoryJNDIName</name>
+ <value>java:/portal/IdentitySessionFactory</value>
+ </option>
+ <option>
+ <name>jndiName</name>
+ <value>java:/portal/UserModule</value>
+ </option>
+ </config>
+</module>]]></programlisting>
<itemizedlist>
<listitem>
<para>
@@ -762,16 +705,13 @@
The above code snippet with User module comes from <emphasis role="bold">standardidentity-config.xml</emphasis>, so the file
that defines default configuration values. Because of this in the main configuration file the definition of
User module will be as short as:
- <programlisting>
- <![CDATA[
- <module>
- <!--type used to correctly map in IdentityContext registry-->
- <type>User</type>
- <implementation>DB</implementation>
- <config/>
- </module>
- ]]>
- </programlisting>
+ <programlisting><![CDATA[
+<module>
+ <!--type used to correctly map in IdentityContext registry-->
+ <type>User</type>
+ <implementation>DB</implementation>
+ <config/>
+</module>]]></programlisting>
As you see we specify only type and implementation - all the other values (service-name, class and set of options)
will be taken from default configuration. But remember that still you can overwrite any of those values in the
main config simply by specifying them.
@@ -782,66 +722,63 @@
<title>Options</title>
<para>This section provides common options that are accessible by identity modules. We put here options
that may need to be shared. They are groupped, and can have many values:</para>
- <programlisting>
- <![CDATA[
- <options>
- <!--Common options section-->
- <option-group>
- <group-name>common</group-name>
- <option>
- <name>userContainerDN</name>
- <value>ou=People,dc=example,dc=com</value>
- </option>
- <option>
- <name>uidAttributeID</name>
- <value>uid</value>
- </option>
- <option>
- <name>passwordAttributeID</name>
- <value>userPassword</value>
- </option>
- <option>
- <name>roleContainerDN</name>
- <value>ou=Roles,dc=example,dc=com</value>
- </option>
- <option>
- <name>ridAttributeId</name>
- <value>cn</value>
- </option>
- <option>
- <name>roleDisplayNameAttributeID</name>
- <value>cn</value>
- </option>
- <option>
- <name>membershipAttributeID</name>
- <value>member</value>
- </option>
- <option>
- <name>membershipAttributeIsDN</name>
- <value>true</value>
- </option>
- </option-group>
- <option-group>
- <group-name>userCreateAttibutes</group-name>
- <option>
- <name>objectClass</name>
- <value>top</value>
- <value>uidObject</value>
- <value>person</value>
- <value>inetUser</value>
- </option>
- <!--Schema requires those to have initial value-->
- <option>
- <name>cn</name>
- <value>none</value>
- </option>
- <option>
- <name>sn</name>
- <value>none</value>
- </option>
- </option-group>
- ]]>
- </programlisting>
+ <programlisting><![CDATA[
+<options>
+<!--Common options section-->
+<option-group>
+ <group-name>common</group-name>
+ <option>
+ <name>userContainerDN</name>
+ <value>ou=People,dc=example,dc=com</value>
+ </option>
+ <option>
+ <name>uidAttributeID</name>
+ <value>uid</value>
+ </option>
+ <option>
+ <name>passwordAttributeID</name>
+ <value>userPassword</value>
+ </option>
+ <option>
+ <name>roleContainerDN</name>
+ <value>ou=Roles,dc=example,dc=com</value>
+ </option>
+ <option>
+ <name>ridAttributeId</name>
+ <value>cn</value>
+ </option>
+ <option>
+ <name>roleDisplayNameAttributeID</name>
+ <value>cn</value>
+ </option>
+ <option>
+ <name>membershipAttributeID</name>
+ <value>member</value>
+ </option>
+ <option>
+ <name>membershipAttributeIsDN</name>
+ <value>true</value>
+ </option>
+</option-group>
+<option-group>
+ <group-name>userCreateAttibutes</group-name>
+ <option>
+ <name>objectClass</name>
+ <value>top</value>
+ <value>uidObject</value>
+ <value>person</value>
+ <value>inetUser</value>
+ </option>
+ <!--Schema requires those to have initial value-->
+ <option>
+ <name>cn</name>
+ <value>none</value>
+ </option>
+ <option>
+ <name>sn</name>
+ <value>none</value>
+ </option>
+</option-group>]]></programlisting>
<note>In this section we use the same inheritance mechanism. When option is not set, it's value will be taken
from the default config file. But this also means that you need to overwrite some values that
are specific for your LDAP architecture. All the options will be described along with module implementations
19 years, 2 months
JBoss Portal SVN: r6238 - docs/trunk/referenceGuide/en/modules.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-02-12 17:47:26 -0500 (Mon, 12 Feb 2007)
New Revision: 6238
Modified:
docs/trunk/referenceGuide/en/modules/navtabs.xml
Log:
monkey format navtabs
Modified: docs/trunk/referenceGuide/en/modules/navtabs.xml
===================================================================
--- docs/trunk/referenceGuide/en/modules/navtabs.xml 2007-02-12 22:46:02 UTC (rev 6237)
+++ docs/trunk/referenceGuide/en/modules/navtabs.xml 2007-02-12 22:47:26 UTC (rev 6238)
@@ -24,8 +24,7 @@
). Ordering is accomplished using the
<emphasis>order</emphasis>
tag at the page level as a page property.
- <programlisting>
- <![CDATA[
+ <programlisting><![CDATA[
<page>
<page-name>default</page-name>
<properties>
@@ -35,9 +34,7 @@
</property>
</properties>
...
-</page>
- ]]>
- </programlisting>
+</page>]]></programlisting>
</para>
</sect1>
<sect1>
@@ -57,9 +54,7 @@
PAGENAME_default=Accueil
PAGENAME_Admin=Admin
PAGENAME_Test=Test
-PAGENAME_News=Actualités
- ]]>
- </programlisting>
+PAGENAME_News=Actualités]]></programlisting>
So the mapping pattern is
<emphasis>PAGE_NAME_[Name in *-object.xml]=[translated value]</emphasis>
</para>
19 years, 2 months
JBoss Portal SVN: r6237 - docs/trunk/referenceGuide/en/modules.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-02-12 17:46:02 -0500 (Mon, 12 Feb 2007)
New Revision: 6237
Modified:
docs/trunk/referenceGuide/en/modules/cmsPortlet.xml
Log:
started to rework CMS portlet chapter
Modified: docs/trunk/referenceGuide/en/modules/cmsPortlet.xml
===================================================================
--- docs/trunk/referenceGuide/en/modules/cmsPortlet.xml 2007-02-12 22:43:14 UTC (rev 6236)
+++ docs/trunk/referenceGuide/en/modules/cmsPortlet.xml 2007-02-12 22:46:02 UTC (rev 6237)
@@ -53,13 +53,12 @@
.
</para>
<programlisting><![CDATA[
- <portlet-preferences>
- <preference>
- <name>indexpage</name>
- <value>/default/index.html</value>
- </preference>
- </portlet-preferences>]]>
- </programlisting>
+<portlet-preferences>
+ <preference>
+ <name>indexpage</name>
+ <value>/default/index.html</value>
+ </preference>
+</portlet-preferences>]]></programlisting>
<para>
The preference key is "indexpage". To change the default page, just make sure to create
an html document using the CMS Admin portlet then change the value of "indexpage" to
@@ -77,13 +76,13 @@
<literal>portal-cms.sar/META-INF-INF/jboss-service.xml</literal>
</para>
<programlisting><![CDATA[
- ...
- <attribute name="DoChecking">true</attribute>
- <attribute name="DefaultContentLocation">portal/cms/conf/default-content/default/</attribute>
- <attribute name="DefaultLocale">en</attribute>
- <attribute name="RepositoryName">PortalRepository</attribute>
- <attribute name="HomeDir">${jboss.server.data.dir}${/}portal${/}cms${/}conf</attribute>
- ]]></programlisting>
+...
+<attribute name="DoChecking">true</attribute>
+<attribute name="DefaultContentLocation">portal/cms/conf/default-content/default/</attribute>
+<attribute name="DefaultLocale">en</attribute>
+<attribute name="RepositoryName">PortalRepository</attribute>
+<attribute name="HomeDir">${jboss.server.data.dir}${/}portal${/}cms${/}conf</attribute>]]>
+...</programlisting>
<para>Below is a list of items found in the service descriptor and their definitions. Only
items commonly changed are covered here and it is recommended you do not change any others
unless you are very brave.</para>
@@ -124,22 +123,20 @@
and change the value of Prefix to something else. Please note that you cannot change it to "nothing", you
need to provide a value.
</para>
- <programlisting>
- <![CDATA[
- ...
- <mbean
- code="org.jboss.portal.core.cms.CMSObjectCommandFactory"
- name="portal:commandFactory=CMSObject"
- xmbean-dd=""
- xmbean-code="org.jboss.portal.common.system.JBossServiceModelMBean">
- <xmbean/>
- <attribute name="Prefix">content</attribute>
- <attribute name="TargetWindowRef">default.default.CMSPortletWindow</attribute>
- <depends optional-attribute-name="Factory" proxy-type="attribute">portal:commandFactory=Delegating</depends>
- <depends optional-attribute-name="CMSService" proxy-type="attribute">portal:service=CMS</depends>
- </mbean>
- ...
- ]]>
+ <programlisting><![CDATA[
+...
+<mbean
+ code="org.jboss.portal.core.cms.CMSObjectCommandFactory"
+ name="portal:commandFactory=CMSObject"
+ xmbean-dd=""
+ xmbean-code="org.jboss.portal.common.system.JBossServiceModelMBean">
+ <xmbean/>
+ <attribute name="Prefix">content</attribute>
+ <attribute name="TargetWindowRef">default.default.CMSPortletWindow</attribute>
+ <depends optional-attribute-name="Factory" proxy-type="attribute">portal:commandFactory=Delegating</depends>
+ <depends optional-attribute-name="CMSService" proxy-type="attribute">portal:service=CMS</depends>
+</mbean>
+...]]>
</programlisting>
<itemizedlist>
<listitem>
@@ -319,79 +316,74 @@
It works the same way as the server interceptor, for each interceptor you need to define an mbean then add it
to the cms interceptor stack. For example, if you have the 2 default interceptors, you should have the following
lines in the jboss-service.xml file:
- <programlisting>
- <![CDATA[
- <mbean
- code="org.jboss.portal.cms.impl.interceptors.LogInterceptor"
- name="portal:service=Interceptor,type=Cms,name=Log"
- xmbean-dd=""
- xmbean-code="org.jboss.portal.common.system.JBossServiceModelMBean">
- <xmbean/>
- </mbean>
- <mbean
- code="org.jboss.portal.cms.impl.interceptors.CacheInterceptor"
- name="portal:service=Interceptor,type=Cms,name=Cache"
- xmbean-dd=""
- xmbean-code="org.jboss.portal.common.system.JBossServiceModelMBean">
- <xmbean/>
- <depends>portal:service=CMSTreeCache</depends>
- </mbean>
- <mbean
- code="org.jboss.portal.server.impl.invocation.JBossInterceptorStack"
- name="portal:service=InterceptorStack,type=Cms"
- xmbean-dd=""
- xmbean-code="org.jboss.portal.common.system.JBossServiceModelMBean">
- <xmbean/>
- <depends-list optional-attribute-name="InterceptorNames">
- <depends-list-element>portal:service=Interceptor,type=Cms,name=Log</depends-list-element>
- <depends-list-element>portal:service=Interceptor,type=Cms,name=Cache</depends-list-element>
- </depends-list>
- </mbean>
- ]]>
+ <programlisting><![CDATA[
+<mbean
+ code="org.jboss.portal.cms.impl.interceptors.LogInterceptor"
+ name="portal:service=Interceptor,type=Cms,name=Log"
+ xmbean-dd=""
+ xmbean-code="org.jboss.portal.common.system.JBossServiceModelMBean">
+ <xmbean/>
+</mbean>
+<mbean
+ code="org.jboss.portal.cms.impl.interceptors.CacheInterceptor"
+ name="portal:service=Interceptor,type=Cms,name=Cache"
+ xmbean-dd=""
+ xmbean-code="org.jboss.portal.common.system.JBossServiceModelMBean">
+ <xmbean/>
+ <depends>portal:service=CMSTreeCache</depends>
+</mbean>
+<mbean
+ code="org.jboss.portal.server.impl.invocation.JBossInterceptorStack"
+ name="portal:service=InterceptorStack,type=Cms"
+ xmbean-dd=""
+ xmbean-code="org.jboss.portal.common.system.JBossServiceModelMBean">
+ <xmbean/>
+ <depends-list optional-attribute-name="InterceptorNames">
+ <depends-list-element>portal:service=Interceptor,type=Cms,name=Log</depends-list-element>
+ <depends-list-element>portal:service=Interceptor,type=Cms,name=Cache</depends-list-element>
+ </depends-list>
+</mbean>]]>
</programlisting>
The first two mbeans define the interceptors and the third mbean, define which interceptors to add to
the CMS service.
</para>
<para>
If you create your own interceptor <literal>org.example.myCMSInterceptor</literal>, the service descriptor file will look like:
- <programlisting>
- <![CDATA[
- <mbean
- code="org.example.myCMSInterceptor"
- name="portal:service=Interceptor,type=Cms,name=MyName"
- xmbean-dd=""
- xmbean-code="org.jboss.portal.common.system.JBossServiceModelMBean">
- <xmbean/>
- </mbean>
- <mbean
- code="org.jboss.portal.cms.impl.interceptors.LogInterceptor"
- name="portal:service=Interceptor,type=Cms,name=Log"
- xmbean-dd=""
- xmbean-code="org.jboss.portal.common.system.JBossServiceModelMBean">
- <xmbean/>
- </mbean>
- <mbean
- code="org.jboss.portal.cms.impl.interceptors.CacheInterceptor"
- name="portal:service=Interceptor,type=Cms,name=Cache"
- xmbean-dd=""
- xmbean-code="org.jboss.portal.common.system.JBossServiceModelMBean">
- <xmbean/>
- <depends>portal:service=CMSTreeCache</depends>
- </mbean>
- <mbean
- code="org.jboss.portal.server.impl.invocation.JBossInterceptorStack"
- name="portal:service=InterceptorStack,type=Cms"
- xmbean-dd=""
- xmbean-code="org.jboss.portal.common.system.JBossServiceModelMBean">
- <xmbean/>
- <depends-list optional-attribute-name="InterceptorNames">
- <depends-list-element>portal:service=Interceptor,type=Cms,name=Log</depends-list-element>
- <depends-list-element>portal:service=Interceptor,type=Cms,name=Cache</depends-list-element>
- <depends-list-element>portal:service=Interceptor,type=Cms,name=MyName</depends-list-element>
- </depends-list>
- </mbean>
- ]]>
- </programlisting>
+ <programlisting><![CDATA[
+<mbean
+ code="org.example.myCMSInterceptor"
+ name="portal:service=Interceptor,type=Cms,name=MyName"
+ xmbean-dd=""
+ xmbean-code="org.jboss.portal.common.system.JBossServiceModelMBean">
+ <xmbean/>
+</mbean>
+<mbean
+ code="org.jboss.portal.cms.impl.interceptors.LogInterceptor"
+ name="portal:service=Interceptor,type=Cms,name=Log"
+ xmbean-dd=""
+ xmbean-code="org.jboss.portal.common.system.JBossServiceModelMBean">
+ <xmbean/>
+</mbean>
+<mbean
+ code="org.jboss.portal.cms.impl.interceptors.CacheInterceptor"
+ name="portal:service=Interceptor,type=Cms,name=Cache"
+ xmbean-dd=""
+ xmbean-code="org.jboss.portal.common.system.JBossServiceModelMBean">
+ <xmbean/>
+ <depends>portal:service=CMSTreeCache</depends>
+</mbean>
+<mbean
+ code="org.jboss.portal.server.impl.invocation.JBossInterceptorStack"
+ name="portal:service=InterceptorStack,type=Cms"
+ xmbean-dd=""
+ xmbean-code="org.jboss.portal.common.system.JBossServiceModelMBean">
+ <xmbean/>
+ <depends-list optional-attribute-name="InterceptorNames">
+ <depends-list-element>portal:service=Interceptor,type=Cms,name=Log</depends-list-element>
+ <depends-list-element>portal:service=Interceptor,type=Cms,name=Cache</depends-list-element>
+ <depends-list-element>portal:service=Interceptor,type=Cms,name=MyName</depends-list-element>
+ </depends-list>
+</mbean>]]></programlisting>
</para>
<note>
<para>
19 years, 2 months
JBoss Portal SVN: r6236 - docs/trunk/referenceGuide/en/modules.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-02-12 17:43:14 -0500 (Mon, 12 Feb 2007)
New Revision: 6236
Modified:
docs/trunk/referenceGuide/en/modules/security.xml
Log:
added DTD whenever possible in security section + monkey cosmetic
Modified: docs/trunk/referenceGuide/en/modules/security.xml
===================================================================
--- docs/trunk/referenceGuide/en/modules/security.xml 2007-02-12 22:39:38 UTC (rev 6235)
+++ docs/trunk/referenceGuide/en/modules/security.xml 2007-02-12 22:43:14 UTC (rev 6236)
@@ -30,10 +30,13 @@
<emphasis><security-constraint></emphasis>
tag:
<programlisting><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE deployments PUBLIC
+ "-//JBoss Portal//DTD Portal Object 2.6//EN"
+ "http://www.jboss.org/portal/dtd/portal-object_2_6.dtd">
<deployments>
<deployment>
+ <parent-ref>default</parent-ref>
<if-exists>overwrite</if-exists>
- <parent-ref>default</parent-ref>
<properties/>
<page>
<page-name>MyPage</page-name>
@@ -45,14 +48,13 @@
</window>
<security-constraint>
<policy-permission>
+ <action-name>viewrecursive</action-name>
<unchecked/>
- <action-name>viewrecursive</action-name>
</policy-permission>
</security-constraint>
</page>
</deployment>
-</deployments>]]>
- </programlisting>
+</deployments>]]></programlisting>
</para>
<para>
A security constraint on an object (our example above, secures a specific portal page), is explained as:
@@ -194,13 +196,13 @@
<para>
The <emphasis>org.jboss.portal.security.spi.provider.AuthorizationDomain</emphasis> is an interface which provides access to several services.
<programlisting>
- public interface AuthorizationDomain
- {
- String getType();
- DomainConfigurator getConfigurator();
- PermissionRepository getPermissionRepository();
- PermissionFactory getPermissionFactory();
- }
+public interface AuthorizationDomain
+{
+ String getType();
+ DomainConfigurator getConfigurator();
+ PermissionRepository getPermissionRepository();
+ PermissionFactory getPermissionFactory();
+}
</programlisting>
<itemizedlist>
<listitem><emphasis>org.jboss.portal.security.spi.provider.DomainConfigurator</emphasis> provides configuration access
@@ -235,10 +237,12 @@
...
</mbean>
...
-</server>]]>
- </programlisting>
+</server>]]></programlisting>
<para>It be injected in the servlet context of a war file in the file <emphasis>WEB-INF/jboss-portlet.xml</emphasis></para>
<programlisting><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE portlet-app PUBLIC
+ "-//JBoss Portal//DTD JBoss Portlet 2.6//EN"
+ "http://www.jboss.org/portal/dtd/jboss-portlet_2_6.dtd">
<portlet-app>
...
<service>
@@ -247,8 +251,7 @@
<service-ref>:service=PortalAuthorizationManagerFactory</service-ref>
</service>
...
-</portlet-app>]]>
- </programlisting>
+</portlet-app>]]></programlisting>
<para>Here is an example of how a security check is made for a specific page</para>
<programlisting>
PortalAuthorizationManager pam = factory.getManager();
@@ -257,20 +260,18 @@
if (pam.checkPermission(perm) == false)
{
System.out.println("Current is not authorization to view page " + id);
-}
- </programlisting>
+}</programlisting>
</sect2>
<sect2>
<title>Configuring an authorization domain</title>
<para>Configuring a domain can be done through the <emphasis>DomainConfigurator</emphasis> interface</para>
<programlisting>
- public interface DomainConfigurator
- {
- Set getSecurityBindings(String uri);
- void setSecurityBindings(String uri, Set securityBindings) throws SecurityConfigurationException;
- void removeSecurityBindings(String uri) throws SecurityConfigurationException;
- }
- </programlisting>
+public interface DomainConfigurator
+{
+ Set getSecurityBindings(String uri);
+ void setSecurityBindings(String uri, Set securityBindings) throws SecurityConfigurationException;
+ void removeSecurityBindings(String uri) throws SecurityConfigurationException;
+}</programlisting>
<para>The various methods of that interface allows to configure security bindings for a given resource where
a resource is naturally identified by an URI. The <emphasis>org.jboss.portal.security.RoleSecurityBinding</emphasis>
object is an object which encapsulate a role name and a set of actions bound to this role.
@@ -281,8 +282,7 @@
Set bindings = new HashSet();
bindings.add(binding1);
bindings.add(binding2);
-configurator.setSecurityBinding(pageURI, bindings);
- </programlisting>
+configurator.setSecurityBinding(pageURI, bindings); </programlisting>
</sect2>
</sect1>
</chapter>
\ No newline at end of file
19 years, 2 months
JBoss Portal SVN: r6235 - docs/trunk/referenceGuide/en/modules.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-02-12 17:39:38 -0500 (Mon, 12 Feb 2007)
New Revision: 6235
Modified:
docs/trunk/referenceGuide/en/modules/wsrp.xml
Log:
added DTD whenever possible in WSRP section
Modified: docs/trunk/referenceGuide/en/modules/wsrp.xml
===================================================================
--- docs/trunk/referenceGuide/en/modules/wsrp.xml 2007-02-12 22:35:20 UTC (rev 6234)
+++ docs/trunk/referenceGuide/en/modules/wsrp.xml 2007-02-12 22:39:38 UTC (rev 6235)
@@ -91,15 +91,17 @@
<emphasis>remotable</emphasis> element is optional.
</para>
<para>
- <programlisting>
- <![CDATA[
+ <programlisting><![CDATA[
+<?xml version="1.0" standalone="yes"?>
+<!DOCTYPE portlet-app PUBLIC
+ "-//JBoss Portal//DTD JBoss Portlet 2.6//EN"
+ "http://www.jboss.org/portal/dtd/jboss-portlet_2_6.dtd">
<portlet-app>
<portlet>
<portlet-name>BasicPortlet</portlet-name>
<remotable>true</remotable>
</portlet>
-</portlet-app>]]>
- </programlisting>
+</portlet-app>]]></programlisting>
</para>
<para>
It is also possible to specify that all the portlets declared within a given <emphasis>jboss-portlet.xml</emphasis>
@@ -107,8 +109,11 @@
several portlets without having to specify the status for all the declared portlets. Let's look at an example:
</para>
<para>
- <programlisting>
- <![CDATA[
+ <programlisting><![CDATA[
+<?xml version="1.0" standalone="yes"?>
+<!DOCTYPE portlet-app PUBLIC
+ "-//JBoss Portal//DTD JBoss Portlet 2.6//EN"
+ "http://www.jboss.org/portal/dtd/jboss-portlet_2_6.dtd">
<portlet-app>
<remotable>true</remotable>
<portlet>
@@ -189,8 +194,8 @@
need to create a <emphasis>-wsrp.xml</emphasis> file (which we will call here
<emphasis>public-bea-wsrp.xml</emphasis> but the name does not matter as long as it ends with
<emphasis>-wsrp.xml</emphasis>) as follows:
- <programlisting>
- <![CDATA[
+ <programlisting><![CDATA[
+<?xml version="1.0" standalone="yes"?>
<deployments>
<deployment>
<wsrp-producer>
@@ -206,8 +211,7 @@
</registration-data>
</wsrp-producer>
</deployment>
-</deployments>]]>
- </programlisting>
+</deployments>]]></programlisting>
This producer descriptor gives access to BEA's public WSRP producer. We will look at the details of the
different elements later. Note for now the <emphasis>producer-id</emphasis> element with a "bea" value. Put
this file in the deploy directory and start the server (with JBoss Portal and its WSRP service deployed).
@@ -338,8 +342,7 @@
URLs:</para>
<para>
- <programlisting>
- <![CDATA[
+ <programlisting><![CDATA[
<?xml version="1.0" encoding="UTF-8"?>
<deployments>
<deployment>
@@ -354,16 +357,14 @@
</endpoint-config>
</wsrp-producer>
</deployment>
-</deployments>]]>
- </programlisting>
+</deployments>]]></programlisting>
</para>
<para>Here is an example of a WSRP descriptor with endpoint definition via remote WSDL file, registration
data and cache expiring every minute:</para>
<para>
- <programlisting>
- <![CDATA[
+ <programlisting><![CDATA[
<?xml version="1.0" encoding="UTF-8"?>
<deployments>
<deployment>
@@ -380,8 +381,7 @@
</registration-data>
</wsrp-producer>
</deployment>
-</deployments>]]>
- </programlisting>
+</deployments>]]></programlisting>
</para>
</sect2>
</sect1>
@@ -400,14 +400,12 @@
<title>Default configuration</title>
<para>
Let's look at the default configuration:
- <programlisting>
- <![CDATA[
+ <programlisting><![CDATA[
<producer-configuration>
<registration-configuration fullServiceDescriptionRequiresRegistration="true">
<registration-property-validator>org.jboss.portal.registration.policies.DefaultRegistrationPropertyValidator</registration-property-validator>
</registration-configuration>
-</producer-configuration>]]>
- </programlisting>
+</producer-configuration>]]></programlisting>
The top element <emphasis role="bold"><producer-configuration></emphasis> contains a single
<emphasis role="bold"><registration-configuration></emphasis> element that defines a
<emphasis>fullServiceDescritpionRequiresRegistration</emphasis> attribute with the value "true". This
@@ -504,8 +502,7 @@
values for two String registration properties named "name1" and "name2" respectively. The registration
service will use the <literal>com.example.portal.SomeCustomRegistrationPolicy</literal> class for its
registration policy.
- <programlisting>
- <![CDATA[
+ <programlisting><![CDATA[
<producer-configuration>
<registration-configuration fullServiceDescriptionRequiresRegistration="true">
<registration-policy>com.example.portal.SomeCustomRegistrationPolicy</registration-policy>
@@ -522,8 +519,7 @@
<label xml:lang="en" resourceName="resource.label2">label2</label>
</registration-property-description>
</registration-configuration>
-</producer-configuration>]]>
- </programlisting>
+</producer-configuration>]]></programlisting>
</para>
</sect2>
</sect1>
19 years, 2 months
JBoss Portal SVN: r6234 - docs/trunk/referenceGuide/en/modules.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-02-12 17:35:20 -0500 (Mon, 12 Feb 2007)
New Revision: 6234
Modified:
docs/trunk/referenceGuide/en/modules/clustering.xml
Log:
monkey format clustering
Modified: docs/trunk/referenceGuide/en/modules/clustering.xml
===================================================================
--- docs/trunk/referenceGuide/en/modules/clustering.xml 2007-02-12 22:33:02 UTC (rev 6233)
+++ docs/trunk/referenceGuide/en/modules/clustering.xml 2007-02-12 22:35:20 UTC (rev 6234)
@@ -253,43 +253,39 @@
change is needed in the jboss-portal-ha.sar/portal-cms.sar/META-INF/jboss-service.xml.
Replace the following configuration in the <emphasis>cms.pm.cache:service=TreeCache</emphasis> Mbean:
<programlisting><![CDATA[
- <!--
- Configuring the PortalCMSCacheLoader
-
- CacheLoader configuration for 1.4.0
- -->
- <attribute name="CacheLoaderConfiguration">
- <config>
- <passivation>false</passivation>
- <preload></preload>
- <shared>false</shared>
- <cacheloader>
- <class>org.jboss.portal.cms.hibernate.state.PortalCMSCacheLoader</class>
- <properties></properties>
- <async>false</async>
- <fetchPersistentState>false</fetchPersistentState>
- <ignoreModifications>false</ignoreModifications>
- </cacheloader>
- </config>
- </attribute>
- ]]>
+<!--
+ Configuring the PortalCMSCacheLoader
+ CacheLoader configuration for 1.4.0
+-->
+<attribute name="CacheLoaderConfiguration">
+ <config>
+ <passivation>false</passivation>
+ <preload></preload>
+ <shared>false</shared>
+ <cacheloader>
+ <class>org.jboss.portal.cms.hibernate.state.PortalCMSCacheLoader</class>
+ <properties></properties>
+ <async>false</async>
+ <fetchPersistentState>false</fetchPersistentState>
+ <ignoreModifications>false</ignoreModifications>
+ </cacheloader>
+ </config>
+</attribute>]]>
</programlisting>
with the following configuration:
<programlisting><![CDATA[
- <!--
- Configuring the PortalCMSCacheLoader
-
- CacheLoader configuratoon for 1.2.4SP2
- -->
- <attribute name="CacheLoaderClass">org.jboss.portal.cms.hibernate.state.PortalCMSCacheLoader</attribute>
- <attribute name="CacheLoaderConfig" replace="false"></attribute>
- <attribute name="CacheLoaderPassivation">false</attribute>
- <attribute name="CacheLoaderPreload"></attribute>
- <attribute name="CacheLoaderShared">false</attribute>
- <attribute name="CacheLoaderFetchTransientState">false</attribute>
- <attribute name="CacheLoaderFetchPersistentState">false</attribute>
- <attribute name="CacheLoaderAsynchronous">false</attribute>
- ]]></programlisting>
+<!--
+ Configuring the PortalCMSCacheLoader
+ CacheLoader configuratoon for 1.2.4SP2
+-->
+<attribute name="CacheLoaderClass">org.jboss.portal.cms.hibernate.state.PortalCMSCacheLoader</attribute>
+<attribute name="CacheLoaderConfig" replace="false"></attribute>
+<attribute name="CacheLoaderPassivation">false</attribute>
+<attribute name="CacheLoaderPreload"></attribute>
+<attribute name="CacheLoaderShared">false</attribute>
+<attribute name="CacheLoaderFetchTransientState">false</attribute>
+<attribute name="CacheLoaderFetchPersistentState">false</attribute>
+<attribute name="CacheLoaderAsynchronous">false</attribute> ]]></programlisting>
</para>
19 years, 2 months