JBoss Identity SVN: r461 - in idm/trunk: idm-api/src/main/java/org/jboss/identity/idm/api and 1 other directory.
by jboss-identity-commits@lists.jboss.org
Author: bdaw
Date: 2009-04-24 07:42:10 -0400 (Fri, 24 Apr 2009)
New Revision: 461
Modified:
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/PersistenceManager.java
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/RelationshipManager.java
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/session/managers/AbstractManager.java
Log:
fix bad method naming
Modified: idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/session/managers/AbstractManager.java
===================================================================
--- idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/session/managers/AbstractManager.java 2009-04-24 11:37:34 UTC (rev 460)
+++ idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/session/managers/AbstractManager.java 2009-04-24 11:42:10 UTC (rev 461)
@@ -64,7 +64,7 @@
return identitySession;
}
- public IdentitySearchCriteria createIdentitySearchConstraints()
+ public IdentitySearchCriteria createIdentitySearchCriteria()
{
return new IdentitySearchCriteriaImpl();
}
Modified: idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/PersistenceManager.java
===================================================================
--- idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/PersistenceManager.java 2009-04-24 11:37:34 UTC (rev 460)
+++ idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/PersistenceManager.java 2009-04-24 11:42:10 UTC (rev 461)
@@ -46,7 +46,7 @@
*/
PersistenceManagerFeaturesDescription getFeaturesDescription();
- IdentitySearchCriteria createIdentitySearchConstraints();
+ IdentitySearchCriteria createIdentitySearchCriteria();
// Create
Modified: idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/RelationshipManager.java
===================================================================
--- idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/RelationshipManager.java 2009-04-24 11:37:34 UTC (rev 460)
+++ idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/RelationshipManager.java 2009-04-24 11:42:10 UTC (rev 461)
@@ -49,7 +49,7 @@
*
* @return
*/
- IdentitySearchCriteria createIdentitySearchConstraints();
+ IdentitySearchCriteria createIdentitySearchCriteria();
// Assignation
15 years, 8 months
JBoss Identity SVN: r460 - in idm/trunk: assembly and 9 other directories.
by jboss-identity-commits@lists.jboss.org
Author: bdaw
Date: 2009-04-24 07:37:34 -0400 (Fri, 24 Apr 2009)
New Revision: 460
Modified:
idm/trunk/assembly/pom.xml
idm/trunk/distro/pom.xml
idm/trunk/example/maven2/pom.xml
idm/trunk/idm-api/pom.xml
idm/trunk/idm-common/pom.xml
idm/trunk/idm-spi/pom.xml
idm/trunk/idm/pom.xml
idm/trunk/integration/jboss5/pom.xml
idm/trunk/integration/pom.xml
idm/trunk/parent/pom.xml
idm/trunk/pom.xml
Log:
back to snapshot
Modified: idm/trunk/assembly/pom.xml
===================================================================
--- idm/trunk/assembly/pom.xml 2009-04-24 11:15:01 UTC (rev 459)
+++ idm/trunk/assembly/pom.xml 2009-04-24 11:37:34 UTC (rev 460)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.jboss.identity</groupId>
<artifactId>idm-parent</artifactId>
- <version>1.0.0.Alpha4</version>
+ <version>1.0.0-SNAPSHOT</version>
<relativePath>../parent</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: idm/trunk/distro/pom.xml
===================================================================
--- idm/trunk/distro/pom.xml 2009-04-24 11:15:01 UTC (rev 459)
+++ idm/trunk/distro/pom.xml 2009-04-24 11:37:34 UTC (rev 460)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.jboss.identity</groupId>
<artifactId>idm-parent</artifactId>
- <version>1.0.0.Alpha4</version>
+ <version>1.0.0-SNAPSHOT</version>
<relativePath>../parent</relativePath>
</parent>
Modified: idm/trunk/example/maven2/pom.xml
===================================================================
--- idm/trunk/example/maven2/pom.xml 2009-04-24 11:15:01 UTC (rev 459)
+++ idm/trunk/example/maven2/pom.xml 2009-04-24 11:37:34 UTC (rev 460)
@@ -1,7 +1,7 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.jboss.identity</groupId>
- <version>1.0.0.Alpha4</version>
+ <version>1.0.0-SNAPSHOT</version>
<artifactId>idm-maven2-example</artifactId>
<packaging>jar</packaging>
<name>JBoss Identity IDM Maven2 example project</name>
Modified: idm/trunk/idm/pom.xml
===================================================================
--- idm/trunk/idm/pom.xml 2009-04-24 11:15:01 UTC (rev 459)
+++ idm/trunk/idm/pom.xml 2009-04-24 11:37:34 UTC (rev 460)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.jboss.identity</groupId>
<artifactId>idm-parent</artifactId>
- <version>1.0.0.Alpha4</version>
+ <version>1.0.0-SNAPSHOT</version>
<relativePath>../parent</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: idm/trunk/idm-api/pom.xml
===================================================================
--- idm/trunk/idm-api/pom.xml 2009-04-24 11:15:01 UTC (rev 459)
+++ idm/trunk/idm-api/pom.xml 2009-04-24 11:37:34 UTC (rev 460)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.jboss.identity</groupId>
<artifactId>idm-parent</artifactId>
- <version>1.0.0.Alpha4</version>
+ <version>1.0.0-SNAPSHOT</version>
<relativePath>../parent</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: idm/trunk/idm-common/pom.xml
===================================================================
--- idm/trunk/idm-common/pom.xml 2009-04-24 11:15:01 UTC (rev 459)
+++ idm/trunk/idm-common/pom.xml 2009-04-24 11:37:34 UTC (rev 460)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.jboss.identity</groupId>
<artifactId>idm-parent</artifactId>
- <version>1.0.0.Alpha4</version>
+ <version>1.0.0-SNAPSHOT</version>
<relativePath>../parent</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: idm/trunk/idm-spi/pom.xml
===================================================================
--- idm/trunk/idm-spi/pom.xml 2009-04-24 11:15:01 UTC (rev 459)
+++ idm/trunk/idm-spi/pom.xml 2009-04-24 11:37:34 UTC (rev 460)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.jboss.identity</groupId>
<artifactId>idm-parent</artifactId>
- <version>1.0.0.Alpha4</version>
+ <version>1.0.0-SNAPSHOT</version>
<relativePath>../parent</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: idm/trunk/integration/jboss5/pom.xml
===================================================================
--- idm/trunk/integration/jboss5/pom.xml 2009-04-24 11:15:01 UTC (rev 459)
+++ idm/trunk/integration/jboss5/pom.xml 2009-04-24 11:37:34 UTC (rev 460)
@@ -8,12 +8,12 @@
<groupId>org.jboss.identity.integration</groupId>
<artifactId>idm-jboss5</artifactId>
<packaging>jar</packaging>
- <version>1.0.0.Alpha4</version>
+ <version>1.0.0-SNAPSHOT</version>
<parent>
<groupId>org.jboss.identity</groupId>
<artifactId>idm-integration</artifactId>
- <version>1.0.0.Alpha4</version>
+ <version>1.0.0-SNAPSHOT</version>
</parent>
<properties>
Modified: idm/trunk/integration/pom.xml
===================================================================
--- idm/trunk/integration/pom.xml 2009-04-24 11:15:01 UTC (rev 459)
+++ idm/trunk/integration/pom.xml 2009-04-24 11:37:34 UTC (rev 460)
@@ -13,7 +13,7 @@
<parent>
<groupId>org.jboss.identity</groupId>
<artifactId>idm-parent</artifactId>
- <version>1.0.0.Alpha4</version>
+ <version>1.0.0-SNAPSHOT</version>
<relativePath>../parent/pom.xml</relativePath>
</parent>
Modified: idm/trunk/parent/pom.xml
===================================================================
--- idm/trunk/parent/pom.xml 2009-04-24 11:15:01 UTC (rev 459)
+++ idm/trunk/parent/pom.xml 2009-04-24 11:37:34 UTC (rev 460)
@@ -8,7 +8,7 @@
<groupId>org.jboss.identity</groupId>
<artifactId>idm-parent</artifactId>
<packaging>pom</packaging>
- <version>1.0.0.Alpha4</version>
+ <version>1.0.0-SNAPSHOT</version>
<name>JBoss Identity IDM- Parent</name>
<url>http://labs.jboss.org/portal/jbosssecurity/</url>
<description>JBoss Identity is a cross-cutting project that handles identity needs for the JEMS projects</description>
Modified: idm/trunk/pom.xml
===================================================================
--- idm/trunk/pom.xml 2009-04-24 11:15:01 UTC (rev 459)
+++ idm/trunk/pom.xml 2009-04-24 11:37:34 UTC (rev 460)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.jboss.identity</groupId>
<artifactId>idm-parent</artifactId>
- <version>1.0.0.Alpha4</version>
+ <version>1.0.0-SNAPSHOT</version>
<relativePath>parent</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
15 years, 8 months
JBoss Identity SVN: r459 - idm/tags.
by jboss-identity-commits@lists.jboss.org
Author: bdaw
Date: 2009-04-24 07:15:01 -0400 (Fri, 24 Apr 2009)
New Revision: 459
Added:
idm/tags/1.0.0.Alpha4/
Log:
tag alpha4
Copied: idm/tags/1.0.0.Alpha4 (from rev 458, idm/trunk)
15 years, 8 months
JBoss Identity SVN: r458 - in idm/trunk: assembly and 9 other directories.
by jboss-identity-commits@lists.jboss.org
Author: bdaw
Date: 2009-04-24 07:11:55 -0400 (Fri, 24 Apr 2009)
New Revision: 458
Modified:
idm/trunk/assembly/pom.xml
idm/trunk/distro/pom.xml
idm/trunk/example/maven2/pom.xml
idm/trunk/idm-api/pom.xml
idm/trunk/idm-common/pom.xml
idm/trunk/idm-spi/pom.xml
idm/trunk/idm/pom.xml
idm/trunk/integration/jboss5/pom.xml
idm/trunk/integration/pom.xml
idm/trunk/parent/pom.xml
idm/trunk/pom.xml
Log:
tag 1.0.0.Alpha4
Modified: idm/trunk/assembly/pom.xml
===================================================================
--- idm/trunk/assembly/pom.xml 2009-04-24 09:07:15 UTC (rev 457)
+++ idm/trunk/assembly/pom.xml 2009-04-24 11:11:55 UTC (rev 458)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.jboss.identity</groupId>
<artifactId>idm-parent</artifactId>
- <version>1.0.0-SNAPSHOT</version>
+ <version>1.0.0.Alpha4</version>
<relativePath>../parent</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: idm/trunk/distro/pom.xml
===================================================================
--- idm/trunk/distro/pom.xml 2009-04-24 09:07:15 UTC (rev 457)
+++ idm/trunk/distro/pom.xml 2009-04-24 11:11:55 UTC (rev 458)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.jboss.identity</groupId>
<artifactId>idm-parent</artifactId>
- <version>1.0.0-SNAPSHOT</version>
+ <version>1.0.0.Alpha4</version>
<relativePath>../parent</relativePath>
</parent>
Modified: idm/trunk/example/maven2/pom.xml
===================================================================
--- idm/trunk/example/maven2/pom.xml 2009-04-24 09:07:15 UTC (rev 457)
+++ idm/trunk/example/maven2/pom.xml 2009-04-24 11:11:55 UTC (rev 458)
@@ -1,7 +1,7 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.jboss.identity</groupId>
- <version>1.0.0-SNAPSHOT</version>
+ <version>1.0.0.Alpha4</version>
<artifactId>idm-maven2-example</artifactId>
<packaging>jar</packaging>
<name>JBoss Identity IDM Maven2 example project</name>
Modified: idm/trunk/idm/pom.xml
===================================================================
--- idm/trunk/idm/pom.xml 2009-04-24 09:07:15 UTC (rev 457)
+++ idm/trunk/idm/pom.xml 2009-04-24 11:11:55 UTC (rev 458)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.jboss.identity</groupId>
<artifactId>idm-parent</artifactId>
- <version>1.0.0-SNAPSHOT</version>
+ <version>1.0.0.Alpha4</version>
<relativePath>../parent</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: idm/trunk/idm-api/pom.xml
===================================================================
--- idm/trunk/idm-api/pom.xml 2009-04-24 09:07:15 UTC (rev 457)
+++ idm/trunk/idm-api/pom.xml 2009-04-24 11:11:55 UTC (rev 458)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.jboss.identity</groupId>
<artifactId>idm-parent</artifactId>
- <version>1.0.0-SNAPSHOT</version>
+ <version>1.0.0.Alpha4</version>
<relativePath>../parent</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: idm/trunk/idm-common/pom.xml
===================================================================
--- idm/trunk/idm-common/pom.xml 2009-04-24 09:07:15 UTC (rev 457)
+++ idm/trunk/idm-common/pom.xml 2009-04-24 11:11:55 UTC (rev 458)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.jboss.identity</groupId>
<artifactId>idm-parent</artifactId>
- <version>1.0.0-SNAPSHOT</version>
+ <version>1.0.0.Alpha4</version>
<relativePath>../parent</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: idm/trunk/idm-spi/pom.xml
===================================================================
--- idm/trunk/idm-spi/pom.xml 2009-04-24 09:07:15 UTC (rev 457)
+++ idm/trunk/idm-spi/pom.xml 2009-04-24 11:11:55 UTC (rev 458)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.jboss.identity</groupId>
<artifactId>idm-parent</artifactId>
- <version>1.0.0-SNAPSHOT</version>
+ <version>1.0.0.Alpha4</version>
<relativePath>../parent</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: idm/trunk/integration/jboss5/pom.xml
===================================================================
--- idm/trunk/integration/jboss5/pom.xml 2009-04-24 09:07:15 UTC (rev 457)
+++ idm/trunk/integration/jboss5/pom.xml 2009-04-24 11:11:55 UTC (rev 458)
@@ -8,12 +8,12 @@
<groupId>org.jboss.identity.integration</groupId>
<artifactId>idm-jboss5</artifactId>
<packaging>jar</packaging>
- <version>1.0.0-SNAPSHOT</version>
+ <version>1.0.0.Alpha4</version>
<parent>
<groupId>org.jboss.identity</groupId>
<artifactId>idm-integration</artifactId>
- <version>1.0.0-SNAPSHOT</version>
+ <version>1.0.0.Alpha4</version>
</parent>
<properties>
Modified: idm/trunk/integration/pom.xml
===================================================================
--- idm/trunk/integration/pom.xml 2009-04-24 09:07:15 UTC (rev 457)
+++ idm/trunk/integration/pom.xml 2009-04-24 11:11:55 UTC (rev 458)
@@ -13,7 +13,7 @@
<parent>
<groupId>org.jboss.identity</groupId>
<artifactId>idm-parent</artifactId>
- <version>1.0.0-SNAPSHOT</version>
+ <version>1.0.0.Alpha4</version>
<relativePath>../parent/pom.xml</relativePath>
</parent>
Modified: idm/trunk/parent/pom.xml
===================================================================
--- idm/trunk/parent/pom.xml 2009-04-24 09:07:15 UTC (rev 457)
+++ idm/trunk/parent/pom.xml 2009-04-24 11:11:55 UTC (rev 458)
@@ -1,9 +1,14 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <groupId>org.jboss</groupId>
+ <artifactId>jboss-parent</artifactId>
+ <version>3</version>
+ </parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.jboss.identity</groupId>
<artifactId>idm-parent</artifactId>
<packaging>pom</packaging>
- <version>1.0.0-SNAPSHOT</version>
+ <version>1.0.0.Alpha4</version>
<name>JBoss Identity IDM- Parent</name>
<url>http://labs.jboss.org/portal/jbosssecurity/</url>
<description>JBoss Identity is a cross-cutting project that handles identity needs for the JEMS projects</description>
Modified: idm/trunk/pom.xml
===================================================================
--- idm/trunk/pom.xml 2009-04-24 09:07:15 UTC (rev 457)
+++ idm/trunk/pom.xml 2009-04-24 11:11:55 UTC (rev 458)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.jboss.identity</groupId>
<artifactId>idm-parent</artifactId>
- <version>1.0.0-SNAPSHOT</version>
+ <version>1.0.0.Alpha4</version>
<relativePath>parent</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
15 years, 8 months
JBoss Identity SVN: r457 - in idm/trunk: idm/src/main/java/org/jboss/identity/idm/impl/api/query and 4 other directories.
by jboss-identity-commits@lists.jboss.org
Author: bdaw
Date: 2009-04-24 05:07:15 -0400 (Fri, 24 Apr 2009)
New Revision: 457
Added:
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/query/
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/query/AbstractQuery.java
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/query/GroupQueryImpl.java
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/query/RoleQueryImpl.java
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/query/UserQueryImpl.java
Modified:
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/AttributesManager.java
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/IdentitySession.java
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/RelationshipManager.java
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/RoleManager.java
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/session/IdentitySessionImpl.java
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/session/managers/AbstractManager.java
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/session/managers/AttributesManagerImpl.java
idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/api/OrganizationTest.java
Log:
some code for the query api
Added: idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/query/AbstractQuery.java
===================================================================
--- idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/query/AbstractQuery.java (rev 0)
+++ idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/query/AbstractQuery.java 2009-04-24 09:07:15 UTC (rev 457)
@@ -0,0 +1,136 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+
+package org.jboss.identity.idm.impl.api.query;
+
+import org.jboss.identity.idm.api.IdentitySearchCriteria;
+import org.jboss.identity.idm.api.SortOrder;
+import org.jboss.identity.idm.api.UnsupportedCriterium;
+import org.jboss.identity.idm.api.IdentitySession;
+import org.jboss.identity.idm.api.Group;
+import org.jboss.identity.idm.api.IdentityType;
+import org.jboss.identity.idm.api.query.UserQuery;
+import org.jboss.identity.idm.api.query.UnsupportedQueryCriterium;
+import org.jboss.identity.idm.api.query.Query;
+import org.jboss.identity.idm.impl.api.IdentitySearchCriteriaImpl;
+import org.jboss.identity.idm.impl.api.model.SimpleGroup;
+import org.jboss.identity.idm.impl.api.model.GroupId;
+import org.jboss.identity.idm.impl.api.model.SimpleUser;
+import org.jboss.identity.idm.impl.api.session.IdentitySessionImpl;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class AbstractQuery implements Query
+{
+ //TODO: query should check criteria with features description
+
+ protected IdentitySessionImpl identitySession;
+
+ protected IdentitySearchCriteriaImpl searchCriteria = new IdentitySearchCriteriaImpl();
+
+ public AbstractQuery(IdentitySessionImpl identitySession)
+ {
+ this.identitySession = identitySession;
+ }
+
+ public Query sort(SortOrder order) throws UnsupportedQueryCriterium
+ {
+ try
+ {
+ searchCriteria.sort(order);
+ }
+ catch (UnsupportedCriterium unsupportedCriterium)
+ {
+ throw new UnsupportedQueryCriterium(unsupportedCriterium);
+ }
+ return this;
+ }
+
+ public Query sortAttributeName(String name) throws UnsupportedQueryCriterium
+ {
+ try
+ {
+ searchCriteria.sortAttributeName(name);
+ }
+ catch (UnsupportedCriterium unsupportedCriterium)
+ {
+ throw new UnsupportedQueryCriterium(unsupportedCriterium);
+ }
+ return this;
+ }
+
+ public Query page(int firstResult, int maxResults) throws UnsupportedQueryCriterium
+ {
+ try
+ {
+ searchCriteria.page(firstResult, maxResults);
+ }
+ catch (UnsupportedCriterium unsupportedCriterium)
+ {
+ throw new UnsupportedQueryCriterium(unsupportedCriterium);
+ }
+ return this;
+ }
+
+ public Query attributeValuesFilter(String attributeName, String[] attributeValue) throws UnsupportedQueryCriterium
+ {
+ try
+ {
+ searchCriteria.attributeValuesFilter(attributeName, attributeValue);
+ }
+ catch (UnsupportedCriterium unsupportedCriterium)
+ {
+ throw new UnsupportedQueryCriterium(unsupportedCriterium);
+ }
+ return this;
+ }
+
+
+ protected void checkNotNullArgument(Object arg, String name)
+ {
+ if (arg == null)
+ {
+ throw new IllegalArgumentException(name + " cannot be null");
+ }
+ }
+
+ protected Group createGroupFromId(String id)
+ {
+ return new SimpleGroup(new GroupId(id));
+ }
+
+ protected IdentityType createIdentityTypeFromId(String id)
+ {
+ if (GroupId.validateId(id))
+ {
+ GroupId groupId = new GroupId(id);
+
+ return new SimpleGroup(groupId);
+ }
+ else
+ {
+ return new SimpleUser(id);
+ }
+ }
+}
Added: idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/query/GroupQueryImpl.java
===================================================================
--- idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/query/GroupQueryImpl.java (rev 0)
+++ idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/query/GroupQueryImpl.java 2009-04-24 09:07:15 UTC (rev 457)
@@ -0,0 +1,286 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+
+package org.jboss.identity.idm.impl.api.query;
+
+import org.jboss.identity.idm.api.query.GroupQuery;
+import org.jboss.identity.idm.api.query.UnsupportedQueryCriterium;
+import org.jboss.identity.idm.api.query.QueryException;
+import org.jboss.identity.idm.api.SortOrder;
+import org.jboss.identity.idm.api.Group;
+import org.jboss.identity.idm.api.User;
+import org.jboss.identity.idm.impl.NotYetImplementedException;
+import org.jboss.identity.idm.impl.api.session.IdentitySessionImpl;
+import org.jboss.identity.idm.impl.api.model.GroupId;
+import org.jboss.identity.idm.impl.api.model.SimpleGroup;
+import org.jboss.identity.idm.impl.api.model.SimpleUser;
+
+import java.util.Collection;
+import java.util.List;
+import java.util.Set;
+import java.util.HashSet;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class GroupQueryImpl extends AbstractQuery implements GroupQuery
+{
+ private GroupId groupId;
+
+ private String groupName;
+
+ private String groupType;
+
+ private Set<Group> associatedParentGroups = new HashSet<Group>();
+
+ private Set<Group> associatedChildGroups = new HashSet<Group>();
+
+ private Set<User> usersAssociated = new HashSet<User>();
+
+ private Set<User> usersRelated = new HashSet<User>();
+
+ private Set<User> usersConnectedByRole = new HashSet<User>();
+
+ public GroupQueryImpl(IdentitySessionImpl identitySession)
+ {
+ super(identitySession);
+ }
+
+ public Collection<Group> execute() throws QueryException
+ {
+ prepare();
+ throw new NotYetImplementedException();
+ }
+
+ private void prepare()
+ {
+ if (groupId == null && (groupName != null && groupType != null))
+ {
+ groupId = new GroupId(groupName, groupType);
+ }
+ }
+
+ public Group uniqueResult() throws QueryException
+ {
+ throw new NotYetImplementedException();
+ }
+
+ public List<Group> list() throws QueryException
+ {
+ throw new NotYetImplementedException();
+ }
+
+ public GroupQuery setId(String id)
+ {
+ groupId = new GroupId(id);
+ return this;
+ }
+
+ public GroupQuery setNameAndType(String name, String type)
+ {
+ groupId = new GroupId(name, type);
+ groupName = name;
+ groupType = type;
+
+ return this;
+ }
+
+ public GroupQuery setName(String name)
+ {
+ checkNotNullArgument(name, "Group name");
+ groupName = name;
+ return this;
+ }
+
+ public GroupQuery setType(String type)
+ {
+ checkNotNullArgument(type, "Group type");
+ groupType = type;
+ return this;
+ }
+
+ public GroupQuery addAssociatedGroup(Group group, boolean parent)
+ {
+ checkNotNullArgument(group, "Group");
+ if (parent)
+ {
+ associatedParentGroups.add(group);
+ }
+ else
+ {
+ associatedChildGroups.add(group);
+ }
+ return this;
+ }
+
+ public GroupQuery addAssociatedGroup(String id, boolean parent)
+ {
+ checkNotNullArgument(id, "Group id");
+
+ Group group = new SimpleGroup(new GroupId(id));
+
+ if (parent)
+ {
+ associatedParentGroups.add(group);
+ }
+ else
+ {
+ associatedChildGroups.add(group);
+ }
+
+
+ return this;
+ }
+
+ public GroupQuery addAssociatedGroups(Collection<Group> groups, boolean parent)
+ {
+ checkNotNullArgument(groups, "Groups");
+
+ if (parent)
+ {
+ associatedParentGroups.addAll(groups);
+ }
+ else
+ {
+ associatedChildGroups.addAll(groups);
+ }
+
+ return this;
+ }
+
+ public GroupQuery addAssociatedGroupsIds(Collection<String> ids, boolean parent)
+ {
+ checkNotNullArgument(ids, "Groups ids");
+ for (String groupId : ids)
+ {
+ Group group = new SimpleGroup(new GroupId(groupId));
+
+ if (parent)
+ {
+ associatedParentGroups.add(group);
+ }
+ else
+ {
+ associatedChildGroups.add(group);
+ }
+ }
+
+ return this;
+ }
+
+ public GroupQuery addAssociatedUser(User user)
+ {
+ checkNotNullArgument(user, "User");
+ usersAssociated.add(user);
+ return this;
+ }
+
+ public GroupQuery addAssociatedUser(String id)
+ {
+ checkNotNullArgument(id, "User id");
+ usersAssociated.add(new SimpleUser(id));
+ return this;
+ }
+
+ public GroupQuery addAssociatedUsers(Collection<User> users)
+ {
+ checkNotNullArgument(users, "Users");
+ usersAssociated.addAll(users);
+ return this;
+ }
+
+ public GroupQuery addAssociatedUsersIds(Collection<String> ids)
+ {
+ checkNotNullArgument(ids, "Users ids");
+ for (String id : ids)
+ {
+ usersAssociated.add(new SimpleUser(id));
+ }
+ return this;
+ }
+
+ public GroupQuery addUserConnectedByRole(User user)
+ {
+ checkNotNullArgument(user, "User");
+ usersConnectedByRole.add(user);
+ return this;
+ }
+
+ public GroupQuery addUserConnectedByRole(String id)
+ {
+ checkNotNullArgument(id, "User id");
+ usersConnectedByRole.add(new SimpleUser(id));
+ return this;
+ }
+
+ public GroupQuery addUsersConnectedByRole(Collection<User> users)
+ {
+ checkNotNullArgument(users, "Users");
+ usersConnectedByRole.addAll(users);
+ return this;
+ }
+
+ public GroupQuery addUsersIdsConnectedByRole(Collection<String> ids)
+ {
+ checkNotNullArgument(ids, "Users ids");
+ for (String id : ids)
+ {
+ usersConnectedByRole.add(new SimpleUser(id));
+ }
+ return this;
+ }
+
+ public GroupQuery addRelatedUser(User user)
+ {
+ checkNotNullArgument(user, "User");
+ usersRelated.add(user);
+ return this;
+ }
+
+ public GroupQuery addRelatedUser(String id)
+ {
+ checkNotNullArgument(id, "User id");
+ usersRelated.add(new SimpleUser(id));
+ return this;
+ }
+
+ public GroupQuery sort(SortOrder order) throws UnsupportedQueryCriterium
+ {
+ return (GroupQuery)super.sort(order);
+ }
+
+ public GroupQuery sortAttributeName(String name) throws UnsupportedQueryCriterium
+ {
+ return (GroupQuery)super.sortAttributeName(name);
+ }
+
+ public GroupQuery page(int firstResult, int maxResults) throws UnsupportedQueryCriterium
+ {
+ return (GroupQuery)super.page(firstResult, maxResults);
+ }
+
+ public GroupQuery attributeValuesFilter(String attributeName, String[] attributeValue) throws UnsupportedQueryCriterium
+ {
+ return (GroupQuery)super.attributeValuesFilter(attributeName, attributeValue);
+ }
+}
Added: idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/query/RoleQueryImpl.java
===================================================================
--- idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/query/RoleQueryImpl.java (rev 0)
+++ idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/query/RoleQueryImpl.java 2009-04-24 09:07:15 UTC (rev 457)
@@ -0,0 +1,161 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+
+package org.jboss.identity.idm.impl.api.query;
+
+import org.jboss.identity.idm.api.query.RoleQuery;
+import org.jboss.identity.idm.api.query.GroupQuery;
+import org.jboss.identity.idm.api.query.UnsupportedQueryCriterium;
+import org.jboss.identity.idm.api.query.QueryException;
+import org.jboss.identity.idm.api.SortOrder;
+import org.jboss.identity.idm.api.Role;
+import org.jboss.identity.idm.api.User;
+import org.jboss.identity.idm.api.Group;
+import org.jboss.identity.idm.api.RoleType;
+import org.jboss.identity.idm.api.IdentityType;
+import org.jboss.identity.idm.impl.api.session.IdentitySessionImpl;
+import org.jboss.identity.idm.impl.api.model.SimpleUser;
+import org.jboss.identity.idm.impl.api.model.GroupId;
+import org.jboss.identity.idm.impl.api.model.SimpleGroup;
+import org.jboss.identity.idm.impl.api.model.SimpleRoleType;
+import org.jboss.identity.idm.impl.NotYetImplementedException;
+
+import java.util.Collection;
+import java.util.List;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class RoleQueryImpl extends AbstractQuery implements RoleQuery
+{
+
+ private User user;
+
+ private Group group;
+
+ private RoleType roleType;
+
+ public RoleQueryImpl(IdentitySessionImpl identitySession)
+ {
+ super(identitySession);
+ }
+
+ public Collection<Role> execute() throws QueryException
+ {
+ throw new NotYetImplementedException();
+
+ }
+
+ public Role uniqueResult() throws QueryException
+ {
+ throw new NotYetImplementedException();
+ }
+
+ public List<Role> list() throws QueryException
+ {
+ throw new NotYetImplementedException();
+ }
+
+ public RoleQuery setUser(User user)
+ {
+ checkNotNullArgument(user, "User");
+ this.user = user;
+ return this;
+ }
+
+ public RoleQuery setUser(String id)
+ {
+ checkNotNullArgument(id, "User id");
+ this.user = new SimpleUser(id);
+ return this;
+ }
+
+ public RoleQuery setGroup(Group group)
+ {
+ checkNotNullArgument(group, "Group");
+ this.group = group;
+ return this;
+ }
+
+ public RoleQuery setGroup(String id)
+ {
+ checkNotNullArgument(id, "Group id");
+ this.group = new SimpleGroup(new GroupId(id));
+ return this;
+ }
+
+ public RoleQuery setRoleType(RoleType roleType)
+ {
+ checkNotNullArgument(roleType, "RoleType");
+ this.roleType = roleType;
+ return this;
+ }
+
+ public RoleQuery setRoleType(String roleTypeName)
+ {
+ checkNotNullArgument(roleTypeName, "RoleType name");
+ this.roleType = new SimpleRoleType(roleTypeName);
+ return this;
+ }
+
+ public RoleQuery setIdentityType(IdentityType identityType)
+ {
+ checkNotNullArgument(identityType, "IdentityType");
+ if (identityType instanceof User)
+ {
+ this.user = (User)identityType;
+ }
+ else
+ {
+ this.group = (Group)identityType;
+ }
+ return this;
+ }
+
+ public RoleQuery setIdentityTypeId(String id)
+ {
+ checkNotNullArgument(id, "IdentityType id");
+ IdentityType identityType = createIdentityTypeFromId(id);
+ return setIdentityType(identityType);
+ }
+
+ public RoleQuery sort(SortOrder order) throws UnsupportedQueryCriterium
+ {
+ return (RoleQuery)super.sort(order);
+ }
+
+ public RoleQuery sortAttributeName(String name) throws UnsupportedQueryCriterium
+ {
+ return (RoleQuery)super.sortAttributeName(name);
+ }
+
+ public RoleQuery page(int firstResult, int maxResults) throws UnsupportedQueryCriterium
+ {
+ return (RoleQuery)super.page(firstResult, maxResults);
+ }
+
+ public RoleQuery attributeValuesFilter(String attributeName, String[] attributeValue) throws UnsupportedQueryCriterium
+ {
+ return (RoleQuery)super.attributeValuesFilter(attributeName, attributeValue);
+ }
+}
Added: idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/query/UserQueryImpl.java
===================================================================
--- idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/query/UserQueryImpl.java (rev 0)
+++ idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/query/UserQueryImpl.java 2009-04-24 09:07:15 UTC (rev 457)
@@ -0,0 +1,193 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+
+package org.jboss.identity.idm.impl.api.query;
+
+import org.jboss.identity.idm.api.query.UserQuery;
+import org.jboss.identity.idm.api.query.QueryException;
+import org.jboss.identity.idm.api.query.UnsupportedQueryCriterium;
+import org.jboss.identity.idm.api.User;
+import org.jboss.identity.idm.api.Group;
+import org.jboss.identity.idm.api.SortOrder;
+import org.jboss.identity.idm.impl.api.session.IdentitySessionImpl;
+import org.jboss.identity.idm.impl.NotYetImplementedException;
+
+import java.util.Collection;
+import java.util.List;
+import java.util.Set;
+import java.util.HashSet;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class UserQueryImpl extends AbstractQuery implements UserQuery
+{
+
+ private String userId;
+
+ private Set<Group> groupsAssociatedWith = new HashSet<Group>();
+
+ private Set<Group> groupsConnectedWithRole = new HashSet<Group>();
+
+ private Set<Group> groupsRelated = new HashSet<Group>();
+
+ public UserQueryImpl(IdentitySessionImpl identitySession)
+ {
+ super(identitySession);
+ }
+
+ public Collection<User> execute() throws QueryException
+ {
+ throw new NotYetImplementedException();
+ }
+
+ public User uniqueResult() throws QueryException
+ {
+ throw new NotYetImplementedException();
+ }
+
+ public List<User> list() throws QueryException
+ {
+ throw new NotYetImplementedException();
+ }
+
+ public UserQuery withUserId(String id)
+ {
+ checkNotNullArgument(id, "User id");
+ userId = id;
+ return this;
+ }
+
+ public UserQuery addAssociatedGroup(Group group)
+ {
+ checkNotNullArgument(group, "Group");
+ groupsAssociatedWith.add(group);
+ return this;
+ }
+
+ public UserQuery addAssociatedGroup(String id)
+ {
+ checkNotNullArgument(id, "Group id");
+ groupsAssociatedWith.add(createGroupFromId(id));
+ return this;
+ }
+
+ public UserQuery addAssociatedGroups(Collection<Group> groups)
+ {
+ checkNotNullArgument(groups, "Groups");
+ groupsAssociatedWith.addAll(groups);
+ return this;
+ }
+
+ public UserQuery addAssociatedGroupsIds(Collection<String> groups)
+ {
+ checkNotNullArgument(groups, "Groups");
+ for (String groupId : groups)
+ {
+ groupsAssociatedWith.add(createGroupFromId(groupId));
+ }
+ return this;
+ }
+
+ public UserQuery addGroupConnectedWithRole(Group group)
+ {
+ checkNotNullArgument(group, "Group");
+ groupsConnectedWithRole.add(group);
+ return this;
+ }
+
+ public UserQuery addGroupConnectedWithRole(String id)
+ {
+ checkNotNullArgument(id, "Group id");
+ groupsConnectedWithRole.add(createGroupFromId(id));
+ return this;
+ }
+
+ public UserQuery addGroupsConnectedWithRole(Collection<Group> groups)
+ {
+ checkNotNullArgument(groups, "Groups");
+ groupsConnectedWithRole.addAll(groups);
+ return this;
+ }
+
+ public UserQuery addGroupsIdsConnectedWithRole(Collection<String> groups)
+ {
+ checkNotNullArgument(groups, "Groups");
+ for (String groupId : groups)
+ {
+ groupsConnectedWithRole.add(createGroupFromId(groupId));
+ }
+ return this;
+ }
+
+ public UserQuery addRelatedGroup(Group group)
+ {
+ checkNotNullArgument(group, "Group");
+ groupsRelated.add(group);
+ return this;
+ }
+
+ public UserQuery addRelatedGroup(String id)
+ {
+ checkNotNullArgument(id, "Group id");
+ groupsRelated.add(createGroupFromId(id));
+ return this;
+ }
+
+ public UserQuery addRelatedGroups(Collection<Group> group)
+ {
+ checkNotNullArgument(group, "Group");
+ groupsRelated.addAll(group);
+ return this;
+ }
+
+ public UserQuery addRelatedGroupsIds(Collection<String> ids)
+ {
+ checkNotNullArgument(ids, "Groups ids");
+ for (String id : ids)
+ {
+ groupsRelated.add(createGroupFromId(id));
+ }
+ return this;
+ }
+
+ public UserQuery sort(SortOrder order) throws UnsupportedQueryCriterium
+ {
+ return (UserQuery)super.sort(order);
+ }
+
+ public UserQuery sortAttributeName(String name) throws UnsupportedQueryCriterium
+ {
+ return (UserQuery)super.sortAttributeName(name);
+ }
+
+ public UserQuery page(int firstResult, int maxResults) throws UnsupportedQueryCriterium
+ {
+ return (UserQuery)super.page(firstResult, maxResults);
+ }
+
+ public UserQuery attributeValuesFilter(String attributeName, String[] attributeValue) throws UnsupportedQueryCriterium
+ {
+ return (UserQuery)super.attributeValuesFilter(attributeName, attributeValue);
+ }
+}
Modified: idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/session/IdentitySessionImpl.java
===================================================================
--- idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/session/IdentitySessionImpl.java 2009-04-23 15:09:40 UTC (rev 456)
+++ idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/session/IdentitySessionImpl.java 2009-04-24 09:07:15 UTC (rev 457)
@@ -30,6 +30,9 @@
import org.jboss.identity.idm.api.RelationshipManager;
import org.jboss.identity.idm.api.AttributesManager;
import org.jboss.identity.idm.api.RoleManager;
+import org.jboss.identity.idm.api.query.UserQuery;
+import org.jboss.identity.idm.api.query.GroupQuery;
+import org.jboss.identity.idm.api.query.RoleQuery;
import org.jboss.identity.idm.exception.IdentityException;
import org.jboss.identity.idm.exception.FeatureNotSupportedException;
import org.jboss.identity.idm.spi.store.IdentityStoreSession;
@@ -45,6 +48,10 @@
import org.jboss.identity.idm.impl.api.session.managers.AttributesManagerImpl;
import org.jboss.identity.idm.impl.api.session.managers.RoleManagerImpl;
import org.jboss.identity.idm.impl.api.session.SimpleTransactionImpl;
+import org.jboss.identity.idm.impl.api.query.UserQueryImpl;
+import org.jboss.identity.idm.impl.api.query.GroupQueryImpl;
+import org.jboss.identity.idm.impl.api.query.RoleQueryImpl;
+import org.jboss.identity.idm.impl.NotYetImplementedException;
/**
* @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
@@ -164,4 +171,26 @@
return roleManager;
}
+
+ public UserQuery createUserQuery()
+ {
+ return new UserQueryImpl(this);
+
+ }
+
+ public GroupQuery createGroupQuery()
+ {
+ return new GroupQueryImpl(this);
+
+ }
+
+ public RoleQuery createRoleQuery() throws FeatureNotSupportedException
+ {
+ if (!getSessionContext().getIdentityStoreRepository().getSupportedFeatures().isNamedRelationshipsSupported())
+ {
+ throw new FeatureNotSupportedException("Role management not supported by underlaying configured identity stores");
+ }
+
+ return new RoleQueryImpl(this);
+ }
}
Modified: idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/session/managers/AbstractManager.java
===================================================================
--- idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/session/managers/AbstractManager.java 2009-04-23 15:09:40 UTC (rev 456)
+++ idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/session/managers/AbstractManager.java 2009-04-24 09:07:15 UTC (rev 457)
@@ -177,8 +177,8 @@
}
}
-
+
protected Group createGroupFromId(String id)
{
return new SimpleGroup(new GroupId(id));
Modified: idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/session/managers/AttributesManagerImpl.java
===================================================================
--- idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/session/managers/AttributesManagerImpl.java 2009-04-23 15:09:40 UTC (rev 456)
+++ idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/session/managers/AttributesManagerImpl.java 2009-04-24 09:07:15 UTC (rev 457)
@@ -316,12 +316,11 @@
getRepository().updateCredential(getInvocationContext(), createIdentityObject(identity), new PasswordCredential(password));
}
- public boolean hasCredential(User identity, CredentialType credentialType) throws IdentityException
+ public boolean isCredentialTypeSupported(CredentialType credentialType) throws IdentityException
{
- checkNotNullArgument(identity, "User");
checkNotNullArgument(credentialType, "CredentialType");
- return getRepository().getSupportedFeatures().isCredentialSupported(createIdentityObject(identity).getIdentityType(), new SimpleCredentialType(credentialType.getName()));
+ return getRepository().getSupportedFeatures().isCredentialSupported(getUserObjectType(), new SimpleCredentialType(credentialType.getName()));
}
public boolean validateCredentials(User identity, Credential[] credentials) throws IdentityException
Modified: idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/api/OrganizationTest.java
===================================================================
--- idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/api/OrganizationTest.java 2009-04-23 15:09:40 UTC (rev 456)
+++ idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/api/OrganizationTest.java 2009-04-24 09:07:15 UTC (rev 457)
@@ -29,7 +29,6 @@
import org.jboss.identity.idm.api.IdentitySessionFactory;
import org.jboss.identity.idm.api.Attribute;
import org.jboss.identity.idm.api.AttributeDescription;
-import org.jboss.identity.idm.api.CredentialType;
import org.jboss.identity.idm.api.Credential;
import org.jboss.identity.idm.p3p.P3PConstants;
@@ -305,7 +304,7 @@
// Credential
User anotherOne = bdawidowUser; //session.getPersistenceManager().createUser("blah1");
- assertTrue(session.getAttributesManager().hasCredential(anotherOne, PasswordCredential.TYPE));
+ assertTrue(session.getAttributesManager().isCredentialTypeSupported(PasswordCredential.TYPE));
// #1
session.getAttributesManager().updatePassword(anotherOne, "secret");
@@ -334,7 +333,7 @@
// #3
- if (session.getAttributesManager().hasCredential(anotherOne, BinaryCredential.TYPE))
+ if (session.getAttributesManager().isCredentialTypeSupported(BinaryCredential.TYPE))
{
// 500 kilobytes
byte[] cert = new byte[512000];
Modified: idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/AttributesManager.java
===================================================================
--- idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/AttributesManager.java 2009-04-23 15:09:40 UTC (rev 456)
+++ idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/AttributesManager.java 2009-04-24 09:07:15 UTC (rev 457)
@@ -267,12 +267,11 @@
void updatePassword(User identity, String password) throws IdentityException;
/**
- * Check if identity can be protected with a given credential type
+ * Check if user can be protected with a given credential type
*
- * @param identity
* @param credentialType
*/
- boolean hasCredential(User identity, CredentialType credentialType) throws IdentityException;
+ boolean isCredentialTypeSupported(CredentialType credentialType) throws IdentityException;
/**
* Validate credential for a given identity
Modified: idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/IdentitySession.java
===================================================================
--- idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/IdentitySession.java 2009-04-23 15:09:40 UTC (rev 456)
+++ idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/IdentitySession.java 2009-04-24 09:07:15 UTC (rev 457)
@@ -24,6 +24,9 @@
import org.jboss.identity.idm.exception.IdentityException;
import org.jboss.identity.idm.exception.FeatureNotSupportedException;
+import org.jboss.identity.idm.api.query.RoleQuery;
+import org.jboss.identity.idm.api.query.GroupQuery;
+import org.jboss.identity.idm.api.query.UserQuery;
/**
* Expose all identity management operations within a given realm
@@ -104,4 +107,23 @@
*/
RoleManager getRoleManager() throws FeatureNotSupportedException ;
+ /**
+ *
+ * @return
+ */
+ UserQuery createUserQuery();
+
+ /**
+ *
+ * @return
+ */
+ GroupQuery createGroupQuery();
+
+ /**
+ *
+ * @return
+ */
+ RoleQuery createRoleQuery() throws FeatureNotSupportedException;
+
+
}
\ No newline at end of file
Modified: idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/RelationshipManager.java
===================================================================
--- idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/RelationshipManager.java 2009-04-23 15:09:40 UTC (rev 456)
+++ idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/RelationshipManager.java 2009-04-24 09:07:15 UTC (rev 457)
@@ -45,6 +45,10 @@
*/
RelationshipManagerFeaturesDescription getFeaturesDescription();
+ /**
+ *
+ * @return
+ */
IdentitySearchCriteria createIdentitySearchConstraints();
// Assignation
Modified: idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/RoleManager.java
===================================================================
--- idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/RoleManager.java 2009-04-23 15:09:40 UTC (rev 456)
+++ idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/RoleManager.java 2009-04-24 09:07:15 UTC (rev 457)
@@ -23,6 +23,7 @@
package org.jboss.identity.idm.api;
import org.jboss.identity.idm.exception.IdentityException;
+import org.jboss.identity.idm.api.query.RoleQuery;
import java.util.Collection;
import java.util.Map;
@@ -47,6 +48,10 @@
*/
RoleManagerFeaturesDescription getSupportedFeatures();
+ /**
+ *
+ * @return
+ */
IdentitySearchCriteria createIdentitySearchConstraints();
// RoleType
15 years, 8 months
JBoss Identity SVN: r456 - in idm/trunk: distro/src/main/resources/config-tool/jboss and 4 other directories.
by jboss-identity-commits@lists.jboss.org
Author: jeff.yuchang
Date: 2009-04-23 11:09:40 -0400 (Thu, 23 Apr 2009)
New Revision: 456
Added:
idm/trunk/distro/src/main/resources/config-tool/jboss/idm-service/
idm/trunk/distro/src/main/resources/config-tool/jboss/idm-service/idm-service-hsql-jboss-beans.xml
idm/trunk/distro/src/main/resources/config-tool/jboss/idm-service/idm-service-mysql-jboss-beans.xml
idm/trunk/distro/src/main/resources/config-tool/jboss/idm-service/idm-service-oracle-jboss-beans.xml
Modified:
idm/trunk/distro/scripts/antrun-installer.xml
idm/trunk/distro/src/main/resources/installer/install-definition.xml
idm/trunk/integration/jboss5/src/main/java/org/jboss/identity/idm/integration/jboss5/IDMService.java
idm/trunk/integration/jboss5/src/main/java/org/jboss/identity/idm/integration/jboss5/IDMServiceMBean.java
idm/trunk/integration/jboss5/src/main/resources/META-INF/idm-service-jboss-beans.xml
Log:
Add the schema export into db in IDMService.
(finish the integration)
Modified: idm/trunk/distro/scripts/antrun-installer.xml
===================================================================
--- idm/trunk/distro/scripts/antrun-installer.xml 2009-04-23 10:55:39 UTC (rev 455)
+++ idm/trunk/distro/scripts/antrun-installer.xml 2009-04-23 15:09:40 UTC (rev 456)
@@ -111,6 +111,12 @@
<copy todir="${deploy.artifacts.dir}/resources/datasources">
<fileset dir="${output.dir}/config.tool.tmp/resolved/jboss/datasource"/>
</copy>
+
+ <!-- copy the idm-service configuration file-->
+ <mkdir dir="${deploy.artifacts.dir}/resources/idm-service-configuration" />
+ <copy todir="${deploy.artifacts.dir}/resources/idm-service-configuration">
+ <fileset dir="${output.dir}/config.tool.tmp/resolved/jboss/idm-service"/>
+ </copy>
<condition property="database.is.hsqldb" value="true" else="false">
<equals arg1="${database}" arg2="hsqldb"/>
Added: idm/trunk/distro/src/main/resources/config-tool/jboss/idm-service/idm-service-hsql-jboss-beans.xml
===================================================================
--- idm/trunk/distro/src/main/resources/config-tool/jboss/idm-service/idm-service-hsql-jboss-beans.xml (rev 0)
+++ idm/trunk/distro/src/main/resources/config-tool/jboss/idm-service/idm-service-hsql-jboss-beans.xml 2009-04-23 15:09:40 UTC (rev 456)
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+
+ <!--
+ IDM Service
+ -->
+ <bean name="jboss.identity.IDMService"
+ class="org.jboss.identity.idm.integration.jboss5.IDMService">
+ <constructor>
+ <parameter>jboss-idm.xml</parameter>
+ </constructor>
+ <property name="idmSessionFactoryJNDI">java:/IdentitySessionFactory</property>
+ <property name="SQLScript">idm-sql/jboss.idm.hsqldb.create.sql</property>
+ <property name="datasource">java:jbossidmDS</property>
+ <property name="exitSQL">select * from jbid_io</property>
+ <depends>jboss.jca:service=DataSourceBinding,name=jbossidmDS</depends>
+ </bean>
+
+</deployment>
\ No newline at end of file
Added: idm/trunk/distro/src/main/resources/config-tool/jboss/idm-service/idm-service-mysql-jboss-beans.xml
===================================================================
--- idm/trunk/distro/src/main/resources/config-tool/jboss/idm-service/idm-service-mysql-jboss-beans.xml (rev 0)
+++ idm/trunk/distro/src/main/resources/config-tool/jboss/idm-service/idm-service-mysql-jboss-beans.xml 2009-04-23 15:09:40 UTC (rev 456)
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+
+ <!--
+ IDM Service
+ -->
+ <bean name="jboss.identity.IDMService"
+ class="org.jboss.identity.idm.integration.jboss5.IDMService">
+ <constructor>
+ <parameter>jboss-idm.xml</parameter>
+ </constructor>
+ <property name="idmSessionFactoryJNDI">java:/IdentitySessionFactory</property>
+ <property name="SQLScript">idm-sql/jboss.idm.mysql.create.sql</property>
+ <property name="datasource">java:jbossidmDS</property>
+ <property name="exitSQL">select * from jbid_io</property>
+ <depends>jboss.jca:service=DataSourceBinding,name=jbossidmDS</depends>
+ </bean>
+
+</deployment>
\ No newline at end of file
Added: idm/trunk/distro/src/main/resources/config-tool/jboss/idm-service/idm-service-oracle-jboss-beans.xml
===================================================================
--- idm/trunk/distro/src/main/resources/config-tool/jboss/idm-service/idm-service-oracle-jboss-beans.xml (rev 0)
+++ idm/trunk/distro/src/main/resources/config-tool/jboss/idm-service/idm-service-oracle-jboss-beans.xml 2009-04-23 15:09:40 UTC (rev 456)
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+
+ <!--
+ IDM Service
+ -->
+ <bean name="jboss.identity.IDMService"
+ class="org.jboss.identity.idm.integration.jboss5.IDMService">
+ <constructor>
+ <parameter>jboss-idm.xml</parameter>
+ </constructor>
+ <property name="idmSessionFactoryJNDI">java:/IdentitySessionFactory</property>
+ <property name="SQLScript">idm-sql/jboss.idm.oracle.create.sql</property>
+ <property name="datasource">java:jbossidmDS</property>
+ <property name="exitSQL">select * from jbid_io</property>
+ <depends>jboss.jca:service=DataSourceBinding,name=jbossidmDS</depends>
+ </bean>
+
+</deployment>
\ No newline at end of file
Modified: idm/trunk/distro/src/main/resources/installer/install-definition.xml
===================================================================
--- idm/trunk/distro/src/main/resources/installer/install-definition.xml 2009-04-23 10:55:39 UTC (rev 455)
+++ idm/trunk/distro/src/main/resources/installer/install-definition.xml 2009-04-23 15:09:40 UTC (rev 456)
@@ -96,14 +96,14 @@
-->
<pack name="jbossIdm Installation Files" required="yes" preselected="yes">
- <description>Installation directory containing libs, dbscripts, modules and sources</description>
+ <description>Installation directory containing libs, db.scripts, modules, resources and source</description>
<!-- jbossidm/doc-->
<file src="@{deploy.artifacts.dir}/jboss.eula.txt" targetdir="$INSTALL_PATH" override="true" />
<file src="@{deploy.artifacts.dir}/license.txt" targetdir="$INSTALL_PATH" override="true" />
<!-- jbossidm-->
- <fileset dir="@{deploy.artifacts.dir}/db.scripts" targetdir="$INSTALL_PATH/db" />
+ <fileset dir="@{deploy.artifacts.dir}/db.scripts" targetdir="$INSTALL_PATH/db.scripts" />
<fileset dir="@{deploy.artifacts.dir}/resources" targetdir="$INSTALL_PATH/resources" />
<fileset dir="@{deploy.artifacts.dir}/modules" targetdir="$INSTALL_PATH/modules" />
<fileset dir="@{deploy.artifacts.dir}/src" targetdir="$INSTALL_PATH/src" />
@@ -140,7 +140,10 @@
Database configurations
==============================
-->
-
+ <!-- copy the sql scripts -->
+ <fileset dir="@{deploy.artifacts.dir}/db.scripts"
+ targetdir="${jbossInstallPath}/server/${jbossTargetServer}/deploy/idm/idm-service.sar/idm-sql" />
+
<!-- Database Hypersonic -->
<file src="@{deploy.artifacts.dir}/resources/datasources/jbidm-hsqldb-ds.xml"
targetdir="${jbossInstallPath}/server/${jbossTargetServer}/deploy/idm"
@@ -153,7 +156,12 @@
condition="isHypersonic">
<include name="jbossidm.*" />
</fileset>
-
+ <singlefile src="@{deploy.artifacts.dir}/resources/idm-service-configuration/idm-service-hsql-jboss-beans.xml"
+ target="${jbossInstallPath}/server/${jbossTargetServer}/deploy/idm/idm-service.sar/META-INF/idm-service-jboss-beans.xml"
+ override="true"
+ condition="isHypersonic"
+ />
+
<!-- Database MySQL -->
<file src="@{deploy.artifacts.dir}/resources/datasources/jbidm-mysql-ds.xml"
targetdir="${jbossInstallPath}/server/${jbossTargetServer}/deploy/idm"
@@ -167,7 +175,13 @@
condition="isMySQL">
<include name="mysql-connector-java.jar" />
</fileset>
+ <singlefile src="@{deploy.artifacts.dir}/resources/idm-service-configuration/idm-service-mysql-jboss-beans.xml"
+ target="${jbossInstallPath}/server/${jbossTargetServer}/deploy/idm/idm-service.sar/META-INF/idm-service-jboss-beans.xml"
+ override="true"
+ condition="isMySQL"
+ />
+
<!-- Database Oracle -->
<file src="@{deploy.artifacts.dir}/resources/datasources/jbidm-oracle-ds.xml"
targetdir="${jbossInstallPath}/server/${jbossTargetServer}/deploy/idm"
@@ -175,6 +189,11 @@
<fileset dir="@{deploy.artifacts.dir}/resources/jbidm-oracle-config"
targetdir="${jbossInstallPath}/server/${jbossTargetServer}/deploy/idm/idm-service.sar"
condition="isOracle" />
+ <singlefile src="@{deploy.artifacts.dir}/resources/idm-service-configuration/idm-service-oracle-jboss-beans.xml"
+ target="${jbossInstallPath}/server/${jbossTargetServer}/deploy/idm/idm-service.sar/META-INF/idm-service-jboss-beans.xml"
+ override="true"
+ condition="isOracle"
+ />
<!-- NOTE: oracle driver needs to be provided manually -->
</pack>
Modified: idm/trunk/integration/jboss5/src/main/java/org/jboss/identity/idm/integration/jboss5/IDMService.java
===================================================================
--- idm/trunk/integration/jboss5/src/main/java/org/jboss/identity/idm/integration/jboss5/IDMService.java 2009-04-23 10:55:39 UTC (rev 455)
+++ idm/trunk/integration/jboss5/src/main/java/org/jboss/identity/idm/integration/jboss5/IDMService.java 2009-04-23 15:09:40 UTC (rev 456)
@@ -3,9 +3,18 @@
*/
package org.jboss.identity.idm.integration.jboss5;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.sql.Connection;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
import java.util.logging.Logger;
import javax.naming.InitialContext;
+import javax.sql.DataSource;
import org.jboss.aop.microcontainer.aspects.jmx.JMX;
import org.jboss.identity.idm.api.IdentitySessionFactory;
@@ -33,9 +42,13 @@
private IdentitySessionFactory sessionFactory;
+ private String exitSQL;
+
+ private String datasource;
+
public IDMService(String idmConfigFile) {
this.idmConfigFile = idmConfigFile;
-
+ this.idmSessionFactoryJNDI = DEFAULT_JNDI;
}
public String getIdmConfigFile() {
@@ -61,14 +74,13 @@
public void start() throws Exception {
logger.info("Starting the JBoss Identity Management Service");
- startIdentitySessionFactory();
- logger.info("Started the JBoss Identity Management Service");
- }
-
- private void startIdentitySessionFactory() throws Exception {
+ if (needToInitializeDB()) {
+ initializeDB();
+ }
sessionFactory = new IdentityConfigurationImpl().configure(getIdmConfigFile()).buildIdentitySessionFactory();
InitialContext context = new InitialContext();
context.bind(getIdmSessionFactoryJNDI(), sessionFactory);
+ logger.info("Started the JBoss Identity Management Service");
}
public void stop() throws Exception {
@@ -82,4 +94,111 @@
logger.info("Stopped the JBoss Identity Management Service");
}
+ public String getExitSQL() {
+ return exitSQL;
+ }
+
+ public void setExitSQL(String exitSQL) {
+ this.exitSQL = exitSQL;
+ }
+
+ public String getDatasource() {
+ return datasource;
+ }
+
+ public void setDatasource(String datasource) {
+ this.datasource = datasource;
+ }
+
+
+ private boolean needToInitializeDB() {
+ if (this.getDatasource() != null &&
+ this.getSQLScript() != null &&
+ this.getExitSQL() != null) {
+ return true;
+ }
+ return false;
+ }
+
+
+ private void initializeDB() throws Exception {
+ DataSource ds = (DataSource)new InitialContext().lookup(datasource);
+ Connection conn = ds.getConnection();
+ boolean load = false;
+
+ Statement st = conn.createStatement();
+ ResultSet rs = null;
+ try
+ {
+ rs = st.executeQuery(exitSQL.trim());
+ rs.close();
+ }
+ catch (SQLException e)
+ {
+ load = true;
+ }
+ st.close();
+ if (!load)
+ {
+ logger.info(datasource + " datasource is already initialized");
+ return;
+ }
+
+ logger.info("Initializing " + datasource + " from listed sql files");
+
+ String[] list = SQLScript.split(",");
+ for (String sql : list)
+ {
+ executeSql(sql.trim(), conn);
+ }
+
+ }
+
+ private void executeSql(String resource, Connection conn) throws Exception
+ {
+ URL url = Thread.currentThread().getContextClassLoader().getResource(resource);
+ String sql = new String(readStream(url.openStream()) , "UTF-8");
+ sql = sql.replaceAll("(?m)^--([^\n]+)?$", ""); // Remove all commented lines
+ final String[] statements ;
+ statements = sql.split(";");
+
+ for (String statement : statements)
+ {
+ if ((statement == null) || ("".equals(statement.trim()))) {
+ } else {
+ Statement sqlStatement = conn.createStatement();
+ try
+ {
+ sqlStatement.executeUpdate(statement);
+ }
+ finally
+ {
+ sqlStatement.close();
+ }
+ }
+ }
+ }
+
+
+ private byte[] readStream(InputStream stream) {
+ if(stream == null) {
+ throw new IllegalArgumentException("null 'stream' arg passed in method call.");
+ }
+
+ ByteArrayOutputStream outBuffer = new ByteArrayOutputStream();
+ byte[] buffer = new byte[256];
+ int readCount = 0;
+
+ try {
+ while((readCount = stream.read(buffer)) != -1) {
+ outBuffer.write(buffer, 0, readCount);
+ }
+ } catch (IOException e) {
+ throw new IllegalStateException("Error reading stream.", e);
+ }
+
+ return outBuffer.toByteArray();
+ }
+
+
}
Modified: idm/trunk/integration/jboss5/src/main/java/org/jboss/identity/idm/integration/jboss5/IDMServiceMBean.java
===================================================================
--- idm/trunk/integration/jboss5/src/main/java/org/jboss/identity/idm/integration/jboss5/IDMServiceMBean.java 2009-04-23 10:55:39 UTC (rev 455)
+++ idm/trunk/integration/jboss5/src/main/java/org/jboss/identity/idm/integration/jboss5/IDMServiceMBean.java 2009-04-23 15:09:40 UTC (rev 456)
@@ -3,11 +3,8 @@
*/
package org.jboss.identity.idm.integration.jboss5;
-import javax.management.ObjectName;
-import org.jboss.mx.util.ObjectNameFactory;
-
/**
*
* Interface for exposing JMX operations.
@@ -17,12 +14,14 @@
*/
public interface IDMServiceMBean {
- ObjectName OBJECT_NAME = ObjectNameFactory.create("jboss.identity:service=IDMService");
-
String getIdmConfigFile() ;
String getIdmSessionFactoryJNDI();
+ String getDatasource();
+
String getSQLScript();
+
+ String getExitSQL();
}
Modified: idm/trunk/integration/jboss5/src/main/resources/META-INF/idm-service-jboss-beans.xml
===================================================================
--- idm/trunk/integration/jboss5/src/main/resources/META-INF/idm-service-jboss-beans.xml 2009-04-23 10:55:39 UTC (rev 455)
+++ idm/trunk/integration/jboss5/src/main/resources/META-INF/idm-service-jboss-beans.xml 2009-04-23 15:09:40 UTC (rev 456)
@@ -5,13 +5,15 @@
<!--
IDM Service
-->
- <bean name="jboss.identity:service=IDMService"
+ <bean name="jboss.identity.IDMService"
class="org.jboss.identity.idm.integration.jboss5.IDMService">
<constructor>
<parameter>jboss-idm.xml</parameter>
</constructor>
<property name="idmSessionFactoryJNDI">java:/IdentitySessionFactory</property>
- <property name="SQLScript">hsql/idm.create.hsqldb.sql</property>
+ <property name="SQLScript">idm-sql/jboss.idm.hsql.create.sql</property>
+ <property name="datasource">java:jbossidmDS</property>
+ <property name="exitSQL">select * from jbid_io</property>
<depends>jboss.jca:service=DataSourceBinding,name=jbossidmDS</depends>
</bean>
15 years, 8 months
JBoss Identity SVN: r455 - in idm/trunk: idm/src/main/java/org/jboss/identity/idm/impl/cache and 10 other directories.
by jboss-identity-commits@lists.jboss.org
Author: bdaw
Date: 2009-04-23 06:55:39 -0400 (Thu, 23 Apr 2009)
New Revision: 455
Added:
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/types/SimpleIdentityObjectRelationship.java
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/types/SimpleIdentityObjectRelationshipType.java
Modified:
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/RoleManager.java
idm/trunk/idm-spi/src/main/java/org/jboss/identity/idm/spi/exception/OperationNotSupportedException.java
idm/trunk/idm-spi/src/main/java/org/jboss/identity/idm/spi/store/FeaturesMetaData.java
idm/trunk/idm-spi/src/main/java/org/jboss/identity/idm/spi/store/IdentityStore.java
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/session/managers/AbstractManager.java
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/session/managers/RoleManagerImpl.java
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/cache/JBossCacheIdentityStoreWrapper.java
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/model/hibernate/HibernateIdentityObjectRelationship.java
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/model/hibernate/HibernateIdentityObjectRelationshipName.java
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/repository/FallbackIdentityStoreRepository.java
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/repository/WrapperIdentityStoreRepository.java
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/store/FeaturesMetaDataImpl.java
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/store/hibernate/HibernateIdentityStoreImpl.java
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/store/ldap/LDAPIdentityStoreImpl.java
idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/api/RoleManagerTest.java
Log:
role and roleType properties and few other improvements
Modified: idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/session/managers/AbstractManager.java
===================================================================
--- idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/session/managers/AbstractManager.java 2009-04-23 03:48:49 UTC (rev 454)
+++ idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/session/managers/AbstractManager.java 2009-04-23 10:55:39 UTC (rev 455)
@@ -28,13 +28,16 @@
import org.jboss.identity.idm.api.IdentityType;
import org.jboss.identity.idm.api.Attribute;
import org.jboss.identity.idm.api.IdentitySearchCriteria;
+import org.jboss.identity.idm.api.Role;
import org.jboss.identity.idm.spi.repository.IdentityStoreRepository;
import org.jboss.identity.idm.spi.store.IdentityStoreInvocationContext;
import org.jboss.identity.idm.spi.model.IdentityObject;
import org.jboss.identity.idm.spi.model.IdentityObjectType;
import org.jboss.identity.idm.spi.model.IdentityObjectAttribute;
+import org.jboss.identity.idm.spi.model.IdentityObjectRelationship;
import org.jboss.identity.idm.spi.search.IdentityObjectSearchCriteria;
import org.jboss.identity.idm.impl.types.SimpleIdentityObject;
+import org.jboss.identity.idm.impl.types.SimpleIdentityObjectRelationship;
import org.jboss.identity.idm.impl.api.session.context.IdentitySessionContext;
import org.jboss.identity.idm.impl.api.session.IdentitySessionImpl;
import org.jboss.identity.idm.impl.api.model.SimpleUser;
@@ -174,6 +177,8 @@
}
}
+
+
protected Group createGroupFromId(String id)
{
return new SimpleGroup(new GroupId(id));
Modified: idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/session/managers/RoleManagerImpl.java
===================================================================
--- idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/session/managers/RoleManagerImpl.java 2009-04-23 03:48:49 UTC (rev 454)
+++ idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/session/managers/RoleManagerImpl.java 2009-04-23 10:55:39 UTC (rev 455)
@@ -41,12 +41,17 @@
import org.jboss.identity.idm.spi.store.IdentityObjectSearchCriteriaType;
import org.jboss.identity.idm.impl.api.model.SimpleRoleType;
import org.jboss.identity.idm.impl.api.model.SimpleRole;
+import org.jboss.identity.idm.impl.api.model.SimpleUser;
+import org.jboss.identity.idm.impl.api.model.SimpleGroup;
+import org.jboss.identity.idm.impl.types.SimpleIdentityObjectRelationship;
import java.util.Collection;
import java.util.Set;
import java.util.HashSet;
import java.util.List;
import java.util.LinkedList;
+import java.util.Map;
+import java.util.HashMap;
/**
* @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
@@ -92,6 +97,16 @@
};
}
+ protected IdentityObjectRelationship createIdentityObjectRelationship(Role role)
+ {
+ return new SimpleIdentityObjectRelationship(
+ createIdentityObject(role.getGroup()),
+ createIdentityObject(role.getIdentity()),
+ role.getRoleType().getName(),
+ ROLE
+ );
+ }
+
public RoleManagerFeaturesDescription getSupportedFeatures()
{
return featuresDescription;
@@ -268,6 +283,48 @@
return hasRole(user, group, new SimpleRoleType(roleTypeName));
}
+ public Role getRole(RoleType roleType, User user, Group group) throws IdentityException
+ {
+ checkNotNullArgument(roleType, "RoleType");
+ checkNotNullArgument(user, "User");
+ checkNotNullArgument(group, "Group");
+
+ //TODO: does separate hasRelationship method in IdentityStore makes sense?
+
+ Set<IdentityObjectRelationship> rels = getRepository().resolveRelationships(getInvocationContext(), createIdentityObject(group), createIdentityObject(user), ROLE);
+
+ if (rels.size() == 0)
+ {
+ throw new IdentityException("No such role present");
+ }
+
+ if (rels.size() > 1)
+ {
+ throw new IdentityException("More than one role definition present - illegal state!");
+ }
+
+ IdentityObjectRelationship relationship = rels.iterator().next();
+
+ return new SimpleRole(new SimpleRoleType(relationship.getType().getName()),
+ createUser(relationship.getFromIdentityObject()),
+ createGroup(relationship.getToIdentityObject()));
+ }
+
+ public Role getRole(String roleTypeName, String userId, String groupId) throws IdentityException
+ {
+ checkNotNullArgument(roleTypeName, "RoleType name");
+ checkNotNullArgument(userId, "User id");
+ checkNotNullArgument(groupId, "Group Id");
+
+ // TODO: Check if relationship is present in the store
+
+ User user = createUserFromId(userId);
+ Group group = createGroupFromId(groupId);
+ RoleType roleType = new SimpleRoleType(roleTypeName);
+
+ return getRole(roleType, user, group);
+ }
+
public Collection<RoleType> findRoleTypes(User identity, Group group) throws IdentityException
{
@@ -484,11 +541,122 @@
}
- public <T extends IdentityType> Collection<Role> findRoles(String id, String roleTypeName) throws IdentityException
+ public Collection<Role> findRoles(String id, String roleTypeName) throws IdentityException
{
checkNotNullArgument(id, "Group id or User name");
checkNotNullArgument(roleTypeName, "RoleType name");
return findRoles(createIdentityTypeFromId(id), new SimpleRoleType(roleTypeName));
}
+
+ public Map<String, String> getProperties(RoleType roleType) throws IdentityException
+ {
+ checkNotNullArgument(roleType, "RoleType name");
+
+ return getRepository().getRelationshipNameProperties(getInvocationContext(), roleType.getName());
+ }
+
+ public Map<String, String> getProperties(String roleTypeName) throws IdentityException
+ {
+ checkNotNullArgument(roleTypeName, "RoleType name");
+
+ return getProperties(new SimpleRoleType(roleTypeName));
+ }
+
+ public Map<String, String> getProperties(Role role) throws IdentityException
+ {
+ checkNotNullArgument(role, "Role");
+
+ return getRepository().getRelationshipProperties(getInvocationContext(), createIdentityObjectRelationship(role));
+ }
+
+ public void setProperty(Role role, String name, String value) throws IdentityException
+ {
+ checkNotNullArgument(role, "Role");
+ checkNotNullArgument(name, "Property name");
+ checkNotNullArgument(value, "Property value");
+
+ Map<String, String> props = new HashMap<String, String>();
+ props.put(name, value);
+
+
+ getRepository().setRelationshipProperties(getInvocationContext(), createIdentityObjectRelationship(role), props);
+ }
+
+ public void setProperty(RoleType roleType, String name, String value) throws IdentityException
+ {
+ checkNotNullArgument(roleType, "RoleType");
+ checkNotNullArgument(name, "Property name");
+ checkNotNullArgument(value, "Property value");
+
+ Map<String, String> props = new HashMap<String, String>();
+ props.put(name, value);
+
+
+ getRepository().setRelationshipNameProperties(getInvocationContext(), roleType.getName(), props);
+ }
+
+ public void setProperty(String roleTypeName, String name, String value) throws IdentityException
+ {
+ checkNotNullArgument(roleTypeName, "RoleType name");
+ checkNotNullArgument(name, "Property name");
+ checkNotNullArgument(value, "Property value");
+
+ setProperty(new SimpleRoleType(roleTypeName), name, value);
+ }
+
+ public void setProperties(Role role, Map<String, String> properties) throws IdentityException
+ {
+ checkNotNullArgument(role, "Role");
+ checkNotNullArgument(properties, "Properties");
+
+
+ getRepository().setRelationshipProperties(getInvocationContext(), createIdentityObjectRelationship(role), properties);
+ }
+
+ public void setProperties(RoleType roleType, Map<String, String> properties) throws IdentityException
+ {
+ checkNotNullArgument(roleType, "RoleType");
+ checkNotNullArgument(properties, "Properties");
+
+
+ getRepository().setRelationshipNameProperties(getInvocationContext(), roleType.getName(), properties);
+ }
+
+ public void setProperties(String roleTypeName, Map<String, String> properties) throws IdentityException
+ {
+ checkNotNullArgument(roleTypeName, "RoleType name");
+
+ setProperties(new SimpleRoleType(roleTypeName), properties);
+ }
+
+ public void removeProperty(Role role, String name) throws IdentityException
+ {
+ checkNotNullArgument(role, "Role");
+ checkNotNullArgument(name, "Property name");
+
+ Set<String> names = new HashSet<String>();
+ names.add(name);
+
+ getRepository().removeRelationshipProperties(getInvocationContext(), createIdentityObjectRelationship(role), names);
+ }
+
+ public void removeProperty(RoleType roleType, String name) throws IdentityException
+ {
+ checkNotNullArgument(roleType, "RoleType");
+ checkNotNullArgument(name, "Property name");
+
+ Set<String> names = new HashSet<String>();
+ names.add(name);
+
+
+ getRepository().removeRelationshipNameProperties(getInvocationContext(), roleType.getName(), names);
+ }
+
+ public void removeProperty(String roleTypeName, String name) throws IdentityException
+ {
+ checkNotNullArgument(roleTypeName, "RoleType name");
+
+ removeProperty(new SimpleRoleType(roleTypeName), name);
+ }
}
Modified: idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/cache/JBossCacheIdentityStoreWrapper.java
===================================================================
--- idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/cache/JBossCacheIdentityStoreWrapper.java 2009-04-23 03:48:49 UTC (rev 454)
+++ idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/cache/JBossCacheIdentityStoreWrapper.java 2009-04-23 10:55:39 UTC (rev 455)
@@ -376,8 +376,45 @@
return results;
}
-
+ public Map<String, String> getRelationshipNameProperties(IdentityStoreInvocationContext ctx, String name) throws IdentityException, OperationNotSupportedException
+ {
+ //TODO: apply caching
+ return identityStore.getRelationshipNameProperties(ctx, name);
+ }
+
+ public void setRelationshipNameProperties(IdentityStoreInvocationContext ctx, String name, Map<String, String> properties) throws IdentityException, OperationNotSupportedException
+ {
+ //TODO: apply caching
+ identityStore.setRelationshipNameProperties(ctx, name, properties);
+ }
+
+ public void removeRelationshipNameProperties(IdentityStoreInvocationContext ctx, String name, Set<String> properties) throws IdentityException, OperationNotSupportedException
+ {
+ //TODO: apply caching
+ identityStore.removeRelationshipNameProperties(ctx, name, properties);
+
+ }
+
+ public Map<String, String> getRelationshipProperties(IdentityStoreInvocationContext ctx, IdentityObjectRelationship relationship) throws IdentityException, OperationNotSupportedException
+ {
+ //TODO: apply caching
+ return identityStore.getRelationshipProperties(ctx, relationship);
+ }
+
+ public void setRelationshipProperties(IdentityStoreInvocationContext ctx, IdentityObjectRelationship relationship, Map<String, String> properties) throws IdentityException, OperationNotSupportedException
+ {
+ //TODO: apply caching
+ identityStore.setRelationshipProperties(ctx, relationship, properties);
+
+ }
+
+ public void removeRelationshipProperties(IdentityStoreInvocationContext ctx, IdentityObjectRelationship relationship, Set<String> properties) throws IdentityException, OperationNotSupportedException
+ {
+ //TODO: apply caching
+ identityStore.removeRelationshipProperties(ctx, relationship, properties);
+ }
+
public boolean validateCredential(IdentityStoreInvocationContext ctx,
IdentityObject identityObject,
IdentityObjectCredential credential) throws IdentityException
Modified: idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/model/hibernate/HibernateIdentityObjectRelationship.java
===================================================================
--- idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/model/hibernate/HibernateIdentityObjectRelationship.java 2009-04-23 03:48:49 UTC (rev 454)
+++ idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/model/hibernate/HibernateIdentityObjectRelationship.java 2009-04-23 10:55:39 UTC (rev 455)
@@ -32,12 +32,18 @@
import javax.persistence.JoinColumn;
import javax.persistence.UniqueConstraint;
import javax.persistence.FetchType;
+import javax.persistence.JoinTable;
+import javax.persistence.Column;
import org.jboss.identity.idm.spi.model.IdentityObjectRelationship;
import org.jboss.identity.idm.spi.model.IdentityObjectRelationshipType;
import org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObject;
import org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectRelationshipType;
+import org.hibernate.annotations.CollectionOfElements;
+import java.util.Map;
+import java.util.HashMap;
+
/**
* @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
* @version : 0.1 $
@@ -73,6 +79,11 @@
@JoinColumn(nullable = false, name="TO_IDENTITY")
private HibernateIdentityObject toIdentityObject;
+ @CollectionOfElements
+ @JoinTable(name = "jbid_io_rel_props", joinColumns = @JoinColumn(name = "REALATIONSHIP_ID"))
+ @Column(name = "PROPERTY")
+ private Map<String, String> properties = new HashMap<String, String>();
+
public HibernateIdentityObjectRelationship()
{
}
@@ -149,4 +160,14 @@
{
this.name = name;
}
+
+ public Map<String, String> getProperties()
+ {
+ return properties;
+ }
+
+ public void setProperties(Map<String, String> properties)
+ {
+ this.properties = properties;
+ }
}
Modified: idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/model/hibernate/HibernateIdentityObjectRelationshipName.java
===================================================================
--- idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/model/hibernate/HibernateIdentityObjectRelationshipName.java 2009-04-23 03:48:49 UTC (rev 454)
+++ idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/model/hibernate/HibernateIdentityObjectRelationshipName.java 2009-04-23 10:55:39 UTC (rev 455)
@@ -22,6 +22,8 @@
package org.jboss.identity.idm.impl.model.hibernate;
+import org.hibernate.annotations.CollectionOfElements;
+
import javax.persistence.Table;
import javax.persistence.Entity;
import javax.persistence.Column;
@@ -32,6 +34,9 @@
import javax.persistence.ManyToOne;
import javax.persistence.JoinColumn;
import javax.persistence.UniqueConstraint;
+import javax.persistence.JoinTable;
+import java.util.Map;
+import java.util.HashMap;
/**
* @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
@@ -83,6 +88,11 @@
@JoinColumn(nullable = false, name="REALM")
private HibernateRealm realm;
+ @CollectionOfElements
+ @JoinTable(name = "jbid_io_rel_name_props", joinColumns = @JoinColumn(name = "REALATIONSHIP_NAME_ID"))
+ @Column(name = "PROPERTY")
+ private Map<String, String> properties = new HashMap<String, String>();
+
public HibernateIdentityObjectRelationshipName()
{
}
@@ -122,4 +132,14 @@
{
this.realm = realm;
}
+
+ public Map<String, String> getProperties()
+ {
+ return properties;
+ }
+
+ public void setProperties(Map<String, String> properties)
+ {
+ this.properties = properties;
+ }
}
Modified: idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/repository/FallbackIdentityStoreRepository.java
===================================================================
--- idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/repository/FallbackIdentityStoreRepository.java 2009-04-23 03:48:49 UTC (rev 454)
+++ idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/repository/FallbackIdentityStoreRepository.java 2009-04-23 10:55:39 UTC (rev 455)
@@ -147,6 +147,19 @@
return defaultIdentityStore.getSupportedFeatures().isNamedRelationshipsSupported();
}
+ public boolean isRelationshipPropertiesSupported()
+ {
+ // If there is any IdentityStore that supports relationship properties...
+ for (IdentityStore identityStore : getIdentityStoreMappings().values())
+ {
+ if (identityStore.getSupportedFeatures().isRelationshipPropertiesSupported())
+ {
+ return true;
+ }
+ }
+ return defaultIdentityStore.getSupportedFeatures().isRelationshipPropertiesSupported();
+ }
+
public boolean isSearchCriteriaTypeSupported(IdentityObjectType identityObjectType, IdentityObjectSearchCriteriaType storeSearchConstraint)
{
return resolveIdentityStore(identityObjectType).getSupportedFeatures().isSearchCriteriaTypeSupported(identityObjectType, storeSearchConstraint);
@@ -683,6 +696,101 @@
return defaultIdentityStore.getRelationshipNames(defaultCtx, identity, controls);
}
+ public Map<String, String> getRelationshipNameProperties(IdentityStoreInvocationContext ctx, String name) throws IdentityException, OperationNotSupportedException
+ {
+ Map<String, String> results = new HashMap<String, String>();
+
+ // For any IdentityStore that supports named relationships...
+ for (IdentityStore identityStore : configuredIdentityStores)
+ {
+ if (identityStore.getSupportedFeatures().isNamedRelationshipsSupported())
+ {
+ IdentityStoreInvocationContext storeCtx = resolveInvocationContext(identityStore, ctx);
+
+ Map<String, String> props = identityStore.getRelationshipNameProperties(storeCtx, name);
+ if (props != null && props.keySet().size() > 0)
+ {
+ results.putAll(props);
+ }
+
+ }
+ }
+
+ return results;
+ }
+
+ public void setRelationshipNameProperties(IdentityStoreInvocationContext ctx, String name, Map<String, String> properties) throws IdentityException, OperationNotSupportedException
+ {
+ // For any IdentityStore that supports named relationships...
+ for (IdentityStore identityStore : configuredIdentityStores)
+ {
+ if (identityStore.getSupportedFeatures().isNamedRelationshipsSupported())
+ {
+ IdentityStoreInvocationContext storeCtx = resolveInvocationContext(identityStore, ctx);
+
+ identityStore.setRelationshipNameProperties(storeCtx, name, properties);
+
+ }
+ }
+ }
+
+ public void removeRelationshipNameProperties(IdentityStoreInvocationContext ctx, String name, Set<String> properties) throws IdentityException, OperationNotSupportedException
+ {
+ // For any IdentityStore that supports named relationships...
+ for (IdentityStore identityStore : configuredIdentityStores)
+ {
+ if (identityStore.getSupportedFeatures().isNamedRelationshipsSupported())
+ {
+ IdentityStoreInvocationContext storeCtx = resolveInvocationContext(identityStore, ctx);
+
+ identityStore.removeRelationshipNameProperties(storeCtx, name, properties);
+
+ }
+ }
+ }
+
+ public Map<String, String> getRelationshipProperties(IdentityStoreInvocationContext ctx, IdentityObjectRelationship relationship) throws IdentityException, OperationNotSupportedException
+ {
+
+ IdentityStore fromStore = resolveIdentityStore(relationship.getFromIdentityObject());
+ IdentityStore toStore = resolveIdentityStore(relationship.getToIdentityObject());
+
+ if (fromStore == toStore && toStore.getSupportedFeatures().isNamedRelationshipsSupported())
+ {
+ return fromStore.getRelationshipProperties(resolveInvocationContext(fromStore, ctx), relationship);
+ }
+
+ return defaultIdentityStore.getRelationshipProperties(resolveInvocationContext(defaultIdentityStore, ctx), relationship);
+ }
+
+ public void setRelationshipProperties(IdentityStoreInvocationContext ctx, IdentityObjectRelationship relationship, Map<String, String> properties) throws IdentityException, OperationNotSupportedException
+ {
+ IdentityStore fromStore = resolveIdentityStore(relationship.getFromIdentityObject());
+ IdentityStore toStore = resolveIdentityStore(relationship.getToIdentityObject());
+
+ if (fromStore == toStore && toStore.getSupportedFeatures().isNamedRelationshipsSupported())
+ {
+ fromStore.setRelationshipProperties(resolveInvocationContext(fromStore, ctx), relationship, properties);
+ return;
+ }
+
+ defaultIdentityStore.setRelationshipProperties(resolveInvocationContext(defaultIdentityStore, ctx), relationship, properties);
+ }
+
+ public void removeRelationshipProperties(IdentityStoreInvocationContext ctx, IdentityObjectRelationship relationship, Set<String> properties) throws IdentityException, OperationNotSupportedException
+ {
+ IdentityStore fromStore = resolveIdentityStore(relationship.getFromIdentityObject());
+ IdentityStore toStore = resolveIdentityStore(relationship.getToIdentityObject());
+
+ if (fromStore == toStore && toStore.getSupportedFeatures().isNamedRelationshipsSupported())
+ {
+ fromStore.removeRelationshipProperties(resolveInvocationContext(fromStore, ctx), relationship, properties);
+ return;
+ }
+
+ defaultIdentityStore.removeRelationshipProperties(resolveInvocationContext(defaultIdentityStore, ctx), relationship, properties);
+ }
+
public boolean validateCredential(IdentityStoreInvocationContext ctx, IdentityObject identityObject, IdentityObjectCredential credential) throws IdentityException
{
IdentityStore toStore = resolveIdentityStore(identityObject);
@@ -1016,4 +1124,4 @@
{
return allowNotDefinedAttributes;
}
-}
\ No newline at end of file
+}
Modified: idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/repository/WrapperIdentityStoreRepository.java
===================================================================
--- idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/repository/WrapperIdentityStoreRepository.java 2009-04-23 03:48:49 UTC (rev 454)
+++ idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/repository/WrapperIdentityStoreRepository.java 2009-04-23 10:55:39 UTC (rev 455)
@@ -249,6 +249,37 @@
return defaultIdentityStore.getRelationshipNames(resolveIdentityStoreInvocationContext(ctx), identity, controls);
}
+ public Map<String, String> getRelationshipNameProperties(IdentityStoreInvocationContext ctx, String name) throws IdentityException, OperationNotSupportedException
+ {
+ return defaultIdentityStore.getRelationshipNameProperties(resolveAttributeStoreInvocationContext(ctx), name);
+ }
+
+ public void setRelationshipNameProperties(IdentityStoreInvocationContext ctx, String name, Map<String, String> properties) throws IdentityException, OperationNotSupportedException
+ {
+ defaultIdentityStore.setRelationshipNameProperties(resolveIdentityStoreInvocationContext(ctx), name, properties);
+
+ }
+
+ public void removeRelationshipNameProperties(IdentityStoreInvocationContext ctx, String name, Set<String> properties) throws IdentityException, OperationNotSupportedException
+ {
+ defaultIdentityStore.removeRelationshipNameProperties(resolveIdentityStoreInvocationContext(ctx), name, properties);
+ }
+
+ public Map<String, String> getRelationshipProperties(IdentityStoreInvocationContext ctx, IdentityObjectRelationship relationship) throws IdentityException, OperationNotSupportedException
+ {
+ return defaultIdentityStore.getRelationshipProperties(resolveIdentityStoreInvocationContext(ctx), relationship);
+ }
+
+ public void setRelationshipProperties(IdentityStoreInvocationContext ctx, IdentityObjectRelationship relationship, Map<String, String> properties) throws IdentityException, OperationNotSupportedException
+ {
+ defaultIdentityStore.setRelationshipProperties(resolveIdentityStoreInvocationContext(ctx), relationship, properties);
+ }
+
+ public void removeRelationshipProperties(IdentityStoreInvocationContext ctx, IdentityObjectRelationship relationship, Set<String> properties) throws IdentityException, OperationNotSupportedException
+ {
+ defaultIdentityStore.removeRelationshipProperties(resolveIdentityStoreInvocationContext(ctx), relationship, properties);
+ }
+
public boolean validateCredential(IdentityStoreInvocationContext ctx,
IdentityObject identityObject,
IdentityObjectCredential credential) throws IdentityException
Modified: idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/store/FeaturesMetaDataImpl.java
===================================================================
--- idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/store/FeaturesMetaDataImpl.java 2009-04-23 03:48:49 UTC (rev 454)
+++ idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/store/FeaturesMetaDataImpl.java 2009-04-23 10:55:39 UTC (rev 455)
@@ -55,15 +55,20 @@
private final Set<String> readOnlyObjectTypes;
+ private final boolean relationshipPropertiesSupport;
+
// <Relationship Type, <From IdentityType, To IdentityType>>
private final Map<String, Map<String, Set<String>>> supportedRelationshipMappings = new HashMap<String, Map<String, Set<String>>>();
public FeaturesMetaDataImpl(IdentityStoreConfigurationMetaData configurationMD,
Set<IdentityObjectSearchCriteriaType> supportedControls,
+ boolean relationshipPropertiesSupport,
boolean namedRelationshipsSupport,
Set<String> readOnlyObjectTypes)
{
+
+ this.relationshipPropertiesSupport = relationshipPropertiesSupport;
this.namedRelationshipsSupport = namedRelationshipsSupport;
this.readOnlyObjectTypes = readOnlyObjectTypes;
@@ -163,6 +168,11 @@
return namedRelationshipsSupport;
}
+ public boolean isRelationshipPropertiesSupported()
+ {
+ return relationshipPropertiesSupport;
+ }
+
public boolean isSearchCriteriaTypeSupported(IdentityObjectType identityObjectType, IdentityObjectSearchCriteriaType storeSearchConstraint)
{
if (supportedSearchConstraintTypes.contains(storeSearchConstraint))
Modified: idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/store/hibernate/HibernateIdentityStoreImpl.java
===================================================================
--- idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/store/hibernate/HibernateIdentityStoreImpl.java 2009-04-23 03:48:49 UTC (rev 454)
+++ idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/store/hibernate/HibernateIdentityStoreImpl.java 2009-04-23 10:55:39 UTC (rev 455)
@@ -179,7 +179,7 @@
id = configurationMD.getId();
- supportedFeatures = new FeaturesMetaDataImpl(configurationMD, supportedIdentityObjectSearchControls, true, new HashSet<String>());
+ supportedFeatures = new FeaturesMetaDataImpl(configurationMD, supportedIdentityObjectSearchControls, true, true, new HashSet<String>());
String populateMembershipTypes = configurationMD.getOptionSingleValue(POPULATE_MEMBERSHIP_TYPES);
@@ -1237,6 +1237,241 @@
return getRelationshipNames(ctx, identity, null);
}
+ public Map<String, String> getRelationshipNameProperties(IdentityStoreInvocationContext ctx, String name) throws IdentityException, OperationNotSupportedException
+ {
+ if (name == null)
+ {
+ throw new IllegalArgumentException("name is null");
+ }
+
+ Session em = getHibernateSession(ctx);
+
+
+ try
+ {
+ HibernateIdentityObjectRelationshipName hiorn = (HibernateIdentityObjectRelationshipName)em.createCriteria(HibernateIdentityObjectRelationshipName.class)
+ .add(Restrictions.eq("name", name)).add(Restrictions.eq("realm", getRealm(em, ctx))).uniqueResult();
+
+ if (hiorn == null)
+ {
+ throw new IdentityException("Relationship name doesn't exist");
+ }
+
+ return new HashMap<String, String>(hiorn.getProperties());
+
+ }
+ catch (Exception e)
+ {
+ throw new IdentityException("Cannot get relationship name properties: " + name, e);
+ }
+ }
+
+ public void setRelationshipNameProperties(IdentityStoreInvocationContext ctx, String name, Map<String, String> properties) throws IdentityException, OperationNotSupportedException
+ {
+ if (name == null)
+ {
+ throw new IllegalArgumentException("name is null");
+ }
+
+ Session em = getHibernateSession(ctx);
+
+
+ try
+ {
+ HibernateIdentityObjectRelationshipName hiorn = (HibernateIdentityObjectRelationshipName)em.createCriteria(HibernateIdentityObjectRelationshipName.class)
+ .add(Restrictions.eq("name", name)).add(Restrictions.eq("realm", getRealm(em, ctx))).uniqueResult();
+
+ if (hiorn == null)
+ {
+ throw new IdentityException("Relationship name doesn't exist");
+ }
+
+ hiorn.getProperties().putAll(properties);
+
+ }
+ catch (Exception e)
+ {
+ throw new IdentityException("Cannot set relationship name properties: " + name, e);
+ }
+ }
+
+ public void removeRelationshipNameProperties(IdentityStoreInvocationContext ctx, String name, Set<String> properties) throws IdentityException, OperationNotSupportedException
+ {
+ if (name == null)
+ {
+ throw new IllegalArgumentException("name is null");
+ }
+
+ Session em = getHibernateSession(ctx);
+
+
+ try
+ {
+ HibernateIdentityObjectRelationshipName hiorn = (HibernateIdentityObjectRelationshipName)em.createCriteria(HibernateIdentityObjectRelationshipName.class)
+ .add(Restrictions.eq("name", name)).add(Restrictions.eq("realm", getRealm(em, ctx))).uniqueResult();
+
+ if (hiorn == null)
+ {
+ throw new IdentityException("Relationship name doesn't exist");
+ }
+
+ for (String property : properties)
+ {
+ hiorn.getProperties().remove(property);
+ }
+
+ }
+ catch (Exception e)
+ {
+ throw new IdentityException("Cannot remove relationship name properties: " + name, e);
+ }
+ }
+
+ public Map<String, String> getRelationshipProperties(IdentityStoreInvocationContext ctx, IdentityObjectRelationship relationship) throws IdentityException, OperationNotSupportedException
+ {
+ HibernateIdentityObject fromIO = safeGet(ctx, relationship.getFromIdentityObject());
+ HibernateIdentityObject toIO = safeGet(ctx, relationship.getToIdentityObject());
+ HibernateIdentityObjectRelationshipType type = getHibernateIdentityObjectRelationshipType(ctx, relationship.getType());
+
+ Query query = null;
+
+ if (relationship.getName() == null)
+ {
+ query = getHibernateSession(ctx).createQuery(QUERY_RELATIONSHIP_BY_FROM_TO_TYPE)
+ .setParameter("fromIO", fromIO)
+ .setParameter("toIO", toIO)
+ .setParameter("typeName", type.getName());
+ }
+ else
+ {
+ HibernateIdentityObjectRelationshipName relationshipName =
+ (HibernateIdentityObjectRelationshipName)getHibernateSession(ctx)
+ .createCriteria(HibernateIdentityObjectRelationshipName.class).add(Restrictions.eq("name", relationship.getName()))
+ .uniqueResult();
+
+ if (relationshipName == null)
+ {
+ throw new IdentityException("Relationship name not present in the store");
+ }
+
+ query = getHibernateSession(ctx).createQuery(QUERY_RELATIONSHIP_BY_FROM_TO_TYPE_NAME)
+ .setParameter("fromIO", fromIO)
+ .setParameter("toIO", toIO)
+ .setParameter("typeName", type.getName())
+ .setParameter("name", relationship.getName());
+ }
+
+
+ try
+ {
+ HibernateIdentityObjectRelationship hibernateRelationship = (HibernateIdentityObjectRelationship)query.uniqueResult();
+
+ return new HashMap<String, String>(hibernateRelationship.getProperties());
+ }
+ catch (HibernateException e)
+ {
+ throw new IdentityException("Cannot obtain relationship properties: ", e);
+ }
+ }
+
+ public void setRelationshipProperties(IdentityStoreInvocationContext ctx, IdentityObjectRelationship relationship, Map<String, String> properties) throws IdentityException, OperationNotSupportedException
+ {
+ HibernateIdentityObject fromIO = safeGet(ctx, relationship.getFromIdentityObject());
+ HibernateIdentityObject toIO = safeGet(ctx, relationship.getToIdentityObject());
+ HibernateIdentityObjectRelationshipType type = getHibernateIdentityObjectRelationshipType(ctx, relationship.getType());
+
+ Query query = null;
+
+ if (relationship.getName() == null)
+ {
+ query = getHibernateSession(ctx).createQuery(QUERY_RELATIONSHIP_BY_FROM_TO_TYPE)
+ .setParameter("fromIO", fromIO)
+ .setParameter("toIO", toIO)
+ .setParameter("typeName", type.getName());
+ }
+ else
+ {
+ HibernateIdentityObjectRelationshipName relationshipName =
+ (HibernateIdentityObjectRelationshipName)getHibernateSession(ctx)
+ .createCriteria(HibernateIdentityObjectRelationshipName.class).add(Restrictions.eq("name", relationship.getName()))
+ .uniqueResult();
+
+ if (relationshipName == null)
+ {
+ throw new IdentityException("Relationship name not present in the store");
+ }
+
+ query = getHibernateSession(ctx).createQuery(QUERY_RELATIONSHIP_BY_FROM_TO_TYPE_NAME)
+ .setParameter("fromIO", fromIO)
+ .setParameter("toIO", toIO)
+ .setParameter("typeName", type.getName())
+ .setParameter("name", relationship.getName());
+ }
+
+
+ try
+ {
+ HibernateIdentityObjectRelationship hibernateRelationship = (HibernateIdentityObjectRelationship)query.uniqueResult();
+
+ hibernateRelationship.getProperties().putAll(properties);
+ }
+ catch (HibernateException e)
+ {
+ throw new IdentityException("Cannot update relationship properties: ", e);
+ }
+ }
+
+ public void removeRelationshipProperties(IdentityStoreInvocationContext ctx, IdentityObjectRelationship relationship, Set<String> properties) throws IdentityException, OperationNotSupportedException
+ {
+ HibernateIdentityObject fromIO = safeGet(ctx, relationship.getFromIdentityObject());
+ HibernateIdentityObject toIO = safeGet(ctx, relationship.getToIdentityObject());
+ HibernateIdentityObjectRelationshipType type = getHibernateIdentityObjectRelationshipType(ctx, relationship.getType());
+
+ Query query = null;
+
+ if (relationship.getName() == null)
+ {
+ query = getHibernateSession(ctx).createQuery(QUERY_RELATIONSHIP_BY_FROM_TO_TYPE)
+ .setParameter("fromIO", fromIO)
+ .setParameter("toIO", toIO)
+ .setParameter("typeName", type.getName());
+ }
+ else
+ {
+ HibernateIdentityObjectRelationshipName relationshipName =
+ (HibernateIdentityObjectRelationshipName)getHibernateSession(ctx)
+ .createCriteria(HibernateIdentityObjectRelationshipName.class).add(Restrictions.eq("name", relationship.getName()))
+ .uniqueResult();
+
+ if (relationshipName == null)
+ {
+ throw new IdentityException("Relationship name not present in the store");
+ }
+
+ query = getHibernateSession(ctx).createQuery(QUERY_RELATIONSHIP_BY_FROM_TO_TYPE_NAME)
+ .setParameter("fromIO", fromIO)
+ .setParameter("toIO", toIO)
+ .setParameter("typeName", type.getName())
+ .setParameter("name", relationship.getName());
+ }
+
+
+ try
+ {
+ HibernateIdentityObjectRelationship hibernateRelationship = (HibernateIdentityObjectRelationship)query.uniqueResult();
+
+ for (String property : properties)
+ {
+ hibernateRelationship.getProperties().remove(property);
+ }
+ }
+ catch (HibernateException e)
+ {
+ throw new IdentityException("Cannot update relationship properties: ", e);
+ }
+ }
+
+
// Attribute store
public Set<String> getSupportedAttributeNames(IdentityStoreInvocationContext ctx, IdentityObjectType identityType) throws IdentityException
@@ -1685,6 +1920,7 @@
}
}
+
public void updateCredential(IdentityStoreInvocationContext ctx, IdentityObject identityObject, IdentityObjectCredential credential) throws IdentityException
{
Modified: idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/store/ldap/LDAPIdentityStoreImpl.java
===================================================================
--- idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/store/ldap/LDAPIdentityStoreImpl.java 2009-04-23 03:48:49 UTC (rev 454)
+++ idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/store/ldap/LDAPIdentityStoreImpl.java 2009-04-23 10:55:39 UTC (rev 455)
@@ -144,7 +144,7 @@
}
}
- supportedFeatures = new FeaturesMetaDataImpl(configurationMD, supportedSearchConstraintTypes, false, readOnlyObjectTypes);
+ supportedFeatures = new FeaturesMetaDataImpl(configurationMD, supportedSearchConstraintTypes, false, false, readOnlyObjectTypes);
// Attribute mappings - helper structures
@@ -1345,6 +1345,43 @@
throw new OperationNotSupportedException("Named relationships are not supported by this implementation of LDAP IdentityStore");
}
+
+ public Map<String, String> getRelationshipNameProperties(IdentityStoreInvocationContext ctx, String name) throws IdentityException, OperationNotSupportedException
+ {
+ throw new OperationNotSupportedException("Named relationships are not supported by this implementation of LDAP IdentityStore");
+
+ }
+
+ public void setRelationshipNameProperties(IdentityStoreInvocationContext ctx, String name, Map<String, String> properties) throws IdentityException, OperationNotSupportedException
+ {
+ throw new OperationNotSupportedException("Named relationships are not supported by this implementation of LDAP IdentityStore");
+
+ }
+
+ public void removeRelationshipNameProperties(IdentityStoreInvocationContext ctx, String name, Set<String> properties) throws IdentityException, OperationNotSupportedException
+ {
+ throw new OperationNotSupportedException("Named relationships are not supported by this implementation of LDAP IdentityStore");
+
+ }
+
+ public Map<String, String> getRelationshipProperties(IdentityStoreInvocationContext ctx, IdentityObjectRelationship relationship) throws IdentityException, OperationNotSupportedException
+ {
+ throw new OperationNotSupportedException("Relationship properties are not supported by this implementation of LDAP IdentityStore");
+
+ }
+
+ public void setRelationshipProperties(IdentityStoreInvocationContext ctx, IdentityObjectRelationship relationship, Map<String, String> properties) throws IdentityException, OperationNotSupportedException
+ {
+ throw new OperationNotSupportedException("Relationship properties are not supported by this implementation of LDAP IdentityStore");
+
+ }
+
+ public void removeRelationshipProperties(IdentityStoreInvocationContext ctx, IdentityObjectRelationship relationship, Set<String> properties) throws IdentityException, OperationNotSupportedException
+ {
+ throw new OperationNotSupportedException("Relationship properties are not supported by this implementation of LDAP IdentityStore");
+
+ }
+
public boolean validateCredential(IdentityStoreInvocationContext ctx, IdentityObject identityObject, IdentityObjectCredential credential) throws IdentityException
{
if (credential == null)
Added: idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/types/SimpleIdentityObjectRelationship.java
===================================================================
--- idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/types/SimpleIdentityObjectRelationship.java (rev 0)
+++ idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/types/SimpleIdentityObjectRelationship.java 2009-04-23 10:55:39 UTC (rev 455)
@@ -0,0 +1,70 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+
+package org.jboss.identity.idm.impl.types;
+
+import org.jboss.identity.idm.spi.model.IdentityObjectRelationship;
+import org.jboss.identity.idm.spi.model.IdentityObject;
+import org.jboss.identity.idm.spi.model.IdentityObjectRelationshipType;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class SimpleIdentityObjectRelationship implements IdentityObjectRelationship
+{
+ private IdentityObject fromIdentityObject;
+
+ private IdentityObject toIdentityObject;
+
+ private String name;
+
+ private IdentityObjectRelationshipType type;
+
+ public SimpleIdentityObjectRelationship(IdentityObject fromIdentityObject, IdentityObject toIdentityObject, String name, IdentityObjectRelationshipType type)
+ {
+ this.fromIdentityObject = fromIdentityObject;
+ this.toIdentityObject = toIdentityObject;
+ this.name = name;
+ this.type = type;
+ }
+
+ public IdentityObject getFromIdentityObject()
+ {
+ return fromIdentityObject;
+ }
+
+ public IdentityObject getToIdentityObject()
+ {
+ return toIdentityObject;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public IdentityObjectRelationshipType getType()
+ {
+ return type;
+ }
+}
Added: idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/types/SimpleIdentityObjectRelationshipType.java
===================================================================
--- idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/types/SimpleIdentityObjectRelationshipType.java (rev 0)
+++ idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/types/SimpleIdentityObjectRelationshipType.java 2009-04-23 10:55:39 UTC (rev 455)
@@ -0,0 +1,44 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+
+package org.jboss.identity.idm.impl.types;
+
+import org.jboss.identity.idm.spi.model.IdentityObjectRelationshipType;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class SimpleIdentityObjectRelationshipType implements IdentityObjectRelationshipType
+{
+ private String name;
+
+ public SimpleIdentityObjectRelationshipType(String name)
+ {
+ this.name = name;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+}
Modified: idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/api/RoleManagerTest.java
===================================================================
--- idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/api/RoleManagerTest.java 2009-04-23 03:48:49 UTC (rev 454)
+++ idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/api/RoleManagerTest.java 2009-04-23 10:55:39 UTC (rev 455)
@@ -31,6 +31,11 @@
import junit.framework.Assert;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.Set;
+import java.util.HashSet;
+
/**
*
* @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
@@ -118,12 +123,18 @@
assertEquals(4, session.getRoleManager().findRoleTypes(null).size());
+
+
+
// Create/remove and find roles
Role role1 = session.getRoleManager().createRole(rt1, user1, group1);
Role role2 = session.getRoleManager().createRole(rt1, user1, group2);
Role role3 = session.getRoleManager().createRole("rt2", user1.getId(), group1.getId());
+
+
+
//
assertEquals(2, session.getRoleManager().findRoles(user1, rt1).size());
@@ -166,7 +177,60 @@
assertFalse(session.getRoleManager().hasRole(user1, group1, rt3));
assertFalse(session.getRoleManager().hasRole(user1, group4, rt3));
+ // Role properties
+ assertEquals(0, session.getRoleManager().getProperties(role1).keySet().size());
+ assertEquals(0, session.getRoleManager().getProperties(rt1).keySet().size());
+ assertEquals(0, session.getRoleManager().getProperties(rt1.getName()).keySet().size());
+
+ session.getRoleManager().setProperty(role1, "roleProp1", "val1");
+ session.getRoleManager().setProperty(role1, "roleProp1", "val2");
+ session.getRoleManager().setProperty(role1, "roleProp2", "val1");
+ session.getRoleManager().setProperty(rt1, "rtProp1", "val1");
+ session.getRoleManager().setProperty(rt1.getName(), "rtProp1", "val2");
+ session.getRoleManager().setProperty(rt1, "rtProp2", "val1");
+ session.getRoleManager().setProperty(rt1, "rtProp3", "val1");
+
+ assertEquals(2, session.getRoleManager().getProperties(role1).keySet().size());
+ assertEquals(3, session.getRoleManager().getProperties(rt1).keySet().size());
+ assertEquals(3, session.getRoleManager().getProperties(rt1.getName()).keySet().size());
+
+ assertEquals("val2", session.getRoleManager().getProperties(role1).get("roleProp1"));
+ assertEquals("val1", session.getRoleManager().getProperties(role1).get("roleProp2"));
+ assertEquals("val2", session.getRoleManager().getProperties(rt1).get("rtProp1"));
+ assertEquals("val1", session.getRoleManager().getProperties(rt1).get("rtProp2"));
+ assertEquals("val1", session.getRoleManager().getProperties(rt1).get("rtProp3"));
+
+
+ Map<String, String> props = new HashMap<String, String>();
+ props.put("prop5", "val1");
+
+ session.getRoleManager().setProperties(role2, props);
+
+ assertEquals(1, session.getRoleManager().getProperties(role2).keySet().size());
+
+ assertEquals("val1", session.getRoleManager().getProperties(role2).get("prop5"));
+
+
+ props.put("prop6", "val3");
+ session.getRoleManager().setProperties(rt2, props);
+ session.getRoleManager().setProperties(rt3.getName(), props);
+
+ assertEquals(2, session.getRoleManager().getProperties(rt2).keySet().size());
+
+ assertEquals("val3", session.getRoleManager().getProperties(rt2).get("prop6"));
+ assertEquals("val3", session.getRoleManager().getProperties(rt3).get("prop6"));
+
+
+ session.getRoleManager().removeProperty(role2, "prop5");
+ assertEquals(0, session.getRoleManager().getProperties(role2).keySet().size());
+
+ session.getRoleManager().removeProperty(rt2, "prop6");
+ assertEquals(1, session.getRoleManager().getProperties(rt2).keySet().size());
+ session.getRoleManager().removeProperty(rt2, "prop5");
+ assertEquals(0, session.getRoleManager().getProperties(rt2).keySet().size());
+
+
// Remove roles
session.getRoleManager().removeRole(rt1, user1, group1);
Modified: idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/RoleManager.java
===================================================================
--- idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/RoleManager.java 2009-04-23 03:48:49 UTC (rev 454)
+++ idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/RoleManager.java 2009-04-23 10:55:39 UTC (rev 455)
@@ -25,6 +25,7 @@
import org.jboss.identity.idm.exception.IdentityException;
import java.util.Collection;
+import java.util.Map;
/**
* Management operations on Role objects. Role support is optional and depends on the capabilities of the underlying
@@ -110,6 +111,26 @@
Role createRole(String roleTypeName, String userId, String groupId) throws IdentityException;
/**
+ * Create role
+ * @param roleType
+ * @param user
+ * @param group
+ * @return
+ * @throws IdentityException
+ */
+ Role getRole(RoleType roleType, User user, Group group) throws IdentityException;
+
+ /**
+ * Create role
+ * @param roleTypeName
+ * @param userId
+ * @param groupId
+ * @return
+ * @throws IdentityException
+ */
+ Role getRole(String roleTypeName, String userId, String groupId) throws IdentityException;
+
+ /**
* Remove Role
* @param roleType
* @param user
@@ -300,4 +321,94 @@
<T extends IdentityType> Collection<Role> findRoles(String id,
String roleTypeName) throws IdentityException;
+ /**
+ *
+ * @param role
+ * @return
+ */
+ Map<String,String> getProperties(Role role) throws IdentityException;
+
+ /**
+ *
+ * @param roleType
+ * @return
+ */
+ Map<String,String> getProperties(RoleType roleType) throws IdentityException;
+
+ /**
+ *
+ * @param roleTypeName
+ * @return
+ */
+ Map<String,String> getProperties(String roleTypeName) throws IdentityException;
+
+ /**
+ *
+ * @param role
+ * @param name
+ * @param value
+ */
+ void setProperty(Role role, String name, String value) throws IdentityException;
+
+ /**
+ *
+ * @param roleType
+ * @param name
+ * @param value
+ */
+ void setProperty(RoleType roleType, String name, String value) throws IdentityException;
+
+ /**
+ *
+ * @param roleTypeName
+ * @param name
+ * @param value
+ */
+ void setProperty(String roleTypeName, String name, String value) throws IdentityException;
+
+ /**
+ *
+ * @param role
+ * @param properties
+ */
+ void setProperties(Role role, Map<String, String> properties) throws IdentityException;
+
+ /**
+ *
+ * @param roleType
+ * @param properties
+ */
+ void setProperties(RoleType roleType, Map<String, String> properties) throws IdentityException;
+
+ /**
+ *
+ * @param roleTypeName
+ * @param properties
+ */
+ void setProperties(String roleTypeName, Map<String, String> properties) throws IdentityException;
+
+ /**
+ *
+ * @param role
+ * @param name
+ */
+ void removeProperty(Role role, String name) throws IdentityException;
+
+ /**
+ *
+ * @param roleType
+ * @param name
+ */
+ void removeProperty(RoleType roleType, String name) throws IdentityException;
+
+ /**
+ *
+ * @param roleTypeName
+ * @param name
+ */
+ void removeProperty(String roleTypeName, String name) throws IdentityException;
+
+
+
+
}
Modified: idm/trunk/idm-spi/src/main/java/org/jboss/identity/idm/spi/exception/OperationNotSupportedException.java
===================================================================
--- idm/trunk/idm-spi/src/main/java/org/jboss/identity/idm/spi/exception/OperationNotSupportedException.java 2009-04-23 03:48:49 UTC (rev 454)
+++ idm/trunk/idm-spi/src/main/java/org/jboss/identity/idm/spi/exception/OperationNotSupportedException.java 2009-04-23 10:55:39 UTC (rev 455)
@@ -22,12 +22,14 @@
package org.jboss.identity.idm.spi.exception;
+import org.jboss.identity.idm.exception.IdentityException;
+
/**
* Identity operation not supported exception
* @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
* @version : 0.1 $
*/
-public class OperationNotSupportedException extends Exception
+public class OperationNotSupportedException extends IdentityException
{
private static final long serialVersionUID = 1L;
@@ -45,4 +47,4 @@
{
super(cause);
}
-}
\ No newline at end of file
+}
Modified: idm/trunk/idm-spi/src/main/java/org/jboss/identity/idm/spi/store/FeaturesMetaData.java
===================================================================
--- idm/trunk/idm-spi/src/main/java/org/jboss/identity/idm/spi/store/FeaturesMetaData.java 2009-04-23 03:48:49 UTC (rev 454)
+++ idm/trunk/idm-spi/src/main/java/org/jboss/identity/idm/spi/store/FeaturesMetaData.java 2009-04-23 10:55:39 UTC (rev 455)
@@ -96,7 +96,13 @@
*/
boolean isNamedRelationshipsSupported();
+ /**
+ *
+ * @return
+ */
+ boolean isRelationshipPropertiesSupported();
+
/**
* @return Set of relationship type names supported in this store
*/
@@ -110,4 +116,4 @@
*/
boolean isCredentialSupported(IdentityObjectType identityObjectType, IdentityObjectCredentialType credentialType);
-}
\ No newline at end of file
+}
Modified: idm/trunk/idm-spi/src/main/java/org/jboss/identity/idm/spi/store/IdentityStore.java
===================================================================
--- idm/trunk/idm-spi/src/main/java/org/jboss/identity/idm/spi/store/IdentityStore.java 2009-04-23 03:48:49 UTC (rev 454)
+++ idm/trunk/idm-spi/src/main/java/org/jboss/identity/idm/spi/store/IdentityStore.java 2009-04-23 10:55:39 UTC (rev 455)
@@ -268,13 +268,79 @@
* @param name
* @return
*/
- String removeRelationshipName(IdentityStoreInvocationContext ctx, String name) throws IdentityException, OperationNotSupportedException;
+ String removeRelationshipName(IdentityStoreInvocationContext ctx, String name)
+ throws IdentityException, OperationNotSupportedException;
+ /**
+ *
+ * @param ctx
+ * @param name
+ * @return
+ * @throws IdentityException
+ * @throws OperationNotSupportedException
+ */
+ Map<String, String> getRelationshipNameProperties(IdentityStoreInvocationContext ctx, String name)
+ throws IdentityException, OperationNotSupportedException;
+ /**
+ *
+ * @param ctx
+ * @param name
+ * @param properties
+ * @throws IdentityException
+ * @throws OperationNotSupportedException
+ */
+ void setRelationshipNameProperties(IdentityStoreInvocationContext ctx, String name, Map<String, String> properties)
+ throws IdentityException, OperationNotSupportedException;
/**
+ *
+ * @param ctx
+ * @param name
+ * @param properties
+ * @throws IdentityException
+ * @throws OperationNotSupportedException
+ */
+ void removeRelationshipNameProperties(IdentityStoreInvocationContext ctx, String name, Set<String> properties)
+ throws IdentityException, OperationNotSupportedException;
+
+ /**
*
* @param ctx
+ * @param relationship
+ * @return
+ * @throws IdentityException
+ * @throws OperationNotSupportedException
+ */
+ Map<String, String> getRelationshipProperties(IdentityStoreInvocationContext ctx, IdentityObjectRelationship relationship)
+ throws IdentityException, OperationNotSupportedException;
+
+ /**
+ *
+ * @param ctx
+ * @param relationship
+ * @param properties
+ * @throws IdentityException
+ * @throws OperationNotSupportedException
+ */
+ void setRelationshipProperties(IdentityStoreInvocationContext ctx, IdentityObjectRelationship relationship, Map<String, String> properties)
+ throws IdentityException, OperationNotSupportedException;
+
+ /**
+ *
+ * @param ctx
+ * @param relationship
+ * @param properties
+ * @throws IdentityException
+ * @throws OperationNotSupportedException
+ */
+ void removeRelationshipProperties(IdentityStoreInvocationContext ctx, IdentityObjectRelationship relationship, Set<String> properties)
+ throws IdentityException, OperationNotSupportedException;
+
+
+ /**
+ *
+ * @param ctx
* @param controls
* @return
* @throws IdentityException
@@ -319,4 +385,4 @@
*/
void updateCredential(IdentityStoreInvocationContext ctx, IdentityObject identityObject, IdentityObjectCredential credential) throws IdentityException;
-}
\ No newline at end of file
+}
15 years, 9 months
JBoss Identity SVN: r454 - identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/servlets.
by jboss-identity-commits@lists.jboss.org
Author: anil.saldhana(a)jboss.com
Date: 2009-04-22 23:48:49 -0400 (Wed, 22 Apr 2009)
New Revision: 454
Added:
identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/servlets/MetadataServlet.java
Log:
JBID-42: samlv2 metadata
Added: identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/servlets/MetadataServlet.java
===================================================================
--- identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/servlets/MetadataServlet.java (rev 0)
+++ identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/servlets/MetadataServlet.java 2009-04-23 03:48:49 UTC (rev 454)
@@ -0,0 +1,132 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.identity.federation.bindings.servlets;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletContext;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.xml.bind.JAXBElement;
+
+import org.apache.log4j.Logger;
+import org.jboss.identity.federation.api.saml.v2.metadata.MetaDataBuilder;
+import org.jboss.identity.federation.bindings.config.KeyValueType;
+import org.jboss.identity.federation.bindings.config.MetadataProviderType;
+import org.jboss.identity.federation.bindings.config.ProviderType;
+import org.jboss.identity.federation.bindings.providers.IMetadataProvider;
+import org.jboss.identity.federation.bindings.util.ValveUtil;
+import org.jboss.identity.federation.core.saml.v2.constants.JBossSAMLConstants;
+import org.jboss.identity.federation.saml.v2.metadata.EntityDescriptorType;
+
+/**
+ * Metadata servlet for the IDP/SP
+ * @author Anil.Saldhana(a)redhat.com
+ * @since Apr 22, 2009
+ */
+public class MetadataServlet extends HttpServlet
+{
+ private static final long serialVersionUID = 1L;
+ private static Logger log = Logger.getLogger(MetadataServlet.class);
+
+ private String configFileLocation = "/WEB-INF/jboss-idfed.xml";
+ private MetadataProviderType metadataProviderType = null;
+
+ private IMetadataProvider<?> metadataProvider = null;
+
+ private EntityDescriptorType metadata;
+
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public void init(ServletConfig config) throws ServletException
+ {
+ super.init(config);
+ ServletContext context = config.getServletContext();
+ String configL = config.getInitParameter("configFile");
+ if(configL != null && configL.length() > 0)
+ configFileLocation = configL;
+ log.trace("Config File Location="+ configFileLocation);
+ InputStream is = context.getResourceAsStream(configFileLocation);
+ if(is == null)
+ throw new RuntimeException(configFileLocation + " missing");
+ try
+ {
+ ProviderType providerType = ValveUtil.getIDPConfiguration(is);
+ metadataProviderType = providerType.getMetaDataProvider();
+ String fqn = metadataProviderType.getClassName();
+ ClassLoader tcl = SecurityActions.getContextClassLoader();
+ Class<?> clazz = tcl.loadClass(fqn);
+ metadataProvider = (IMetadataProvider) clazz.newInstance();
+ List<KeyValueType> keyValues = metadataProviderType.getOption();
+ Map<String,String> options = new HashMap<String,String>();
+ if(keyValues != null)
+ {
+ for(KeyValueType kvt: keyValues)
+ options.put(kvt.getKey(), kvt.getValue());
+ }
+ metadataProvider.init(options);
+ if(metadataProvider.isMultiple())
+ throw new RuntimeException("Multiple Entities not currently supported");
+
+ String fileInjectionStr = metadataProvider.requireFileInjection();
+ if(fileInjectionStr != null && fileInjectionStr.length() > 0)
+ {
+ metadataProvider.injectFileStream(context.getResourceAsStream(fileInjectionStr));
+ }
+
+ //TODO: signing and encryption key
+
+ metadata = (EntityDescriptorType) metadataProvider.getMetaData();
+ }
+ catch(Exception e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+
+
+ @Override
+ protected void doGet(HttpServletRequest req, HttpServletResponse resp)
+ throws ServletException, IOException
+ {
+ resp.setContentType(JBossSAMLConstants.METADATA_MIME.get());
+ OutputStream os = resp.getOutputStream();
+ JAXBElement<?> jaxbEl = MetaDataBuilder.getObjectFactory().createEntityDescriptor(metadata);
+ try
+ {
+ MetaDataBuilder.getMarshaller().marshal(jaxbEl , os);
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+}
\ No newline at end of file
15 years, 9 months
JBoss Identity SVN: r453 - identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/providers.
by jboss-identity-commits@lists.jboss.org
Author: anil.saldhana(a)jboss.com
Date: 2009-04-22 22:10:35 -0400 (Wed, 22 Apr 2009)
New Revision: 453
Modified:
identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/providers/FileBasedEntitiesMetadataProvider.java
identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/providers/FileBasedEntityMetadataProvider.java
Log:
JBID-42: samlv2 metadata
Modified: identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/providers/FileBasedEntitiesMetadataProvider.java
===================================================================
--- identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/providers/FileBasedEntitiesMetadataProvider.java 2009-04-23 01:59:52 UTC (rev 452)
+++ identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/providers/FileBasedEntitiesMetadataProvider.java 2009-04-23 02:10:35 UTC (rev 453)
@@ -27,6 +27,7 @@
import org.jboss.identity.federation.saml.v2.metadata.EntitiesDescriptorType;
/**
+ * File based provider that handles multiple entities
* @author Anil.Saldhana(a)redhat.com
* @since Apr 21, 2009
*/
@@ -35,7 +36,7 @@
{
public EntitiesDescriptorType getMetaData()
{
- throw new RuntimeException();
+ throw new RuntimeException("NYI");
}
public boolean isMultiple()
Modified: identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/providers/FileBasedEntityMetadataProvider.java
===================================================================
--- identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/providers/FileBasedEntityMetadataProvider.java 2009-04-23 01:59:52 UTC (rev 452)
+++ identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/providers/FileBasedEntityMetadataProvider.java 2009-04-23 02:10:35 UTC (rev 453)
@@ -71,6 +71,7 @@
JAXBElement<EntityDescriptorType> j =
(JAXBElement<EntityDescriptorType>) MetaDataBuilder.getUnmarshaller().unmarshal(metadataFileStream);
edt = j.getValue();
+ //TODO: use the signing and enc key data
}
catch(Exception e)
{
15 years, 9 months
JBoss Identity SVN: r452 - in identity-federation/trunk: jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/config and 7 other directories.
by jboss-identity-commits@lists.jboss.org
Author: anil.saldhana(a)jboss.com
Date: 2009-04-22 21:59:52 -0400 (Wed, 22 Apr 2009)
New Revision: 452
Added:
identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/config/MetadataProviderType.java
identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/providers/
identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/providers/AbstractMetadataProvider.java
identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/providers/FileBasedEntitiesMetadataProvider.java
identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/providers/FileBasedEntityMetadataProvider.java
identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/providers/IMetadataProvider.java
identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/providers/SecurityActions.java
identity-federation/trunk/jboss-identity-bindings/src/test/java/org/jboss/test/identity/federation/bindings/config/MetadataConfigUnitTestCase.java
identity-federation/trunk/jboss-identity-bindings/src/test/resources/config/test-metadata-config-1.xml
Modified:
identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/config/AuthPropertyType.java
identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/config/EncAlgoType.java
identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/config/EncryptionType.java
identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/config/IDPType.java
identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/config/KeyProviderType.java
identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/config/KeyValueType.java
identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/config/ObjectFactory.java
identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/config/ProviderType.java
identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/config/SPType.java
identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/config/STSType.java
identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/config/ServiceProviderType.java
identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/config/ServiceProvidersType.java
identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/config/TokenProviderType.java
identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/config/TokenProvidersType.java
identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/config/TrustType.java
identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/config/package-info.java
identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/servlets/SOAPSAMLXACMLServlet.java
identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/servlets/SecurityActions.java
identity-federation/trunk/jboss-identity-bindings/src/main/resources/schema/config/jboss-identity-fed.xsd
identity-federation/trunk/jboss-identity-fed-api/src/main/java/org/jboss/identity/federation/api/saml/v2/metadata/MetaDataBuilder.java
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/saml/v2/constants/JBossSAMLConstants.java
Log:
JBID-42: samlv2 metadata
Modified: identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/config/AuthPropertyType.java
===================================================================
--- identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/config/AuthPropertyType.java 2009-04-22 21:46:11 UTC (rev 451)
+++ identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/config/AuthPropertyType.java 2009-04-23 01:59:52 UTC (rev 452)
@@ -1,8 +1,8 @@
//
-// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.3 in JDK 1.6
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-661
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2009.04.06 at 05:23:23 PM GMT-03:00
+// Generated on: 2009.04.21 at 04:51:39 PM CDT
//
Modified: identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/config/EncAlgoType.java
===================================================================
--- identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/config/EncAlgoType.java 2009-04-22 21:46:11 UTC (rev 451)
+++ identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/config/EncAlgoType.java 2009-04-23 01:59:52 UTC (rev 452)
@@ -1,8 +1,8 @@
//
-// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.3 in JDK 1.6
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-661
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2009.04.06 at 05:23:23 PM GMT-03:00
+// Generated on: 2009.04.21 at 04:51:39 PM CDT
//
Modified: identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/config/EncryptionType.java
===================================================================
--- identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/config/EncryptionType.java 2009-04-22 21:46:11 UTC (rev 451)
+++ identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/config/EncryptionType.java 2009-04-23 01:59:52 UTC (rev 452)
@@ -1,8 +1,8 @@
//
-// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.3 in JDK 1.6
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-661
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2009.04.06 at 05:23:23 PM GMT-03:00
+// Generated on: 2009.04.21 at 04:51:39 PM CDT
//
Modified: identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/config/IDPType.java
===================================================================
--- identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/config/IDPType.java 2009-04-22 21:46:11 UTC (rev 451)
+++ identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/config/IDPType.java 2009-04-23 01:59:52 UTC (rev 452)
@@ -1,8 +1,8 @@
//
-// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.3 in JDK 1.6
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-661
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2009.04.06 at 05:23:23 PM GMT-03:00
+// Generated on: 2009.04.21 at 04:51:39 PM CDT
//
Modified: identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/config/KeyProviderType.java
===================================================================
--- identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/config/KeyProviderType.java 2009-04-22 21:46:11 UTC (rev 451)
+++ identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/config/KeyProviderType.java 2009-04-23 01:59:52 UTC (rev 452)
@@ -1,8 +1,8 @@
//
-// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.3 in JDK 1.6
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-661
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2009.04.06 at 05:23:23 PM GMT-03:00
+// Generated on: 2009.04.21 at 04:51:39 PM CDT
//
Modified: identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/config/KeyValueType.java
===================================================================
--- identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/config/KeyValueType.java 2009-04-22 21:46:11 UTC (rev 451)
+++ identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/config/KeyValueType.java 2009-04-23 01:59:52 UTC (rev 452)
@@ -1,8 +1,8 @@
//
-// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.3 in JDK 1.6
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-661
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2009.04.06 at 05:23:23 PM GMT-03:00
+// Generated on: 2009.04.21 at 04:51:39 PM CDT
//
Added: identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/config/MetadataProviderType.java
===================================================================
--- identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/config/MetadataProviderType.java (rev 0)
+++ identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/config/MetadataProviderType.java 2009-04-23 01:59:52 UTC (rev 452)
@@ -0,0 +1,104 @@
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-661
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2009.04.22 at 01:16:08 PM CDT
+//
+
+
+package org.jboss.identity.federation.bindings.config;
+
+import java.util.ArrayList;
+import java.util.List;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for MetadataProviderType complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * <complexType name="MetadataProviderType">
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="Option" type="{urn:jboss:identity-federation:config:1.0}KeyValueType" maxOccurs="unbounded" minOccurs="0"/>
+ * </sequence>
+ * <attribute name="ClassName" type="{http://www.w3.org/2001/XMLSchema}string" />
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </pre>
+ *
+ *
+ */
+(a)XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "MetadataProviderType", propOrder = {
+ "option"
+})
+public class MetadataProviderType {
+
+ @XmlElement(name = "Option")
+ protected List<KeyValueType> option;
+ @XmlAttribute(name = "ClassName")
+ protected String className;
+
+ /**
+ * Gets the value of the option property.
+ *
+ * <p>
+ * This accessor method returns a reference to the live list,
+ * not a snapshot. Therefore any modification you make to the
+ * returned list will be present inside the JAXB object.
+ * This is why there is not a <CODE>set</CODE> method for the option property.
+ *
+ * <p>
+ * For example, to add a new item, do as follows:
+ * <pre>
+ * getOption().add(newItem);
+ * </pre>
+ *
+ *
+ * <p>
+ * Objects of the following type(s) are allowed in the list
+ * {@link KeyValueType }
+ *
+ *
+ */
+ public List<KeyValueType> getOption() {
+ if (option == null) {
+ option = new ArrayList<KeyValueType>();
+ }
+ return this.option;
+ }
+
+ /**
+ * Gets the value of the className property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getClassName() {
+ return className;
+ }
+
+ /**
+ * Sets the value of the className property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setClassName(String value) {
+ this.className = value;
+ }
+
+}
Modified: identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/config/ObjectFactory.java
===================================================================
--- identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/config/ObjectFactory.java 2009-04-22 21:46:11 UTC (rev 451)
+++ identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/config/ObjectFactory.java 2009-04-23 01:59:52 UTC (rev 452)
@@ -1,8 +1,8 @@
//
-// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.3 in JDK 1.6
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-661
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2009.04.06 at 05:23:23 PM GMT-03:00
+// Generated on: 2009.04.21 at 04:51:39 PM CDT
//
@@ -17,7 +17,7 @@
/**
* This object contains factory methods for each
* Java content interface and Java element interface
- * generated in the jboss.identity_federation.config._1 package.
+ * generated in the org.jboss.identity.federation.bindings.config package.
* <p>An ObjectFactory allows you to programatically
* construct new instances of the Java representation
* for XML content. The Java representation of XML
@@ -31,47 +31,47 @@
@XmlRegistry
public class ObjectFactory {
+ private final static QName _JBossSTS_QNAME = new QName("urn:jboss:identity-federation:config:1.0", "JBossSTS");
private final static QName _JBossIDP_QNAME = new QName("urn:jboss:identity-federation:config:1.0", "JBossIDP");
- private final static QName _JBossSTS_QNAME = new QName("urn:jboss:identity-federation:config:1.0", "JBossSTS");
private final static QName _JBossSP_QNAME = new QName("urn:jboss:identity-federation:config:1.0", "JBossSP");
/**
- * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: jboss.identity_federation.config._1
+ * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: org.jboss.identity.federation.bindings.config
*
*/
public ObjectFactory() {
}
/**
- * Create an instance of {@link ServiceProviderType }
+ * Create an instance of {@link STSType }
*
*/
- public ServiceProviderType createServiceProviderType() {
- return new ServiceProviderType();
+ public STSType createSTSType() {
+ return new STSType();
}
/**
- * Create an instance of {@link STSType }
+ * Create an instance of {@link KeyValueType }
*
*/
- public STSType createSTSType() {
- return new STSType();
+ public KeyValueType createKeyValueType() {
+ return new KeyValueType();
}
/**
- * Create an instance of {@link SPType }
+ * Create an instance of {@link ServiceProviderType }
*
*/
- public SPType createSPType() {
- return new SPType();
+ public ServiceProviderType createServiceProviderType() {
+ return new ServiceProviderType();
}
/**
- * Create an instance of {@link TrustType }
+ * Create an instance of {@link KeyProviderType }
*
*/
- public TrustType createTrustType() {
- return new TrustType();
+ public KeyProviderType createKeyProviderType() {
+ return new KeyProviderType();
}
/**
@@ -83,76 +83,75 @@
}
/**
- * Create an instance of {@link ProviderType }
+ * Create an instance of {@link TokenProviderType }
*
*/
- public ProviderType createProviderType() {
- return new ProviderType();
+ public TokenProviderType createTokenProviderType() {
+ return new TokenProviderType();
}
/**
- * Create an instance of {@link AuthPropertyType }
+ * Create an instance of {@link IDPType }
*
*/
- public AuthPropertyType createAuthPropertyType() {
- return new AuthPropertyType();
+ public IDPType createIDPType() {
+ return new IDPType();
}
/**
- * Create an instance of {@link TokenProviderType }
+ * Create an instance of {@link ServiceProvidersType }
*
*/
- public TokenProviderType createTokenProviderType() {
- return new TokenProviderType();
+ public ServiceProvidersType createServiceProvidersType() {
+ return new ServiceProvidersType();
}
/**
- * Create an instance of {@link IDPType }
+ * Create an instance of {@link MetadataProviderType }
*
*/
- public IDPType createIDPType() {
- return new IDPType();
+ public MetadataProviderType createMetadataProviderType() {
+ return new MetadataProviderType();
}
/**
- * Create an instance of {@link EncryptionType }
+ * Create an instance of {@link ProviderType }
*
*/
- public EncryptionType createEncryptionType() {
- return new EncryptionType();
+ public ProviderType createProviderType() {
+ return new ProviderType();
}
/**
- * Create an instance of {@link ServiceProvidersType }
+ * Create an instance of {@link AuthPropertyType }
*
*/
- public ServiceProvidersType createServiceProvidersType() {
- return new ServiceProvidersType();
+ public AuthPropertyType createAuthPropertyType() {
+ return new AuthPropertyType();
}
/**
- * Create an instance of {@link KeyValueType }
+ * Create an instance of {@link TrustType }
*
*/
- public KeyValueType createKeyValueType() {
- return new KeyValueType();
+ public TrustType createTrustType() {
+ return new TrustType();
}
/**
- * Create an instance of {@link KeyProviderType }
+ * Create an instance of {@link SPType }
*
*/
- public KeyProviderType createKeyProviderType() {
- return new KeyProviderType();
+ public SPType createSPType() {
+ return new SPType();
}
/**
- * Create an instance of {@link JAXBElement }{@code <}{@link IDPType }{@code >}}
+ * Create an instance of {@link EncryptionType }
*
*/
- @XmlElementDecl(namespace = "urn:jboss:identity-federation:config:1.0", name = "JBossIDP")
- public JAXBElement<IDPType> createJBossIDP(IDPType value) {
- return new JAXBElement<IDPType>(_JBossIDP_QNAME, IDPType.class, null, value);
+ public EncryptionType createEncryptionType() {
+ return new EncryptionType();
}
/**
@@ -165,6 +164,15 @@
}
/**
+ * Create an instance of {@link JAXBElement }{@code <}{@link IDPType }{@code >}}
+ *
+ */
+ @XmlElementDecl(namespace = "urn:jboss:identity-federation:config:1.0", name = "JBossIDP")
+ public JAXBElement<IDPType> createJBossIDP(IDPType value) {
+ return new JAXBElement<IDPType>(_JBossIDP_QNAME, IDPType.class, null, value);
+ }
+
+ /**
* Create an instance of {@link JAXBElement }{@code <}{@link SPType }{@code >}}
*
*/
Modified: identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/config/ProviderType.java
===================================================================
--- identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/config/ProviderType.java 2009-04-22 21:46:11 UTC (rev 451)
+++ identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/config/ProviderType.java 2009-04-23 01:59:52 UTC (rev 452)
@@ -1,8 +1,8 @@
//
-// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.3 in JDK 1.6
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-661
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2009.04.06 at 05:23:23 PM GMT-03:00
+// Generated on: 2009.04.21 at 04:51:39 PM CDT
//
@@ -31,6 +31,7 @@
* <element name="IdentityURL" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="Trust" type="{urn:jboss:identity-federation:config:1.0}TrustType" minOccurs="0"/>
* <element name="KeyProvider" type="{urn:jboss:identity-federation:config:1.0}KeyProviderType" minOccurs="0"/>
+ * <element name="MetaDataProvider" type="{urn:jboss:identity-federation:config:1.0}MetadataProviderType" minOccurs="0"/>
* </sequence>
* <attribute name="ServerEnvironment" default="JBOSS">
* <simpleType>
@@ -51,11 +52,12 @@
@XmlType(name = "ProviderType", propOrder = {
"identityURL",
"trust",
- "keyProvider"
+ "keyProvider",
+ "metaDataProvider"
})
@XmlSeeAlso({
- SPType.class,
- IDPType.class
+ IDPType.class,
+ SPType.class
})
public class ProviderType {
@@ -65,6 +67,8 @@
protected TrustType trust;
@XmlElement(name = "KeyProvider")
protected KeyProviderType keyProvider;
+ @XmlElement(name = "MetaDataProvider")
+ protected MetadataProviderType metaDataProvider;
@XmlAttribute(name = "ServerEnvironment")
protected String serverEnvironment;
@@ -141,6 +145,30 @@
}
/**
+ * Gets the value of the metaDataProvider property.
+ *
+ * @return
+ * possible object is
+ * {@link MetadataProviderType }
+ *
+ */
+ public MetadataProviderType getMetaDataProvider() {
+ return metaDataProvider;
+ }
+
+ /**
+ * Sets the value of the metaDataProvider property.
+ *
+ * @param value
+ * allowed object is
+ * {@link MetadataProviderType }
+ *
+ */
+ public void setMetaDataProvider(MetadataProviderType value) {
+ this.metaDataProvider = value;
+ }
+
+ /**
* Gets the value of the serverEnvironment property.
*
* @return
Modified: identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/config/SPType.java
===================================================================
--- identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/config/SPType.java 2009-04-22 21:46:11 UTC (rev 451)
+++ identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/config/SPType.java 2009-04-23 01:59:52 UTC (rev 452)
@@ -1,8 +1,8 @@
//
-// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.3 in JDK 1.6
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-661
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2009.04.06 at 05:23:23 PM GMT-03:00
+// Generated on: 2009.04.21 at 04:51:39 PM CDT
//
Modified: identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/config/STSType.java
===================================================================
--- identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/config/STSType.java 2009-04-22 21:46:11 UTC (rev 451)
+++ identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/config/STSType.java 2009-04-23 01:59:52 UTC (rev 452)
@@ -1,8 +1,8 @@
//
-// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.3 in JDK 1.6
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-661
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2009.04.06 at 05:23:23 PM GMT-03:00
+// Generated on: 2009.04.21 at 04:51:39 PM CDT
//
Modified: identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/config/ServiceProviderType.java
===================================================================
--- identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/config/ServiceProviderType.java 2009-04-22 21:46:11 UTC (rev 451)
+++ identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/config/ServiceProviderType.java 2009-04-23 01:59:52 UTC (rev 452)
@@ -1,8 +1,8 @@
//
-// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.3 in JDK 1.6
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-661
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2009.04.06 at 05:23:23 PM GMT-03:00
+// Generated on: 2009.04.21 at 04:51:39 PM CDT
//
Modified: identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/config/ServiceProvidersType.java
===================================================================
--- identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/config/ServiceProvidersType.java 2009-04-22 21:46:11 UTC (rev 451)
+++ identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/config/ServiceProvidersType.java 2009-04-23 01:59:52 UTC (rev 452)
@@ -1,8 +1,8 @@
//
-// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.3 in JDK 1.6
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-661
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2009.04.06 at 05:23:23 PM GMT-03:00
+// Generated on: 2009.04.21 at 04:51:39 PM CDT
//
Modified: identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/config/TokenProviderType.java
===================================================================
--- identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/config/TokenProviderType.java 2009-04-22 21:46:11 UTC (rev 451)
+++ identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/config/TokenProviderType.java 2009-04-23 01:59:52 UTC (rev 452)
@@ -1,8 +1,8 @@
//
-// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.3 in JDK 1.6
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-661
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2009.04.06 at 05:23:23 PM GMT-03:00
+// Generated on: 2009.04.21 at 04:51:39 PM CDT
//
Modified: identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/config/TokenProvidersType.java
===================================================================
--- identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/config/TokenProvidersType.java 2009-04-22 21:46:11 UTC (rev 451)
+++ identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/config/TokenProvidersType.java 2009-04-23 01:59:52 UTC (rev 452)
@@ -1,8 +1,8 @@
//
-// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.3 in JDK 1.6
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-661
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2009.04.06 at 05:23:23 PM GMT-03:00
+// Generated on: 2009.04.21 at 04:51:39 PM CDT
//
Modified: identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/config/TrustType.java
===================================================================
--- identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/config/TrustType.java 2009-04-22 21:46:11 UTC (rev 451)
+++ identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/config/TrustType.java 2009-04-23 01:59:52 UTC (rev 452)
@@ -1,8 +1,8 @@
//
-// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.3 in JDK 1.6
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-661
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2009.04.06 at 05:23:23 PM GMT-03:00
+// Generated on: 2009.04.21 at 04:51:39 PM CDT
//
Modified: identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/config/package-info.java
===================================================================
--- identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/config/package-info.java 2009-04-22 21:46:11 UTC (rev 451)
+++ identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/config/package-info.java 2009-04-23 01:59:52 UTC (rev 452)
@@ -1,8 +1,8 @@
//
-// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.3 in JDK 1.6
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-661
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2009.04.06 at 05:23:23 PM GMT-03:00
+// Generated on: 2009.04.21 at 04:51:39 PM CDT
//
@javax.xml.bind.annotation.XmlSchema(namespace = "urn:jboss:identity-federation:config:1.0", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED)
Added: identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/providers/AbstractMetadataProvider.java
===================================================================
--- identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/providers/AbstractMetadataProvider.java (rev 0)
+++ identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/providers/AbstractMetadataProvider.java 2009-04-23 01:59:52 UTC (rev 452)
@@ -0,0 +1,43 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.identity.federation.bindings.providers;
+
+import java.util.Map;
+
+/**
+ * Abstract Metadata provider
+ * @author Anil.Saldhana(a)redhat.com
+ * @since Apr 21, 2009
+ */
+public abstract class AbstractMetadataProvider
+{
+ protected Map<String, String> options;
+
+ /**
+ * @see IMetadataProvider#init(Map)
+ * @param options
+ */
+ public void init(Map<String,String> options)
+ {
+ this.options = options;
+ }
+}
\ No newline at end of file
Added: identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/providers/FileBasedEntitiesMetadataProvider.java
===================================================================
--- identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/providers/FileBasedEntitiesMetadataProvider.java (rev 0)
+++ identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/providers/FileBasedEntitiesMetadataProvider.java 2009-04-23 01:59:52 UTC (rev 452)
@@ -0,0 +1,62 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.identity.federation.bindings.providers;
+
+import java.io.InputStream;
+import java.security.PublicKey;
+
+import org.jboss.identity.federation.saml.v2.metadata.EntitiesDescriptorType;
+
+/**
+ * @author Anil.Saldhana(a)redhat.com
+ * @since Apr 21, 2009
+ */
+public class FileBasedEntitiesMetadataProvider extends AbstractMetadataProvider
+implements IMetadataProvider<EntitiesDescriptorType>
+{
+ public EntitiesDescriptorType getMetaData()
+ {
+ throw new RuntimeException();
+ }
+
+ public boolean isMultiple()
+ {
+ return true;
+ }
+
+ public void injectEncryptionKey(PublicKey publicKey)
+ {
+ }
+
+ public void injectFileStream(InputStream fileStream)
+ {
+ }
+
+ public void injectSigningKey(PublicKey publicKey)
+ {
+ }
+
+ public String requireFileInjection()
+ {
+ return null;
+ }
+}
\ No newline at end of file
Added: identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/providers/FileBasedEntityMetadataProvider.java
===================================================================
--- identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/providers/FileBasedEntityMetadataProvider.java (rev 0)
+++ identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/providers/FileBasedEntityMetadataProvider.java 2009-04-23 01:59:52 UTC (rev 452)
@@ -0,0 +1,109 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.identity.federation.bindings.providers;
+
+import java.io.InputStream;
+import java.security.PublicKey;
+import java.util.Map;
+
+import javax.xml.bind.JAXBElement;
+
+import org.jboss.identity.federation.api.saml.v2.metadata.MetaDataBuilder;
+import org.jboss.identity.federation.saml.v2.metadata.EntityDescriptorType;
+
+/**
+ * A file based metadata provider that
+ * just looks for the passed in file name
+ * @author Anil.Saldhana(a)redhat.com
+ * @since Apr 21, 2009
+ */
+public class FileBasedEntityMetadataProvider extends AbstractMetadataProvider
+implements IMetadataProvider<EntityDescriptorType>
+{
+
+ private static final String FILENAME_KEY = "FileName";
+ private String fileName;
+ private InputStream metadataFileStream;
+ private PublicKey encryptionKey;
+ private PublicKey signingKey;
+
+ @Override
+ public void init(Map<String, String> options)
+ {
+ super.init(options);
+ fileName = options.get(FILENAME_KEY);
+ if(fileName == null)
+ throw new IllegalStateException("FileName option not set");
+ }
+
+ /**
+ * @see IMetadataProvider#getMetaData()
+ */
+ @SuppressWarnings("unchecked")
+ public EntityDescriptorType getMetaData()
+ {
+ EntityDescriptorType edt = null;
+
+ if(this.metadataFileStream == null)
+ throw new RuntimeException("Metadata file is not injected");
+
+ try
+ {
+ JAXBElement<EntityDescriptorType> j =
+ (JAXBElement<EntityDescriptorType>) MetaDataBuilder.getUnmarshaller().unmarshal(metadataFileStream);
+ edt = j.getValue();
+ }
+ catch(Exception e)
+ {
+ throw new RuntimeException(e);
+ }
+ return edt;
+ }
+
+ /**
+ * @see IMetadataProvider#isMultiple()
+ */
+ public boolean isMultiple()
+ {
+ return false;
+ }
+
+ public void injectEncryptionKey(PublicKey publicKey)
+ {
+ this.encryptionKey = publicKey;
+ }
+
+ public void injectFileStream(InputStream fileStream)
+ {
+ this.metadataFileStream = fileStream;
+ }
+
+ public void injectSigningKey(PublicKey publicKey)
+ {
+ this.signingKey = publicKey;
+ }
+
+ public String requireFileInjection()
+ {
+ return this.fileName;
+ }
+}
\ No newline at end of file
Added: identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/providers/IMetadataProvider.java
===================================================================
--- identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/providers/IMetadataProvider.java (rev 0)
+++ identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/providers/IMetadataProvider.java 2009-04-23 01:59:52 UTC (rev 452)
@@ -0,0 +1,79 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.identity.federation.bindings.providers;
+
+import java.io.File;
+import java.io.InputStream;
+import java.security.PublicKey;
+import java.util.Map;
+
+/**
+ * MetadataProvider
+ * @author Anil.Saldhana(a)redhat.com
+ * @since Apr 21, 2009
+ */
+public interface IMetadataProvider<T>
+{
+ /**
+ * Initialize the provider with options
+ * @param options
+ */
+ void init(Map<String,String> options);
+
+ /**
+ * Is multiple descriptors attached?
+ * @return
+ */
+ boolean isMultiple();
+
+ /**
+ * Get the Metadata descriptors
+ * @return
+ */
+ T getMetaData();
+
+ /**
+ * Provider indicates that it requires
+ * an injection of File instance
+ * @return File Name (need injection) or null
+ */
+ String requireFileInjection();
+
+ /**
+ * Inject a File instance depending on
+ * @see #requireFileInjection() method
+ * @param fileStream
+ */
+ void injectFileStream(InputStream fileStream);
+
+ /**
+ * Inject a public key used for signing
+ * @param publicKey
+ */
+ void injectSigningKey(PublicKey publicKey);
+
+ /**
+ * Inject a public key used for encryption
+ * @param publicKey
+ */
+ void injectEncryptionKey(PublicKey publicKey);
+}
\ No newline at end of file
Added: identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/providers/SecurityActions.java
===================================================================
--- identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/providers/SecurityActions.java (rev 0)
+++ identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/providers/SecurityActions.java 2009-04-23 01:59:52 UTC (rev 452)
@@ -0,0 +1,59 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.identity.federation.bindings.providers;
+
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.security.PrivilegedActionException;
+import java.security.PrivilegedExceptionAction;
+
+/**
+ * Privileged Blocks
+ * @author Anil.Saldhana(a)redhat.com
+ * @since Mar 17, 2009
+ */
+class SecurityActions
+{
+ static void setSystemProperty( final String key, final String value)
+ {
+ AccessController.doPrivileged(new PrivilegedAction<Object>()
+ {
+ public Object run()
+ {
+ System.setProperty(key, value);
+ return null;
+ }
+ });
+ }
+
+ static ClassLoader getContextClassLoader() throws PrivilegedActionException
+ {
+ return AccessController.doPrivileged(new PrivilegedExceptionAction<ClassLoader>()
+ {
+ public ClassLoader run() throws Exception
+ {
+ return Thread.currentThread().getContextClassLoader();
+ }
+ });
+ }
+
+}
\ No newline at end of file
Modified: identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/servlets/SOAPSAMLXACMLServlet.java
===================================================================
--- identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/servlets/SOAPSAMLXACMLServlet.java 2009-04-22 21:46:11 UTC (rev 451)
+++ identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/servlets/SOAPSAMLXACMLServlet.java 2009-04-23 01:59:52 UTC (rev 452)
@@ -24,9 +24,7 @@
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
-import java.security.AccessController;
import java.security.PrivilegedActionException;
-import java.security.PrivilegedExceptionAction;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
@@ -242,13 +240,7 @@
private PolicyDecisionPoint getPDP() throws PrivilegedActionException
{
- ClassLoader tcl = AccessController.doPrivileged(new PrivilegedExceptionAction<ClassLoader>()
- {
- public ClassLoader run() throws Exception
- {
- return Thread.currentThread().getContextClassLoader();
- }
- });
+ ClassLoader tcl = SecurityActions.getContextClassLoader();
InputStream is = tcl.getResourceAsStream(this.policyConfigFileName);
if(is == null)
throw new IllegalStateException(policyConfigFileName + " could not be located");
Modified: identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/servlets/SecurityActions.java
===================================================================
--- identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/servlets/SecurityActions.java 2009-04-22 21:46:11 UTC (rev 451)
+++ identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/servlets/SecurityActions.java 2009-04-23 01:59:52 UTC (rev 452)
@@ -23,6 +23,8 @@
import java.security.AccessController;
import java.security.PrivilegedAction;
+import java.security.PrivilegedActionException;
+import java.security.PrivilegedExceptionAction;
/**
* Privileged Blocks
@@ -42,5 +44,16 @@
}
});
}
+
+ static ClassLoader getContextClassLoader() throws PrivilegedActionException
+ {
+ return AccessController.doPrivileged(new PrivilegedExceptionAction<ClassLoader>()
+ {
+ public ClassLoader run() throws Exception
+ {
+ return Thread.currentThread().getContextClassLoader();
+ }
+ });
+ }
}
\ No newline at end of file
Modified: identity-federation/trunk/jboss-identity-bindings/src/main/resources/schema/config/jboss-identity-fed.xsd
===================================================================
--- identity-federation/trunk/jboss-identity-bindings/src/main/resources/schema/config/jboss-identity-fed.xsd 2009-04-22 21:46:11 UTC (rev 451)
+++ identity-federation/trunk/jboss-identity-bindings/src/main/resources/schema/config/jboss-identity-fed.xsd 2009-04-23 01:59:52 UTC (rev 452)
@@ -106,6 +106,7 @@
<element name="KeyProvider" type="tns:KeyProviderType"
maxOccurs="1" minOccurs="0">
</element>
+ <element name="MetaDataProvider" type="tns:MetadataProviderType" maxOccurs="1" minOccurs="0"></element>
</sequence>
<!-- Specify what is the server environment where the IDP or SP exists -->
<attribute name="ServerEnvironment" use="optional" default="JBOSS">
@@ -214,4 +215,11 @@
<element name="JBossSTS" type="tns:STSType"/>
+
+ <complexType name="MetadataProviderType">
+ <sequence>
+ <element name="Option" type="tns:KeyValueType" maxOccurs="unbounded" minOccurs="0"></element>
+ </sequence>
+ <attribute name="ClassName" type="string"></attribute>
+ </complexType>
</schema>
\ No newline at end of file
Added: identity-federation/trunk/jboss-identity-bindings/src/test/java/org/jboss/test/identity/federation/bindings/config/MetadataConfigUnitTestCase.java
===================================================================
--- identity-federation/trunk/jboss-identity-bindings/src/test/java/org/jboss/test/identity/federation/bindings/config/MetadataConfigUnitTestCase.java (rev 0)
+++ identity-federation/trunk/jboss-identity-bindings/src/test/java/org/jboss/test/identity/federation/bindings/config/MetadataConfigUnitTestCase.java 2009-04-23 01:59:52 UTC (rev 452)
@@ -0,0 +1,88 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.identity.federation.bindings.config;
+
+import java.io.InputStream;
+import java.util.List;
+
+import javax.xml.bind.JAXBElement;
+import javax.xml.bind.Unmarshaller;
+
+import junit.framework.TestCase;
+
+import org.jboss.identity.federation.bindings.config.IDPType;
+import org.jboss.identity.federation.bindings.config.KeyValueType;
+import org.jboss.identity.federation.bindings.config.MetadataProviderType;
+import org.jboss.identity.federation.bindings.config.TrustType;
+import org.jboss.identity.federation.core.saml.v2.factories.JBossSAMLBaseFactory;
+
+
+/**
+ * Config for the SAMLv2 Metadata Profile
+ * @author Anil.Saldhana(a)redhat.com
+ * @since Apr 22, 2009
+ */
+public class MetadataConfigUnitTestCase extends TestCase
+{
+ String config = "config/test-metadata-config-";
+
+ @SuppressWarnings("unchecked")
+ public void testMetadata() throws Exception
+ {
+ Object object = this.unmarshall(config + "1.xml");
+ assertNotNull("IDP is not null", object);
+ assertTrue(object instanceof JAXBElement);
+ IDPType idp = ((JAXBElement<IDPType>) object).getValue();
+ assertEquals("20000", 20000L, idp.getAssertionValidity());
+ assertEquals("somefqn", idp.getRoleGenerator());
+
+ TrustType trust = idp.getTrust();
+ assertNotNull("Trust is not null", trust);
+ String domains = trust.getDomains();
+ assertTrue("localhost trusted", domains.indexOf("localhost") > -1);
+ assertTrue("jboss.com trusted", domains.indexOf("jboss.com") > -1);
+
+ MetadataProviderType metaDataProvider = idp.getMetaDataProvider();
+ assertNotNull("MetadataProvider is not null", metaDataProvider);
+ assertEquals("org.jboss.test.somefqn", metaDataProvider.getClassName());
+
+ List<KeyValueType> keyValues = metaDataProvider.getOption();
+ assertTrue(1 == keyValues.size());
+ KeyValueType kvt = keyValues.get(0);
+ assertEquals("FileName", kvt.getKey());
+ assertEquals("myfile", kvt.getValue());
+ }
+
+ private Object unmarshall(String configFile) throws Exception
+ {
+ String schema = "schema/config/jboss-identity-fed.xsd";
+
+ ClassLoader tcl = Thread.currentThread().getContextClassLoader();
+ InputStream is = tcl.getResourceAsStream(configFile);
+ assertNotNull("Inputstream not null", is);
+
+ Unmarshaller un =
+ JBossSAMLBaseFactory.getValidatingUnmarshaller("org.jboss.identity.federation.bindings.config",
+ schema);
+ return un.unmarshal(is);
+ }
+}
\ No newline at end of file
Added: identity-federation/trunk/jboss-identity-bindings/src/test/resources/config/test-metadata-config-1.xml
===================================================================
--- identity-federation/trunk/jboss-identity-bindings/src/test/resources/config/test-metadata-config-1.xml (rev 0)
+++ identity-federation/trunk/jboss-identity-bindings/src/test/resources/config/test-metadata-config-1.xml 2009-04-23 01:59:52 UTC (rev 452)
@@ -0,0 +1,18 @@
+<JBossIDP xmlns="urn:jboss:identity-federation:config:1.0"
+ AssertionValidity="20000"
+ RoleGenerator="somefqn"
+ Encrypt="true">
+<IdentityURL>http://localhost:8080/idp</IdentityURL>
+<Trust>
+ <Domains>localhost,jboss.com,jboss.org</Domains>
+</Trust>
+<KeyProvider ClassName="SomeClass">
+ <Auth Key="SomeKey" Value="SomeValue" />
+ <Auth Key="DBURL" Value="SomeDBURL" />
+ <ValidatingAlias Key="localhost" Value="localhostalias"/>
+ <ValidatingAlias Key="jboss.com" Value="jbossalias"/>
+</KeyProvider>
+<MetaDataProvider ClassName="org.jboss.test.somefqn">
+ <Option Key="FileName" Value="myfile"/>
+</MetaDataProvider>
+</JBossIDP>
\ No newline at end of file
Modified: identity-federation/trunk/jboss-identity-fed-api/src/main/java/org/jboss/identity/federation/api/saml/v2/metadata/MetaDataBuilder.java
===================================================================
--- identity-federation/trunk/jboss-identity-fed-api/src/main/java/org/jboss/identity/federation/api/saml/v2/metadata/MetaDataBuilder.java 2009-04-22 21:46:11 UTC (rev 451)
+++ identity-federation/trunk/jboss-identity-fed-api/src/main/java/org/jboss/identity/federation/api/saml/v2/metadata/MetaDataBuilder.java 2009-04-23 01:59:52 UTC (rev 452)
@@ -23,7 +23,11 @@
import java.util.List;
+import javax.xml.bind.Marshaller;
+import javax.xml.bind.Unmarshaller;
+
import org.jboss.identity.federation.core.saml.v2.constants.JBossSAMLConstants;
+import org.jboss.identity.federation.core.saml.v2.factories.JBossSAMLBaseFactory;
import org.jboss.identity.federation.saml.v2.assertion.AttributeType;
import org.jboss.identity.federation.saml.v2.metadata.EndpointType;
import org.jboss.identity.federation.saml.v2.metadata.EntityDescriptorType;
@@ -45,6 +49,7 @@
{
private static ObjectFactory oFact = new ObjectFactory();
+ private static String pkgName = "org.jboss.identity.federation.saml.v2.metadata";
/**
* Create an Endpoint (SingleSignOnEndpoint or SingleLogoutEndpoint)
* @param binding
@@ -167,7 +172,22 @@
return sp;
}
+ public static Marshaller getMarshaller() throws Exception
+ {
+ return JBossSAMLBaseFactory.getMarshaller(pkgName);
+ }
+
/**
+ * Get the Unmarshaller
+ * @return
+ * @throws Exception
+ */
+ public static Unmarshaller getUnmarshaller() throws Exception
+ {
+ return JBossSAMLBaseFactory.getUnmarshaller(pkgName);
+ }
+
+ /**
* Get the ObjectFactory for method chaining
* @return
*/
Modified: identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/saml/v2/constants/JBossSAMLConstants.java
===================================================================
--- identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/saml/v2/constants/JBossSAMLConstants.java 2009-04-22 21:46:11 UTC (rev 451)
+++ identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/saml/v2/constants/JBossSAMLConstants.java 2009-04-23 01:59:52 UTC (rev 452)
@@ -29,6 +29,7 @@
public enum JBossSAMLConstants
{
LANG_EN("en"),
+ METADATA_MIME("application/samlmetadata+xml"),
SIGNATURE_SHA1_WITH_DSA("SHA1withDSA"),
SIGNATURE_SHA1_WITH_RSA("SHA1withRSA"),
VERSION_2_0("2.0");
15 years, 9 months