Author: bdaw
Date: 2007-12-03 13:24:30 -0500 (Mon, 03 Dec 2007)
New Revision: 9249
Added:
modules/identity/trunk/identity/build.xml
modules/identity/trunk/identity/src/test/resources/hibernate/test-domain.hbm.xml
Removed:
modules/identity/trunk/identity/src/test/resources/hibernate/domain.hbm.xml
Modified:
modules/identity/trunk/build/pom.xml
modules/identity/trunk/identity/pom.xml
modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity/IdentityConfiguration.java
modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity/auth/SynchronizingLoginModule.java
modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity/ldap/LDAPUserModule.java
modules/identity/trunk/identity/src/test/resources/config/standardidentity-config.xml
modules/identity/trunk/identity/src/test/resources/jboss-unit.xml
modules/identity/trunk/identity/src/test/resources/org/jboss/portal/test/identity/db-beans.xml
modules/identity/trunk/identity/src/test/resources/org/jboss/portal/test/identity/ldap-beans.xml
Log:
- sync recent updates from branch 1.0
- convert testsuite to run using antrun plugin
Modified: modules/identity/trunk/build/pom.xml
===================================================================
--- modules/identity/trunk/build/pom.xml 2007-12-03 18:24:11 UTC (rev 9248)
+++ modules/identity/trunk/build/pom.xml 2007-12-03 18:24:30 UTC (rev 9249)
@@ -175,6 +175,15 @@
<enabled>false</enabled>
</releases>
</repository>
+ <repository>
+ <id>repository.codehaus.org</id>
+ <name>Codehaus Repository</name>
+ <layout>default</layout>
+ <url>http://repository.codehaus.org</url>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </repository>
</repositories>
<pluginRepositories>
<pluginRepository>
@@ -258,6 +267,12 @@
</dependency>
<dependency>
<groupId>org.jboss.unit</groupId>
+ <artifactId>opends</artifactId>
+ <version>${version.jboss.portal.test}</version>
+ <type>sar</type>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.unit</groupId>
<artifactId>jboss-unit-mc</artifactId>
<version>${version.jboss.portal.test}</version>
</dependency>
@@ -271,8 +286,12 @@
<artifactId>jboss-unit-tooling-maven2</artifactId>
<version>${version.jboss.portal.test}</version>
</dependency>
-
<dependency>
+ <groupId>org.jboss.unit</groupId>
+ <artifactId>jboss-unit-tooling-ant</artifactId>
+ <version>${version.jboss.portal.test}</version>
+ </dependency>
+ <dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${version.junit}</version>
@@ -284,12 +303,12 @@
<artifactId>jboss-kernel</artifactId>
<version>${version.jboss.microcontainer}</version>
</dependency>
+ <!--<dependency>-->
+ <!--<groupId>cargo</groupId>-->
+ <!--<artifactId>core</artifactId>-->
+ <!--<version>${version.cargo}</version>-->
+ <!--</dependency>-->
<dependency>
- <groupId>cargo</groupId>
- <artifactId>core</artifactId>
- <version>${version.cargo}</version>
- </dependency>
- <dependency>
<groupId>sun-opends</groupId>
<artifactId>opends-core</artifactId>
<version>${version.sun.opends}</version>
Added: modules/identity/trunk/identity/build.xml
===================================================================
--- modules/identity/trunk/identity/build.xml (rev 0)
+++ modules/identity/trunk/identity/build.xml 2007-12-03 18:24:30 UTC (rev 9249)
@@ -0,0 +1,153 @@
+<?xml version="1.0"?>
+<project name="identity-test"
xmlns:artifact="urn:maven-artifact-ant">
+
+ <target name="test">
+
+ <!--<property name="jboss_home"
value="/home/bdaw/Workshop/JBoss/server/jboss-4.2.1.GA"/>-->
+ <echo message="JBOSS_HOME= ${jboss_home}"/>
+
+ <!--<echo message="compile classpath:
${compile_classpath}"/>-->
+ <!--<echo message="runtime classpath:
${runtime_classpath}"/>-->
+ <!--<echo message="test classpath:
${test_classpath}"/>-->
+ <!--<echo message="plugin classpath:
${plugin_classpath}"/>-->
+
+ <mkdir dir="target/jboss-unit"/>
+ <get
src="http://www.apache.org/dist/maven/binaries/maven-ant-tasks-2.0.7...
dest="./target/jboss-unit/maven-ant-tasks.jar"/>
+ <path id="maven-ant-tasks.classpath"
path="target/jboss-unit/maven-ant-tasks.jar" />
+ <typedef resource="org/apache/maven/artifact/ant/antlib.xml"
uri="urn:maven-artifact-ant"
+ classpathref="maven-ant-tasks.classpath" />
+
+ <ant>
+ <target name="deploy-opends"/>
+ </ant>
+
+ <ant>
+ <target name="cargo.jboss-4.2.start"/>
+ </ant>
+
+ <ant>
+ <target name="jboss-unit"/>
+ </ant>
+
+ <ant>
+ <target name="cargo.jboss-4.2.stop"/>
+ </ant>
+
+ <ant>
+ <target name="undeploy-opends"/>
+ </ant>
+
+ </target>
+
+ <target name="deploy-opends">
+
+ <artifact:dependencies pathId="opends.classpath"
filesetId="opends.fileset">
+ <dependency groupId="org.jboss.unit" artifactId="opends"
+ version="1.1.0-SNAPSHOT" type="sar"/>
+ </artifact:dependencies>
+
+ <echo>Preparing OpenDS files</echo>
+
+ <!--Copy whole fileset with dependencies-->
+ <copy todir="target/jboss-unit/tmp">
+ <fileset refid="opends.fileset"/>
+ <mapper type="flatten" />
+ </copy>
+
+ <!--Filterout opends.sar-->
+ <echo>Copying OpenDS service archive to:
${jboss_home}/server/default/deploy</echo>
+ <copy todir="${jboss_home}/server/default/deploy/">
+ <fileset dir="target/jboss-unit/tmp">
+ <include name="opends-*.sar"/>
+ </fileset>
+ <mapper type="flatten" />
+ </copy>
+
+ <echo>Copying OpenDS configuration files to:
${jboss_home}/server/default/conf/</echo>
+ <copy todir="${jboss_home}/server/default/conf/opends">
+ <fileset dir="./src/test/resources/opends"/>
+ </copy>
+
+ <delete dir="target/jboss-unit/tmp" failonerror="false"
deleteonexit="true" quiet="true"/>
+
+ </target>
+
+ <target name="undeploy-opends">
+ <echo>Removing OpenDS configuration files from:
${jboss_home}/server/default/conf/opends</echo>
+ <delete dir="${jboss_home}/server/default/conf/opends"
failonerror="false" deleteonexit="true" quiet="true"/>
+
+ <echo>Removing OpenDS service archive from:
${jboss_home}/server/default/deploy/opends.sar</echo>
+ <delete file="${jboss_home}/server/default/deploy/opends-*.sar"
failonerror="false" deleteonexit="true" quiet="true"/>
+
+ </target>
+
+ <target name="cargo.setup">
+
+ <property name="cargo.log.dir"
value="target/cargo-logs"/>
+ <mkdir dir="${cargo.log.dir}"/>
+ <taskdef resource="cargo.tasks">
+ <classpath>
+ <pathelement path="${plugin_classpath}"/>
+ </classpath>
+ </taskdef>
+
+ </target>
+
+
+
+ <target name="cargo.jboss-4.2.start" depends="cargo.setup">
+
+ <!--output="${cargo.log.dir}/cargo.identity.server.log"-->
+ <!--log="${cargo.log.dir}/cargo.identity.shutdown.log"-->
+ <cargo
+ containerId="jboss42x"
+ home="${jboss_home}"
+ action="start"
+ wait="false">
+ <sharedClasspath>
+ <!-- Empty but need to be present because of a bug in our patch for
cargo-->
+ </sharedClasspath>
+ <configuration>
+ <property name="cargo.servlet.port" value="8080"/>
+ <property name="cargo.logging" value="high"/>
+ </configuration>
+ </cargo>
+ </target>
+
+ <target name="cargo.jboss-4.2.stop" depends="cargo.setup">
+
+ <!--log="${cargo.log.dir}/cargo.identity.startup.log"-->
+ <cargo
+ containerId="jboss42x"
+ home="${jboss_home}"
+
+ action="stop">
+ <configuration>
+ <property name="cargo.rmi.port" value="1099"/>
+ </configuration>
+ </cargo>
+ </target>
+
+
+ <target name="jboss-unit">
+ <taskdef name="jboss-unit"
classname="org.jboss.unit.tooling.ant.JBossUnitTask"
classpath="${test_classpath}"/>
+ <jboss-unit>
+ <tests config="src/test/resources/jboss-unit.xml"
suiteName="IdentityTests">
+ <!--<include keywords="DB,generic"/>-->
+ </tests>
+
+ <reports>
+ <xml toDir="target/jboss-unit/reports/xml"/>
+ <html toDir="target/jboss-unit/reports/html"/>
+ </reports>
+
+ <classpath>
+ <pathelement path="${test_classpath}"/>
+ </classpath>
+
+ </jboss-unit>
+
+ </target>
+
+
+</project>
\ No newline at end of file
Modified: modules/identity/trunk/identity/pom.xml
===================================================================
--- modules/identity/trunk/identity/pom.xml 2007-12-03 18:24:11 UTC (rev 9248)
+++ modules/identity/trunk/identity/pom.xml 2007-12-03 18:24:30 UTC (rev 9249)
@@ -32,124 +32,124 @@
<groupId>jboss.jbossas.core-libs</groupId>
<artifactId>jbosssx</artifactId>
</dependency>
+
<dependency>
<groupId>org.jboss.unit</groupId>
<artifactId>jboss-unit</artifactId>
- <!--<scope>test</scope>-->
+ <scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.unit</groupId>
+ <artifactId>opends</artifactId>
+ <type>sar</type>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.unit</groupId>
<artifactId>jboss-unit-mc</artifactId>
- <!--<scope>test</scope>-->
+ <scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.unit</groupId>
+ <artifactId>jboss-unit-tooling-ant</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.unit</groupId>
<artifactId>portal-test</artifactId>
- <!--<scope>test</scope>-->
+ <scope>test</scope>
</dependency>
- <!--<dependency>-->
- <!--<groupId>org.jboss.unit</groupId>-->
- <!--<artifactId>jboss-unit-tooling-maven2</artifactId>-->
- <!--<scope>test</scope>-->
- <!--</dependency>-->
<dependency>
<groupId>jboss</groupId>
<artifactId>jboss-logging-spi</artifactId>
- <!--<scope>test</scope>-->
+ <scope>test</scope>
</dependency>
<dependency>
<groupId>jboss</groupId>
<artifactId>jboss-logging-jdk</artifactId>
- <!--<scope>test</scope>-->
+ <scope>test</scope>
</dependency>
<dependency>
<groupId>jboss</groupId>
<artifactId>jboss-logging-log4j</artifactId>
- <!--<scope>test</scope>-->
+ <scope>test</scope>
</dependency>
<dependency>
<groupId>jboss.jbossas.core-libs</groupId>
<artifactId>jboss-transaction</artifactId>
- <!--<scope>test</scope>-->
+ <scope>test</scope>
</dependency>
<dependency>
<groupId>jboss.jbossas.core-libs</groupId>
<artifactId>jboss-local-jdbc</artifactId>
- <!--<scope>test</scope>-->
+ <scope>test</scope>
</dependency>
<dependency>
<groupId>jboss.jbossas.core-libs</groupId>
<artifactId>jboss-common-jdbc-wrapper</artifactId>
- <!--<scope>test</scope>-->
+ <scope>test</scope>
</dependency>
<dependency>
<groupId>jboss.jbossas.core-libs</groupId>
<artifactId>jboss</artifactId>
- <!--<scope>test</scope>-->
+ <scope>test</scope>
</dependency>
<dependency>
<groupId>jboss.jbossas.core-libs</groupId>
<artifactId>jnpserver</artifactId>
- <!--<scope>test</scope>-->
+ <scope>test</scope>
</dependency>
<dependency>
<groupId>jboss.jbossas.core-libs</groupId>
<artifactId>jboss-jca</artifactId>
- <!--<scope>test</scope>-->
+ <scope>test</scope>
</dependency>
<dependency>
<groupId>dom4j</groupId>
<artifactId>dom4j</artifactId>
- <!--<scope>test</scope>-->
+ <scope>test</scope>
</dependency>
<dependency>
<groupId>hsqldb</groupId>
<artifactId>hsqldb</artifactId>
- <!--<scope>test</scope>-->
+ <scope>test</scope>
</dependency>
<dependency>
<groupId>apache-log4j</groupId>
<artifactId>log4j</artifactId>
- <!--<scope>test</scope>-->
+ <scope>test</scope>
</dependency>
<dependency>
<groupId>javax.transaction</groupId>
<artifactId>jta</artifactId>
- <!--<scope>test</scope>-->
+ <scope>test</scope>
</dependency>
<dependency>
<groupId>apache-logging</groupId>
<artifactId>commons-logging</artifactId>
- <!--<scope>test</scope>-->
+ <scope>test</scope>
</dependency>
<dependency>
<groupId>apache-collections</groupId>
<artifactId>commons-collections</artifactId>
- <!--<scope>test</scope>-->
+ <scope>test</scope>
</dependency>
<dependency>
<groupId>cglib</groupId>
<artifactId>cglib</artifactId>
- <!--<scope>test</scope>-->
+ <scope>test</scope>
</dependency>
<dependency>
<groupId>antlr</groupId>
<artifactId>antlr</artifactId>
- <!--<scope>test</scope>-->
+ <scope>test</scope>
</dependency>
<dependency>
<groupId>asm</groupId>
<artifactId>asm</artifactId>
- <!--<scope>test</scope>-->
+ <scope>test</scope>
</dependency>
- <dependency>
- <groupId>org.jboss.unit</groupId>
- <artifactId>opends</artifactId>
- <version>1.1.0-SNAPSHOT</version>
- <type>sar</type>
- <!--<scope>test</scope>-->
- </dependency>
- </dependencies>
+ </dependencies>
<build>
<plugins>
@@ -167,8 +167,6 @@
<requireProperty>
<property>JBOSS_HOME</property>
<message>"You must specify JBoss Application Server
installation directory using -DJBOSS_HOME=... command line argument"</message>
- <!--<regex>"\d"</regex>-->
- <!--<regexMessage>"You must have a digit in your
baseDir!"</regexMessage>-->
</requireProperty>
</rules>
<fail>true</fail>
@@ -176,35 +174,42 @@
</execution>
</executions>
</plugin>
+
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
+ <dependencies>
+ <dependency>
+ <groupId>cargo</groupId>
+ <artifactId>cargo-ant</artifactId>
+ <version>0.9-portal</version>
+ </dependency>
+ <dependency>
+ <groupId>cargo</groupId>
+ <artifactId>cargo-core-uberjar</artifactId>
+ <version>0.9-portal</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
<executions>
<execution>
- <id>opends-confg-init</id>
- <phase>pre-integration-test</phase>
+ <id>test</id>
+ <phase>test</phase>
<configuration>
- <tasks >
- <echo>Copying OpenDS configuration files to:
${env.JBOSS_HOME}/server/default/conf/</echo>
- <copy
todir="${env.JBOSS_HOME}/server/default/conf/opends">
- <fileset dir="./src/test/resources/opends"/>
- </copy>
- </tasks>
- </configuration>
- <goals>
- <goal>run</goal>
- </goals>
- </execution>
- <execution>
- <id>opends-confg-remove</id>
- <phase>post-integration-test</phase>
- <configuration>
<tasks>
- <echo>Removing OpenDS configuration files from:
${env.JBOSS_HOME}/server/default/conf/opends</echo>
- <delete
dir="${env.JBOSS_HOME}/server/default/conf/opends" failonerror="false"
deleteonexit="true" quiet="true"/>
- <echo>Removing OpenDS service archive from:
${env.JBOSS_HOME}/server/default/deploy/opends.sar</echo>
- <delete
dir="${env.JBOSS_HOME}/server/default/deploy/opends.sar"
failonerror="false" deleteonexit="true" quiet="true"/>
+ <!--<echo>JBOSS_HOME=${JBOSS_HOME}</echo>-->
+ <!--<property name="compile_classpath"
refid="maven.compile.classpath"/>-->
+ <!--<property name="runtime_classpath"
refid="maven.runtime.classpath"/>-->
+ <!--<property name="test_classpath"
refid="maven.test.classpath"/>-->
+ <!--<property name="plugin_classpath"
refid="maven.plugin.classpath"/>-->
+
+ <property name="jboss_home"
value="${JBOSS_HOME}"/>
+
+ <ant antfile="${basedir}/build.xml">
+ <target name="test"/>
+ </ant>
+
</tasks>
</configuration>
<goals>
@@ -213,92 +218,6 @@
</execution>
</executions>
</plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-dependency-plugin</artifactId>
- <executions>
- <execution>
- <id>copy</id>
- <phase>pre-integration-test</phase>
- <goals>
- <goal>copy</goal>
- </goals>
- <configuration>
- <artifactItems>
- <artifactItem>
- <groupId>org.jboss.unit</groupId>
- <artifactId>opends</artifactId>
- <type>sar</type>
- <overWrite>true</overWrite>
-
<outputDirectory>${env.JBOSS_HOME}/server/default/deploy</outputDirectory>
- <destFileName>opends.sar</destFileName>
- </artifactItem>
- </artifactItems>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.codehaus.cargo</groupId>
- <artifactId>cargo-maven2-plugin</artifactId>
- <executions>
- <execution>
- <id>start-container</id>
- <phase>pre-integration-test</phase>
- <goals>
- <goal>start</goal>
- </goals>
- </execution>
- <execution>
- <id>stop-container</id>
- <phase>post-integration-test</phase>
- <goals>
- <goal>stop</goal>
- </goals>
- </execution>
- </executions>
- <configuration>
- <container>
- <containerId>jboss4x</containerId>
- <home>${env.JBOSS_HOME}</home>
- </container>
- <wait>false</wait>
- <configuration>
- <type>existing</type>
- <home>${env.JBOSS_HOME}/server/default</home>
- <properties>
- <cargo.logging >high</cargo.logging>
-
<cargo.jboss.configuration>default</cargo.jboss.configuration>
- <cargo.rmi.port>1099</cargo.rmi.port>
- </properties>
- </configuration>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.jboss.unit</groupId>
- <artifactId>jboss-unit-tooling-maven2</artifactId>
- <version>1.1.0-SNAPSHOT</version>
- <executions>
- <execution>
- <phase>integration-test</phase>
- <goals>
- <goal>execute</goal>
- </goals>
- </execution>
- </executions>
- <configuration>
- <testsuites>
- <testsuite>
- <config>jboss-unit.xml</config>
- <!--<JPDA>true</JPDA>-->
- </testsuite>
- </testsuites>
- <reports>
- <xml>${basedir}/target/surefire-reports/xml</xml>
- <html>${basedir}/target/surefire-reports/html</html>
- </reports>
- </configuration>
- </plugin>
</plugins>
</build>
<properties>
Modified:
modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity/IdentityConfiguration.java
===================================================================
---
modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity/IdentityConfiguration.java 2007-12-03
18:24:11 UTC (rev 9248)
+++
modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity/IdentityConfiguration.java 2007-12-03
18:24:30 UTC (rev 9249)
@@ -69,6 +69,8 @@
public static final String USER_SEARCH_FILTER = "userSearchFilter";
+ public static final String USER_ALLOW_EMPTY_PASSWORDS =
"allowEmptyPasswords";
+
//public static final String ROLE_CONTAINER_DN = "roleContainerDN";
public static final String ROLE_RID_ATTRIBUTE_ID = "ridAttributeID";
@@ -81,6 +83,8 @@
public static final String ROLE_CONTAINER_DN = ROLE_CONTEXT_DN;
+ public static final String ROLE_DEFAULT_ADMIN_ROLE = "defaultAdminRole";
+
public static final String MEMBERSHIP_ATTRIBUTE_ID =
"membershipAttributeID";
public static final String MEMBERSHIP_ATTRIBUTE_IS_DN =
"membershipAttributeIsDN";
Modified:
modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity/auth/SynchronizingLoginModule.java
===================================================================
---
modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity/auth/SynchronizingLoginModule.java 2007-12-03
18:24:11 UTC (rev 9248)
+++
modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity/auth/SynchronizingLoginModule.java 2007-12-03
18:24:30 UTC (rev 9249)
@@ -65,8 +65,11 @@
protected String userProfileModuleJNDIName;
protected String preserveRoles;
+ private transient SimpleGroup userRoles = new SimpleGroup("Roles");
+ private transient String password;
+
private UserModule userModule;
private RoleModule roleModule;
private MembershipModule membershipModule;
@@ -76,6 +79,7 @@
{
super.initialize(subject, callbackHandler, sharedState, options);
+ password = null;
userModuleJNDIName = (String)options.get("userModuleJNDIName");
roleModuleJNDIName = (String)options.get("roleModuleJNDIName");
@@ -159,24 +163,26 @@
}
/**
- * We must implement this - just return "" - it's ok as we override
validatePassword
+ * We must implement this
* @return
* @throws LoginException
*/
protected String getUsersPassword() throws LoginException
{
- return "";
+ return password;
}
/**
* This always returns true - so this module always pass.
- * @param string
+ * @param inputPassword
* @param string1
* @return
*/
- protected boolean validatePassword(String string, String string1)
+ protected boolean validatePassword(String inputPassword, String string1)
{
+ // Save the password for the synchro stuff
+ password = inputPassword;
return true;
}
@@ -188,12 +194,12 @@
protected Group[] getRoleSets() throws LoginException
{
- Group group = new SimpleGroup("Roles");
+ //Group group = new SimpleGroup("Roles");
if (additionalRole != null)
{
try
{
- group.addMember(createIdentity(additionalRole));
+ userRoles.addMember(createIdentity(additionalRole));
}
catch (Exception e)
{
@@ -201,7 +207,9 @@
log.error("Error when adding additional role: ", e);
}
}
- return new Group[]{group};
+
+ Group[] roleSets = {userRoles};
+ return roleSets;
}
@@ -237,8 +245,6 @@
{
try
{
-
-
User user = null;
//check if user exist
try
@@ -337,6 +343,7 @@
}
rolesToAssign.add(role);
+ userRoles.addMember(createIdentity(role.getName()));
}
}
}
@@ -346,6 +353,7 @@
try
{
rolesToAssign.add(getRoleModule().findRoleByName(defaultAssignedRole));
+ userRoles.addMember(createIdentity(defaultAssignedRole));
}
catch(Exception e)
{
@@ -363,6 +371,10 @@
if (presentRoles != null)
{
rolesToAssign.addAll(presentRoles);
+ for (Object presentRole : presentRoles)
+ {
+
userRoles.addMember(createIdentity(((Role)presentRole).getName()));
+ }
}
}
Modified:
modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity/ldap/LDAPUserModule.java
===================================================================
---
modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity/ldap/LDAPUserModule.java 2007-12-03
18:24:11 UTC (rev 9248)
+++
modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity/ldap/LDAPUserModule.java 2007-12-03
18:24:30 UTC (rev 9249)
@@ -117,6 +117,12 @@
public boolean validatePassword(LDAPUserImpl ldapu, String password) throws
IdentityException
{
+ // Depending on configuration reject authentication with empty password
+ if ((password == null || password.length() == 0) & !isAllowEmptyPasswords())
+ {
+ return false;
+ }
+
//will use user DN to bind checking the password by default
String principal = ldapu.getDn();
@@ -398,9 +404,20 @@
}
+ protected boolean isAllowEmptyPasswords()
+ {
+ String allowEmptyPasswords =
getIdentityConfiguration().getValue(IdentityConfiguration.USER_ALLOW_EMPTY_PASSWORDS);
+ if (allowEmptyPasswords != null &&
allowEmptyPasswords.equalsIgnoreCase("true"))
+ {
+ return Boolean.TRUE.booleanValue();
+ }
+ return Boolean.FALSE.booleanValue();
+ }
+
+
/*protected String getEmailAttributeId() throws IdentityException
{
String email =
getIdentityConfiguration().getValue(IdentityConfiguration.USER_EMAIL_ATTRIBUTE_ID);
Modified:
modules/identity/trunk/identity/src/test/resources/config/standardidentity-config.xml
===================================================================
---
modules/identity/trunk/identity/src/test/resources/config/standardidentity-config.xml 2007-12-03
18:24:11 UTC (rev 9248)
+++
modules/identity/trunk/identity/src/test/resources/config/standardidentity-config.xml 2007-12-03
18:24:30 UTC (rev 9249)
@@ -24,7 +24,7 @@
<!--<!DOCTYPE identity-configuration PUBLIC
- "-//JBoss Portal//DTD JBoss Identity Configuration 1.0//EN"
+ "-//JBoss Portal//DTD JBoss Identity Configuration 1.0//EN"
"http://www.jboss.org/portal/dtd/identity-config_1_0.dtd">-->
<identity-configuration>
@@ -183,7 +183,7 @@
<option>
<name>sessionFactoryJNDIName</name>
<value>java:/portal/IdentitySessionFactory</value>
- </option>
+ </option>
<option>
<name>JNDIName</name>
<value>java:/portal/DBUserProfileModule</value>
@@ -331,6 +331,10 @@
<name>membershipAttributeIsDN</name>
<value>true</value>
</option>
+ <option>
+ <name>defaultAdminRole</name>
+ <value>Admin</value>
+ </option>
</option-group>
<option-group>
<group-name>userCreateAttibutes</group-name>
Deleted: modules/identity/trunk/identity/src/test/resources/hibernate/domain.hbm.xml
===================================================================
--- modules/identity/trunk/identity/src/test/resources/hibernate/domain.hbm.xml 2007-12-03
18:24:11 UTC (rev 9248)
+++ modules/identity/trunk/identity/src/test/resources/hibernate/domain.hbm.xml 2007-12-03
18:24:30 UTC (rev 9249)
@@ -1,177 +0,0 @@
-<?xml version="1.0"?>
-<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- ~ 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 hibernate-mapping PUBLIC
- "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
- "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
-<hibernate-mapping>
- <class
- name="org.jboss.portal.identity.db.HibernateUserImpl"
- table="jbp_users">
- <!--<cache usage="@portal.hibernate.cache.usage(a)"/>-->
- <id
- name="key"
- column="jbp_uid"
- type="java.lang.Long">
- <generator class="native">
- <param name="sequence">user_seq</param>
- </generator>
- </id>
- <property
- name="userName"
- column="jbp_uname"
- type="java.lang.String"
- update="false"
- insert="true"
- unique="true"/>
- <map
- name="dynamic"
- table="jbp_user_prop"
- lazy="false"
- sort="unsorted"
- cascade="all">
- <!--<cache usage="@portal.hibernate.cache.usage(a)"/>-->
- <key column="jbp_uid"/>
- <index
- column="jbp_name"
- type="java.lang.String"/>
- <element
- column="jbp_value"
- type="java.lang.String"
- not-null="false"
- unique="false"/>
- </map>
- <property
- name="givenName"
- column="jbp_givenname"
- type="java.lang.String"
- update="true"
- insert="true"
- unique="false"/>
- <property
- name="familyName"
- column="jbp_familyname"
- type="java.lang.String"
- update="true"
- insert="true"
- unique="false"/>
- <property
- name="password"
- column="jbp_password"
- type="java.lang.String"
- update="true"
- insert="true"
- unique="false"/>
- <property
- name="realEmail"
- column="jbp_realemail"
- type="java.lang.String"
- update="true"
- insert="true"
- unique="false"/>
- <property
- name="fakeEmail"
- column="jbp_fakeemail"
- type="java.lang.String"
- update="true"
- insert="true"
- unique="false"/>
- <property
- name="registrationDate"
- column="jbp_regdate"
- type="java.util.Date"
- update="false"
- insert="true"
- unique="false"/>
- <property
- name="viewRealEmail"
- column="jbp_viewrealemail"
- type="boolean"
- update="true"
- insert="true"
- unique="false"/>
- <property
- name="enabled"
- column="jbp_enabled"
- type="boolean"
- update="true"
- insert="true"
- unique="false"/>
- <set
- name="roles"
- table="jbp_role_membership"
- lazy="false"
- inverse="false"
- cascade="none"
- sort="unsorted">
- <!--<cache usage="@portal.hibernate.cache.usage(a)"/>-->
- <key column="jbp_uid"/>
- <many-to-many
- class="org.jboss.portal.identity.db.HibernateRoleImpl"
- column="jbp_rid"
- outer-join="true"/>
- </set>
- </class>
- <class
- name="org.jboss.portal.identity.db.HibernateRoleImpl"
- table="jbp_roles">
- <!--<cache usage="@portal.hibernate.cache.usage(a)"/>-->
- <id
- name="key"
- column="jbp_rid"
- type="java.lang.Long">
- <generator class="native">
- <param name="sequence">user_seq</param>
- </generator>
- </id>
- <property
- name="name"
- column="jbp_name"
- type="java.lang.String"
- update="false"
- insert="true"
- unique="true"/>
- <property
- name="displayName"
- column="jbp_displayname"
- type="java.lang.String"
- update="true"
- insert="true"
- unique="true"/>
- <set
- name="users"
- table="jbp_role_membership"
- lazy="true"
- inverse="true"
- cascade="none"
- sort="unsorted">
- <!--<cache usage="@portal.hibernate.cache.usage(a)"/>-->
- <key column="jbp_rid"/>
- <many-to-many
- class="org.jboss.portal.identity.db.HibernateUserImpl"
- column="jbp_uid"
- outer-join="false"/>
- </set>
- </class>
-</hibernate-mapping>
\ No newline at end of file
Copied: modules/identity/trunk/identity/src/test/resources/hibernate/test-domain.hbm.xml
(from rev 9120,
modules/identity/trunk/identity/src/test/resources/hibernate/domain.hbm.xml)
===================================================================
--- modules/identity/trunk/identity/src/test/resources/hibernate/test-domain.hbm.xml
(rev 0)
+++
modules/identity/trunk/identity/src/test/resources/hibernate/test-domain.hbm.xml 2007-12-03
18:24:30 UTC (rev 9249)
@@ -0,0 +1,177 @@
+<?xml version="1.0"?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ 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 hibernate-mapping PUBLIC
+ "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+<hibernate-mapping>
+ <class
+ name="org.jboss.portal.identity.db.HibernateUserImpl"
+ table="jbp_users">
+ <!--<cache usage="@portal.hibernate.cache.usage(a)"/>-->
+ <id
+ name="key"
+ column="jbp_uid"
+ type="java.lang.Long">
+ <generator class="native">
+ <param name="sequence">user_seq</param>
+ </generator>
+ </id>
+ <property
+ name="userName"
+ column="jbp_uname"
+ type="java.lang.String"
+ update="false"
+ insert="true"
+ unique="true"/>
+ <map
+ name="dynamic"
+ table="jbp_user_prop"
+ lazy="false"
+ sort="unsorted"
+ cascade="all">
+ <!--<cache usage="@portal.hibernate.cache.usage(a)"/>-->
+ <key column="jbp_uid"/>
+ <index
+ column="jbp_name"
+ type="java.lang.String"/>
+ <element
+ column="jbp_value"
+ type="java.lang.String"
+ not-null="false"
+ unique="false"/>
+ </map>
+ <property
+ name="givenName"
+ column="jbp_givenname"
+ type="java.lang.String"
+ update="true"
+ insert="true"
+ unique="false"/>
+ <property
+ name="familyName"
+ column="jbp_familyname"
+ type="java.lang.String"
+ update="true"
+ insert="true"
+ unique="false"/>
+ <property
+ name="password"
+ column="jbp_password"
+ type="java.lang.String"
+ update="true"
+ insert="true"
+ unique="false"/>
+ <property
+ name="realEmail"
+ column="jbp_realemail"
+ type="java.lang.String"
+ update="true"
+ insert="true"
+ unique="false"/>
+ <property
+ name="fakeEmail"
+ column="jbp_fakeemail"
+ type="java.lang.String"
+ update="true"
+ insert="true"
+ unique="false"/>
+ <property
+ name="registrationDate"
+ column="jbp_regdate"
+ type="java.util.Date"
+ update="false"
+ insert="true"
+ unique="false"/>
+ <property
+ name="viewRealEmail"
+ column="jbp_viewrealemail"
+ type="boolean"
+ update="true"
+ insert="true"
+ unique="false"/>
+ <property
+ name="enabled"
+ column="jbp_enabled"
+ type="boolean"
+ update="true"
+ insert="true"
+ unique="false"/>
+ <set
+ name="roles"
+ table="jbp_role_membership"
+ lazy="false"
+ inverse="false"
+ cascade="none"
+ sort="unsorted">
+ <!--<cache usage="@portal.hibernate.cache.usage(a)"/>-->
+ <key column="jbp_uid"/>
+ <many-to-many
+ class="org.jboss.portal.identity.db.HibernateRoleImpl"
+ column="jbp_rid"
+ outer-join="true"/>
+ </set>
+ </class>
+ <class
+ name="org.jboss.portal.identity.db.HibernateRoleImpl"
+ table="jbp_roles">
+ <!--<cache usage="@portal.hibernate.cache.usage(a)"/>-->
+ <id
+ name="key"
+ column="jbp_rid"
+ type="java.lang.Long">
+ <generator class="native">
+ <param name="sequence">user_seq</param>
+ </generator>
+ </id>
+ <property
+ name="name"
+ column="jbp_name"
+ type="java.lang.String"
+ update="false"
+ insert="true"
+ unique="true"/>
+ <property
+ name="displayName"
+ column="jbp_displayname"
+ type="java.lang.String"
+ update="true"
+ insert="true"
+ unique="true"/>
+ <set
+ name="users"
+ table="jbp_role_membership"
+ lazy="true"
+ inverse="true"
+ cascade="none"
+ sort="unsorted">
+ <!--<cache usage="@portal.hibernate.cache.usage(a)"/>-->
+ <key column="jbp_rid"/>
+ <many-to-many
+ class="org.jboss.portal.identity.db.HibernateUserImpl"
+ column="jbp_uid"
+ outer-join="false"/>
+ </set>
+ </class>
+</hibernate-mapping>
\ No newline at end of file
Modified: modules/identity/trunk/identity/src/test/resources/jboss-unit.xml
===================================================================
--- modules/identity/trunk/identity/src/test/resources/jboss-unit.xml 2007-12-03 18:24:11
UTC (rev 9248)
+++ modules/identity/trunk/identity/src/test/resources/jboss-unit.xml 2007-12-03 18:24:30
UTC (rev 9249)
@@ -26,9 +26,9 @@
<parameter name="directoryName">
<value>OpenDS</value>
- <!--<value>Sun DS</value>-->
- <!--<value>RedHatDS</value>-->
- <!--<value>OpenLDAP</value>-->
+ <value>Sun DS</value>
+ <value>RedHatDS</value>
+ <value>OpenLDAP</value>
</parameter>
<test>
@@ -72,8 +72,8 @@
<parameter name="directories"
value="datasources/directories-staticrolemembership.xml"/>
<parameter name="directoryName">
<value>OpenDS</value>
- <!--<value>Sun DS</value>-->
- <!--<value>RedHatDS</value>-->
+ <value>Sun DS</value>
+ <value>RedHatDS</value>
</parameter>
</test>
Modified:
modules/identity/trunk/identity/src/test/resources/org/jboss/portal/test/identity/db-beans.xml
===================================================================
---
modules/identity/trunk/identity/src/test/resources/org/jboss/portal/test/identity/db-beans.xml 2007-12-03
18:24:11 UTC (rev 9248)
+++
modules/identity/trunk/identity/src/test/resources/org/jboss/portal/test/identity/db-beans.xml 2007-12-03
18:24:30 UTC (rev 9249)
@@ -64,7 +64,7 @@
<property
name="JNDIName">java:/portal/IdentitySessionFactory</property>
<property name="mappings">
<list elementClass="java.lang.String">
- <value>hibernate/domain.hbm.xml</value>
+ <value>hibernate/test-domain.hbm.xml</value>
</list>
</property>
</bean>
Modified:
modules/identity/trunk/identity/src/test/resources/org/jboss/portal/test/identity/ldap-beans.xml
===================================================================
---
modules/identity/trunk/identity/src/test/resources/org/jboss/portal/test/identity/ldap-beans.xml 2007-12-03
18:24:11 UTC (rev 9248)
+++
modules/identity/trunk/identity/src/test/resources/org/jboss/portal/test/identity/ldap-beans.xml 2007-12-03
18:24:30 UTC (rev 9249)
@@ -73,7 +73,7 @@
<property
name="JNDIName">java:/portal/IdentitySessionFactory</property>
<property name="mappings">
<list elementClass="java.lang.String">
- <value>hibernate/domain.hbm.xml</value>
+ <value>hibernate/test-domain.hbm.xml</value>
</list>
</property>
</bean>