JBoss Identity SVN: r825 - in idm/trunk: assembly and 17 other directories.
by jboss-identity-commits@lists.jboss.org
Author: bdaw
Date: 2009-10-08 07:36:48 -0400 (Thu, 08 Oct 2009)
New Revision: 825
Modified:
idm/trunk/assembly/pom.xml
idm/trunk/example/auth-simple/pom.xml
idm/trunk/example/auth/pom.xml
idm/trunk/example/simple/pom.xml
idm/trunk/idm-api/pom.xml
idm/trunk/idm-auth/pom.xml
idm/trunk/idm-cache/pom.xml
idm/trunk/idm-common/pom.xml
idm/trunk/idm-core/pom.xml
idm/trunk/idm-hibernate/pom.xml
idm/trunk/idm-ldap/pom.xml
idm/trunk/idm-spi/pom.xml
idm/trunk/idm-testsuite/pom.xml
idm/trunk/idm-testsuite/src/test/resources/log4j.xml
idm/trunk/integration/deployer/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.Beta3
Modified: idm/trunk/assembly/pom.xml
===================================================================
--- idm/trunk/assembly/pom.xml 2009-10-08 11:23:37 UTC (rev 824)
+++ idm/trunk/assembly/pom.xml 2009-10-08 11:36:48 UTC (rev 825)
@@ -4,14 +4,14 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.jboss.identity.idm</groupId>
<artifactId>jbossidm</artifactId>
- <version>1.0.0-BETA3-SNAPSHOT</version>
+ <version>1.0.0.Beta3</version>
<packaging>pom</packaging>
<name>JBoss Identity IDM Assembly </name>
<parent>
<groupId>org.jboss.identity.idm</groupId>
<artifactId>idm-parent</artifactId>
- <version>1.0.0-BETA3-SNAPSHOT</version>
+ <version>1.0.0.Beta3</version>
<relativePath>../parent</relativePath>
</parent>
Modified: idm/trunk/example/auth/pom.xml
===================================================================
--- idm/trunk/example/auth/pom.xml 2009-10-08 11:23:37 UTC (rev 824)
+++ idm/trunk/example/auth/pom.xml 2009-10-08 11:36:48 UTC (rev 825)
@@ -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.idm.example</groupId>
- <version>1.0.0-BETA3-SNAPSHOT</version>
+ <version>1.0.0.Beta3</version>
<artifactId>example-auth</artifactId>
<packaging>jar</packaging>
<name>Example - JEE authentication</name>
Modified: idm/trunk/example/auth-simple/pom.xml
===================================================================
--- idm/trunk/example/auth-simple/pom.xml 2009-10-08 11:23:37 UTC (rev 824)
+++ idm/trunk/example/auth-simple/pom.xml 2009-10-08 11:36:48 UTC (rev 825)
@@ -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.idm.example</groupId>
- <version>1.0.0-BETA3-SNAPSHOT</version>
+ <version>1.0.0.Beta3</version>
<artifactId>example-auth-simple</artifactId>
<packaging>jar</packaging>
<name>Example - JEE authentication (using deployer)</name>
Modified: idm/trunk/example/simple/pom.xml
===================================================================
--- idm/trunk/example/simple/pom.xml 2009-10-08 11:23:37 UTC (rev 824)
+++ idm/trunk/example/simple/pom.xml 2009-10-08 11:36:48 UTC (rev 825)
@@ -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.idm.example</groupId>
- <version>1.0.0-BETA3-SNAPSHOT</version>
+ <version>1.0.0.Beta3</version>
<artifactId>example-simple</artifactId>
<packaging>jar</packaging>
<name>Example - Simple JBoss Identity IDM Maven2 project</name>
Modified: idm/trunk/idm-api/pom.xml
===================================================================
--- idm/trunk/idm-api/pom.xml 2009-10-08 11:23:37 UTC (rev 824)
+++ idm/trunk/idm-api/pom.xml 2009-10-08 11:36:48 UTC (rev 825)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.jboss.identity.idm</groupId>
<artifactId>idm-parent</artifactId>
- <version>1.0.0-BETA3-SNAPSHOT</version>
+ <version>1.0.0.Beta3</version>
<relativePath>../parent</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: idm/trunk/idm-auth/pom.xml
===================================================================
--- idm/trunk/idm-auth/pom.xml 2009-10-08 11:23:37 UTC (rev 824)
+++ idm/trunk/idm-auth/pom.xml 2009-10-08 11:36:48 UTC (rev 825)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.jboss.identity.idm</groupId>
<artifactId>idm-parent</artifactId>
- <version>1.0.0-BETA3-SNAPSHOT</version>
+ <version>1.0.0.Beta3</version>
<relativePath>../parent</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: idm/trunk/idm-cache/pom.xml
===================================================================
--- idm/trunk/idm-cache/pom.xml 2009-10-08 11:23:37 UTC (rev 824)
+++ idm/trunk/idm-cache/pom.xml 2009-10-08 11:36:48 UTC (rev 825)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.jboss.identity.idm</groupId>
<artifactId>idm-parent</artifactId>
- <version>1.0.0-BETA3-SNAPSHOT</version>
+ <version>1.0.0.Beta3</version>
<relativePath>../parent</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: idm/trunk/idm-common/pom.xml
===================================================================
--- idm/trunk/idm-common/pom.xml 2009-10-08 11:23:37 UTC (rev 824)
+++ idm/trunk/idm-common/pom.xml 2009-10-08 11:36:48 UTC (rev 825)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.jboss.identity.idm</groupId>
<artifactId>idm-parent</artifactId>
- <version>1.0.0-BETA3-SNAPSHOT</version>
+ <version>1.0.0.Beta3</version>
<relativePath>../parent</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: idm/trunk/idm-core/pom.xml
===================================================================
--- idm/trunk/idm-core/pom.xml 2009-10-08 11:23:37 UTC (rev 824)
+++ idm/trunk/idm-core/pom.xml 2009-10-08 11:36:48 UTC (rev 825)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.jboss.identity.idm</groupId>
<artifactId>idm-parent</artifactId>
- <version>1.0.0-BETA3-SNAPSHOT</version>
+ <version>1.0.0.Beta3</version>
<relativePath>../parent</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: idm/trunk/idm-hibernate/pom.xml
===================================================================
--- idm/trunk/idm-hibernate/pom.xml 2009-10-08 11:23:37 UTC (rev 824)
+++ idm/trunk/idm-hibernate/pom.xml 2009-10-08 11:36:48 UTC (rev 825)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.jboss.identity.idm</groupId>
<artifactId>idm-parent</artifactId>
- <version>1.0.0-BETA3-SNAPSHOT</version>
+ <version>1.0.0.Beta3</version>
<relativePath>../parent</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: idm/trunk/idm-ldap/pom.xml
===================================================================
--- idm/trunk/idm-ldap/pom.xml 2009-10-08 11:23:37 UTC (rev 824)
+++ idm/trunk/idm-ldap/pom.xml 2009-10-08 11:36:48 UTC (rev 825)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.jboss.identity.idm</groupId>
<artifactId>idm-parent</artifactId>
- <version>1.0.0-BETA3-SNAPSHOT</version>
+ <version>1.0.0.Beta3</version>
<relativePath>../parent</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: idm/trunk/idm-spi/pom.xml
===================================================================
--- idm/trunk/idm-spi/pom.xml 2009-10-08 11:23:37 UTC (rev 824)
+++ idm/trunk/idm-spi/pom.xml 2009-10-08 11:36:48 UTC (rev 825)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.jboss.identity.idm</groupId>
<artifactId>idm-parent</artifactId>
- <version>1.0.0-BETA3-SNAPSHOT</version>
+ <version>1.0.0.Beta3</version>
<relativePath>../parent</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: idm/trunk/idm-testsuite/pom.xml
===================================================================
--- idm/trunk/idm-testsuite/pom.xml 2009-10-08 11:23:37 UTC (rev 824)
+++ idm/trunk/idm-testsuite/pom.xml 2009-10-08 11:36:48 UTC (rev 825)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.jboss.identity.idm</groupId>
<artifactId>idm-parent</artifactId>
- <version>1.0.0-BETA3-SNAPSHOT</version>
+ <version>1.0.0.Beta3</version>
<relativePath>../parent</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: idm/trunk/idm-testsuite/src/test/resources/log4j.xml
===================================================================
--- idm/trunk/idm-testsuite/src/test/resources/log4j.xml 2009-10-08 11:23:37 UTC (rev 824)
+++ idm/trunk/idm-testsuite/src/test/resources/log4j.xml 2009-10-08 11:36:48 UTC (rev 825)
@@ -1,5 +1,5 @@
- <?xml version="1.0" encoding="UTF-8"?>
- <!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
<appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
Modified: idm/trunk/integration/deployer/pom.xml
===================================================================
--- idm/trunk/integration/deployer/pom.xml 2009-10-08 11:23:37 UTC (rev 824)
+++ idm/trunk/integration/deployer/pom.xml 2009-10-08 11:36:48 UTC (rev 825)
@@ -8,12 +8,12 @@
<groupId>org.jboss.identity.idm.integration</groupId>
<artifactId>idm-jboss5-deployer</artifactId>
<packaging>jar</packaging>
- <version>1.0.0-BETA3-SNAPSHOT</version>
+ <version>1.0.0.Beta3</version>
<parent>
<groupId>org.jboss.identity.idm</groupId>
<artifactId>idm-integration</artifactId>
- <version>1.0.0-BETA3-SNAPSHOT</version>
+ <version>1.0.0.Beta3</version>
</parent>
<properties>
Modified: idm/trunk/integration/jboss5/pom.xml
===================================================================
--- idm/trunk/integration/jboss5/pom.xml 2009-10-08 11:23:37 UTC (rev 824)
+++ idm/trunk/integration/jboss5/pom.xml 2009-10-08 11:36:48 UTC (rev 825)
@@ -8,12 +8,12 @@
<groupId>org.jboss.identity.idm.integration</groupId>
<artifactId>idm-jboss5</artifactId>
<packaging>jar</packaging>
- <version>1.0.0-BETA3-SNAPSHOT</version>
+ <version>1.0.0.Beta3</version>
<parent>
<groupId>org.jboss.identity.idm</groupId>
<artifactId>idm-integration</artifactId>
- <version>1.0.0-BETA3-SNAPSHOT</version>
+ <version>1.0.0.Beta3</version>
</parent>
<dependencies>
Modified: idm/trunk/integration/pom.xml
===================================================================
--- idm/trunk/integration/pom.xml 2009-10-08 11:23:37 UTC (rev 824)
+++ idm/trunk/integration/pom.xml 2009-10-08 11:36:48 UTC (rev 825)
@@ -13,7 +13,7 @@
<parent>
<groupId>org.jboss.identity.idm</groupId>
<artifactId>idm-parent</artifactId>
- <version>1.0.0-BETA3-SNAPSHOT</version>
+ <version>1.0.0.Beta3</version>
<relativePath>../parent/pom.xml</relativePath>
</parent>
Modified: idm/trunk/parent/pom.xml
===================================================================
--- idm/trunk/parent/pom.xml 2009-10-08 11:23:37 UTC (rev 824)
+++ idm/trunk/parent/pom.xml 2009-10-08 11:36:48 UTC (rev 825)
@@ -8,7 +8,7 @@
<groupId>org.jboss.identity.idm</groupId>
<artifactId>idm-parent</artifactId>
<packaging>pom</packaging>
- <version>1.0.0-BETA3-SNAPSHOT</version>
+ <version>1.0.0.Beta3</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-10-08 11:23:37 UTC (rev 824)
+++ idm/trunk/pom.xml 2009-10-08 11:36:48 UTC (rev 825)
@@ -3,7 +3,7 @@
<parent>
<groupId>org.jboss.identity.idm</groupId>
<artifactId>idm-parent</artifactId>
- <version>1.0.0-BETA3-SNAPSHOT</version>
+ <version>1.0.0.Beta3</version>
<relativePath>parent</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
14 years, 6 months
JBoss Identity SVN: r824 - idm/trunk/idm-hibernate/src/main/java/org/jboss/identity/idm/impl/model/hibernate.
by jboss-identity-commits@lists.jboss.org
Author: bdaw
Date: 2009-10-08 07:23:37 -0400 (Thu, 08 Oct 2009)
New Revision: 824
Modified:
idm/trunk/idm-hibernate/src/main/java/org/jboss/identity/idm/impl/model/hibernate/HibernateIdentityObjectBinaryAttributeValue.java
idm/trunk/idm-hibernate/src/main/java/org/jboss/identity/idm/impl/model/hibernate/HibernateIdentityObjectCredential.java
idm/trunk/idm-hibernate/src/main/java/org/jboss/identity/idm/impl/model/hibernate/HibernateIdentityObjectTextAttribute.java
Log:
- schema fixes
Modified: idm/trunk/idm-hibernate/src/main/java/org/jboss/identity/idm/impl/model/hibernate/HibernateIdentityObjectBinaryAttributeValue.java
===================================================================
--- idm/trunk/idm-hibernate/src/main/java/org/jboss/identity/idm/impl/model/hibernate/HibernateIdentityObjectBinaryAttributeValue.java 2009-10-08 11:20:21 UTC (rev 823)
+++ idm/trunk/idm-hibernate/src/main/java/org/jboss/identity/idm/impl/model/hibernate/HibernateIdentityObjectBinaryAttributeValue.java 2009-10-08 11:23:37 UTC (rev 824)
@@ -46,7 +46,7 @@
private Long id;
@Lob
- @Column(length = 10240000, name="VALUE")
+ @Column(length = 10240000, name="VAL")
private byte[] value;
public HibernateIdentityObjectBinaryAttributeValue()
Modified: idm/trunk/idm-hibernate/src/main/java/org/jboss/identity/idm/impl/model/hibernate/HibernateIdentityObjectCredential.java
===================================================================
--- idm/trunk/idm-hibernate/src/main/java/org/jboss/identity/idm/impl/model/hibernate/HibernateIdentityObjectCredential.java 2009-10-08 11:20:21 UTC (rev 823)
+++ idm/trunk/idm-hibernate/src/main/java/org/jboss/identity/idm/impl/model/hibernate/HibernateIdentityObjectCredential.java 2009-10-08 11:23:37 UTC (rev 824)
@@ -71,7 +71,7 @@
private String textValue;
@Lob
- @Column(name= "BINARY_VALUE", nullable = true, length = 10240000)
+ @Column(name= "BINARY_VAL", nullable = true, length = 10240000)
private byte[] binaryValue;
@CollectionOfElements
Modified: idm/trunk/idm-hibernate/src/main/java/org/jboss/identity/idm/impl/model/hibernate/HibernateIdentityObjectTextAttribute.java
===================================================================
--- idm/trunk/idm-hibernate/src/main/java/org/jboss/identity/idm/impl/model/hibernate/HibernateIdentityObjectTextAttribute.java 2009-10-08 11:20:21 UTC (rev 823)
+++ idm/trunk/idm-hibernate/src/main/java/org/jboss/identity/idm/impl/model/hibernate/HibernateIdentityObjectTextAttribute.java 2009-10-08 11:23:37 UTC (rev 824)
@@ -45,7 +45,7 @@
{
@CollectionOfElements
- @JoinTable(name = "jbid_io_attr_text_values", joinColumns = @JoinColumn(name = "value"))
+ @JoinTable(name = "jbid_io_attr_text_values", joinColumns = @JoinColumn(name = "VAL"))
private Set<String> values = new HashSet<String>();
public HibernateIdentityObjectTextAttribute()
14 years, 6 months
JBoss Identity SVN: r823 - in idm/trunk/idm-hibernate/src/main/java/org/jboss/identity/idm/impl: store/hibernate and 1 other directory.
by jboss-identity-commits@lists.jboss.org
Author: bdaw
Date: 2009-10-08 07:20:21 -0400 (Thu, 08 Oct 2009)
New Revision: 823
Modified:
idm/trunk/idm-hibernate/src/main/java/org/jboss/identity/idm/impl/model/hibernate/HibernateIdentityObjectRelationshipName.java
idm/trunk/idm-hibernate/src/main/java/org/jboss/identity/idm/impl/store/hibernate/HibernateIdentityStoreImpl.java
Log:
- fix relationship name removal
Modified: idm/trunk/idm-hibernate/src/main/java/org/jboss/identity/idm/impl/model/hibernate/HibernateIdentityObjectRelationshipName.java
===================================================================
--- idm/trunk/idm-hibernate/src/main/java/org/jboss/identity/idm/impl/model/hibernate/HibernateIdentityObjectRelationshipName.java 2009-10-07 19:50:06 UTC (rev 822)
+++ idm/trunk/idm-hibernate/src/main/java/org/jboss/identity/idm/impl/model/hibernate/HibernateIdentityObjectRelationshipName.java 2009-10-08 11:20:21 UTC (rev 823)
@@ -35,6 +35,7 @@
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;
+import org.hibernate.annotations.Cascade;
import org.hibernate.annotations.CollectionOfElements;
/**
@@ -88,10 +89,11 @@
@JoinColumn(nullable = false, name="REALM")
private HibernateRealm realm;
- @CollectionOfElements
+ @CollectionOfElements()
@JoinTable(name = "jbid_io_rel_name_props", joinColumns = @JoinColumn(name = "REALATIONSHIP_NAME_ID", nullable=false))
@org.hibernate.annotations.MapKey(columns = @Column(name = "PROP_KEY", nullable=false))
@Column(name = "PROPERTY")
+ @Cascade(value = {org.hibernate.annotations.CascadeType.DELETE_ORPHAN, org.hibernate.annotations.CascadeType.ALL})
private Map<String, String> properties = new HashMap<String, String>();
public HibernateIdentityObjectRelationshipName()
Modified: idm/trunk/idm-hibernate/src/main/java/org/jboss/identity/idm/impl/store/hibernate/HibernateIdentityStoreImpl.java
===================================================================
--- idm/trunk/idm-hibernate/src/main/java/org/jboss/identity/idm/impl/store/hibernate/HibernateIdentityStoreImpl.java 2009-10-07 19:50:06 UTC (rev 822)
+++ idm/trunk/idm-hibernate/src/main/java/org/jboss/identity/idm/impl/store/hibernate/HibernateIdentityStoreImpl.java 2009-10-08 11:20:21 UTC (rev 823)
@@ -537,6 +537,7 @@
relationship.getFromIdentityObject().getFromRelationships().remove(relationship);
relationship.getToIdentityObject().getToRelationships().remove(relationship);
hibernateSession.delete(relationship);
+ hibernateSession.flush();
}
HibernateIdentityObjectRelationship[] to = new HibernateIdentityObjectRelationship[hibernateObject.getToRelationships().size()];
@@ -546,9 +547,13 @@
relationship.getToIdentityObject().getToRelationships().remove(relationship);
hibernateSession.delete(relationship);
+ hibernateSession.flush();
+
}
hibernateSession.delete(hibernateObject);
+ hibernateSession.flush();
+
}
catch (Exception e)
{
@@ -977,10 +982,20 @@
HibernateIdentityObjectRelationship relationship = (HibernateIdentityObjectRelationship)results.iterator().next();
- fromIO.getFromRelationships().remove(relationship);
- toIO.getToRelationships().remove(relationship);
- getHibernateSession(ctx).delete(relationship);
+ try
+ {
+ fromIO.getFromRelationships().remove(relationship);
+ toIO.getToRelationships().remove(relationship);
+ getHibernateSession(ctx).delete(relationship);
+ getHibernateSession(ctx).flush();
+ }
+ catch (HibernateException e)
+ {
+ throw new IdentityException("Cannot remove relationship");
+ }
+
+
}
public void removeRelationships(IdentityStoreInvocationContext ctx, IdentityObject identity1, IdentityObject identity2, boolean named) throws IdentityException
@@ -1001,9 +1016,17 @@
if ((named && relationship.getName() != null) ||
(!named && relationship.getName() == null))
{
- relationship.getFromIdentityObject().getFromRelationships().remove(relationship);
- relationship.getToIdentityObject().getToRelationships().remove(relationship);
- getHibernateSession(ctx).delete(relationship);
+ try
+ {
+ relationship.getFromIdentityObject().getFromRelationships().remove(relationship);
+ relationship.getToIdentityObject().getToRelationships().remove(relationship);
+ getHibernateSession(ctx).delete(relationship);
+ getHibernateSession(ctx).flush();
+ }
+ catch (HibernateException e)
+ {
+ throw new IdentityException("Cannot remove relationship");
+ }
}
}
}
@@ -1108,7 +1131,9 @@
hiorn = new HibernateIdentityObjectRelationshipName(name, realm);
getHibernateSession(ctx).persist(hiorn);
+ getHibernateSession(ctx).flush();
+
}
catch (Exception e)
{
@@ -1129,6 +1154,7 @@
Session hibernateSession = getHibernateSession(ctx);
+
try
{
HibernateIdentityObjectRelationshipName hiorn = (HibernateIdentityObjectRelationshipName)hibernateSession.createCriteria(HibernateIdentityObjectRelationshipName.class)
@@ -1139,12 +1165,23 @@
throw new IdentityException("Relationship name doesn't exist");
}
+ List<HibernateIdentityObjectRelationship> rels = (List<HibernateIdentityObjectRelationship>)hibernateSession.
+ createCriteria(HibernateIdentityObjectRelationship.class)
+ .add(Restrictions.eq("name", hiorn)).list();
+
+ //Remove all present usages
+ for (HibernateIdentityObjectRelationship rel : rels)
+ {
+ getHibernateSession(ctx).delete(rel);
+ }
+
getHibernateSession(ctx).delete(hiorn);
+ getHibernateSession(ctx).flush();
}
catch (Exception e)
{
- throw new IdentityException("Cannot create new relationship name: " + name, e);
+ throw new IdentityException("Cannot remove new relationship name: " + name, e);
}
@@ -2111,6 +2148,8 @@
hibernateObject.addCredential(hibernateCredential);
+ hibernateSession.flush();
+
}
else
{
@@ -2129,6 +2168,8 @@
{
HibernateIdentityObjectType hibernateType = new HibernateIdentityObjectType(type);
getHibernateSession(ctx).persist(hibernateType);
+ getHibernateSession(ctx).flush();
+
}
@@ -2136,6 +2177,7 @@
{
HibernateIdentityObjectRelationshipType hibernateType = new HibernateIdentityObjectRelationshipType(type);
getHibernateSession(ctx).persist(hibernateType);
+ getHibernateSession(ctx).flush();
}
14 years, 6 months
JBoss Identity SVN: r822 - idm/trunk/idm-hibernate/src/main/java/org/jboss/identity/idm/impl/store/hibernate.
by jboss-identity-commits@lists.jboss.org
Author: bdaw
Date: 2009-10-07 15:50:06 -0400 (Wed, 07 Oct 2009)
New Revision: 822
Modified:
idm/trunk/idm-hibernate/src/main/java/org/jboss/identity/idm/impl/store/hibernate/HibernateIdentityStoreImpl.java
Log:
- fix
Modified: idm/trunk/idm-hibernate/src/main/java/org/jboss/identity/idm/impl/store/hibernate/HibernateIdentityStoreImpl.java
===================================================================
--- idm/trunk/idm-hibernate/src/main/java/org/jboss/identity/idm/impl/store/hibernate/HibernateIdentityStoreImpl.java 2009-10-07 11:53:31 UTC (rev 821)
+++ idm/trunk/idm-hibernate/src/main/java/org/jboss/identity/idm/impl/store/hibernate/HibernateIdentityStoreImpl.java 2009-10-07 19:50:06 UTC (rev 822)
@@ -884,19 +884,6 @@
}
}
-// org.hibernate.Query query = getHibernateSession(ctx).createQuery(QUERY_RELATIONSHIP_BY_FROM_TO_TYPE_NAME)
-// .setParameter("fromIO", fromIO)
-// .setParameter("toIO", toIO)
-// .setParameter("typeName", type.getName())
-// .setParameter("name", name);
-//
-// List results = query.list();
-//
-// if (results.size() != 0)
-// {
-// throw new IdentityException("Relationship already present");
-// }
-
HibernateIdentityObjectRelationship relationship = null;
if (name != null)
@@ -922,7 +909,10 @@
try
{
- getHibernateSession(ctx).persist(relationship);
+ Session session = getHibernateSession(ctx);
+ session.persist(relationship);
+ session.flush();
+
}
catch (HibernateException e)
{
14 years, 7 months
JBoss Identity SVN: r821 - in idm/trunk: assembly and 21 other directories.
by jboss-identity-commits@lists.jboss.org
Author: bdaw
Date: 2009-10-07 07:53:31 -0400 (Wed, 07 Oct 2009)
New Revision: 821
Added:
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/cache/
Removed:
idm/trunk/idm-hibernate/src/main/java/org/jboss/identity/idm/impl/model/hibernate/MaterializedBlobType.java
Modified:
idm/trunk/assembly/pom.xml
idm/trunk/example/auth-simple/pom.xml
idm/trunk/example/auth/pom.xml
idm/trunk/example/simple/pom.xml
idm/trunk/idm-api/pom.xml
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/event/IdentityEvent.java
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/event/IdentityEventBroadcaster.java
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/event/IdentityEventEmitter.java
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/event/IdentityEventListener.java
idm/trunk/idm-auth/pom.xml
idm/trunk/idm-cache/pom.xml
idm/trunk/idm-common/pom.xml
idm/trunk/idm-core/pom.xml
idm/trunk/idm-hibernate/pom.xml
idm/trunk/idm-hibernate/src/main/java/org/jboss/identity/idm/impl/model/hibernate/HibernateIdentityObject.java
idm/trunk/idm-hibernate/src/main/java/org/jboss/identity/idm/impl/model/hibernate/HibernateIdentityObjectBinaryAttribute.java
idm/trunk/idm-hibernate/src/main/java/org/jboss/identity/idm/impl/model/hibernate/HibernateIdentityObjectBinaryAttributeValue.java
idm/trunk/idm-hibernate/src/main/java/org/jboss/identity/idm/impl/model/hibernate/HibernateIdentityObjectCredential.java
idm/trunk/idm-hibernate/src/main/java/org/jboss/identity/idm/impl/model/hibernate/HibernateIdentityObjectCredentialType.java
idm/trunk/idm-hibernate/src/main/java/org/jboss/identity/idm/impl/model/hibernate/HibernateIdentityObjectRelationship.java
idm/trunk/idm-hibernate/src/main/java/org/jboss/identity/idm/impl/model/hibernate/HibernateIdentityObjectRelationshipName.java
idm/trunk/idm-hibernate/src/main/java/org/jboss/identity/idm/impl/model/hibernate/HibernateIdentityObjectRelationshipType.java
idm/trunk/idm-hibernate/src/main/java/org/jboss/identity/idm/impl/model/hibernate/HibernateIdentityObjectTextAttribute.java
idm/trunk/idm-hibernate/src/main/java/org/jboss/identity/idm/impl/model/hibernate/HibernateIdentityObjectType.java
idm/trunk/idm-hibernate/src/main/java/org/jboss/identity/idm/impl/model/hibernate/HibernateRealm.java
idm/trunk/idm-hibernate/src/main/java/org/jboss/identity/idm/impl/store/hibernate/HibernateIdentityStoreImpl.java
idm/trunk/idm-ldap/pom.xml
idm/trunk/idm-spi/pom.xml
idm/trunk/idm-testsuite/pom.xml
idm/trunk/idm-testsuite/src/test/resources/log4j.xml
idm/trunk/integration/deployer/pom.xml
idm/trunk/integration/jboss5/pom.xml
idm/trunk/integration/pom.xml
idm/trunk/parent/pom.xml
idm/trunk/pom.xml
Log:
- fix hibernate db schema naming
- small perf improvement in hibernate store
Modified: idm/trunk/assembly/pom.xml
===================================================================
--- idm/trunk/assembly/pom.xml 2009-10-06 22:26:30 UTC (rev 820)
+++ idm/trunk/assembly/pom.xml 2009-10-07 11:53:31 UTC (rev 821)
@@ -4,14 +4,14 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.jboss.identity.idm</groupId>
<artifactId>jbossidm</artifactId>
- <version>1.0.0.Beta2</version>
+ <version>1.0.0-BETA3-SNAPSHOT</version>
<packaging>pom</packaging>
<name>JBoss Identity IDM Assembly </name>
<parent>
<groupId>org.jboss.identity.idm</groupId>
<artifactId>idm-parent</artifactId>
- <version>1.0.0.Beta2</version>
+ <version>1.0.0-BETA3-SNAPSHOT</version>
<relativePath>../parent</relativePath>
</parent>
Modified: idm/trunk/example/auth/pom.xml
===================================================================
--- idm/trunk/example/auth/pom.xml 2009-10-06 22:26:30 UTC (rev 820)
+++ idm/trunk/example/auth/pom.xml 2009-10-07 11:53:31 UTC (rev 821)
@@ -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.idm.example</groupId>
- <version>1.0.0.Beta2</version>
+ <version>1.0.0-BETA3-SNAPSHOT</version>
<artifactId>example-auth</artifactId>
<packaging>jar</packaging>
<name>Example - JEE authentication</name>
Modified: idm/trunk/example/auth-simple/pom.xml
===================================================================
--- idm/trunk/example/auth-simple/pom.xml 2009-10-06 22:26:30 UTC (rev 820)
+++ idm/trunk/example/auth-simple/pom.xml 2009-10-07 11:53:31 UTC (rev 821)
@@ -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.idm.example</groupId>
- <version>1.0.0.Beta2</version>
+ <version>1.0.0-BETA3-SNAPSHOT</version>
<artifactId>example-auth-simple</artifactId>
<packaging>jar</packaging>
<name>Example - JEE authentication (using deployer)</name>
Modified: idm/trunk/example/simple/pom.xml
===================================================================
--- idm/trunk/example/simple/pom.xml 2009-10-06 22:26:30 UTC (rev 820)
+++ idm/trunk/example/simple/pom.xml 2009-10-07 11:53:31 UTC (rev 821)
@@ -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.idm.example</groupId>
- <version>1.0.0.Beta2</version>
+ <version>1.0.0-BETA3-SNAPSHOT</version>
<artifactId>example-simple</artifactId>
<packaging>jar</packaging>
<name>Example - Simple JBoss Identity IDM Maven2 project</name>
Modified: idm/trunk/idm-api/pom.xml
===================================================================
--- idm/trunk/idm-api/pom.xml 2009-10-06 22:26:30 UTC (rev 820)
+++ idm/trunk/idm-api/pom.xml 2009-10-07 11:53:31 UTC (rev 821)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.jboss.identity.idm</groupId>
<artifactId>idm-parent</artifactId>
- <version>1.0.0.Beta2</version>
+ <version>1.0.0-BETA3-SNAPSHOT</version>
<relativePath>../parent</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/event/IdentityEvent.java
===================================================================
--- idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/event/IdentityEvent.java 2009-10-06 22:26:30 UTC (rev 820)
+++ idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/event/IdentityEvent.java 2009-10-07 11:53:31 UTC (rev 821)
@@ -1,31 +1,31 @@
-/*
-* 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.api.event;
-
-/**
- * @author boleslaw dot dawidowicz at redhat anotherdot com
- * @version : 0.1 $
- */
-public class IdentityEvent
-{
-}
\ No newline at end of file
+///*
+//* 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.api.event;
+//
+///**
+// * @author boleslaw dot dawidowicz at redhat anotherdot com
+// * @version : 0.1 $
+// */
+//public class IdentityEvent
+//{
+//}
\ No newline at end of file
Modified: idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/event/IdentityEventBroadcaster.java
===================================================================
--- idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/event/IdentityEventBroadcaster.java 2009-10-06 22:26:30 UTC (rev 820)
+++ idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/event/IdentityEventBroadcaster.java 2009-10-07 11:53:31 UTC (rev 821)
@@ -1,41 +1,41 @@
-/******************************************************************************
- * 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.api.event;
-
-import org.jboss.identity.idm.api.event.IdentityEvent;
-
-/**
- * Interface that allow event firing.
- *
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public interface IdentityEventBroadcaster
-{
- /**
- * Fire an event.
- *
- * @param event the event to fire
- */
- void fireEvent(IdentityEvent event);
-}
\ No newline at end of file
+///******************************************************************************
+// * 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.api.event;
+//
+//import org.jboss.identity.idm.api.event.IdentityEvent;
+//
+///**
+// * Interface that allow event firing.
+// *
+// * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+// * @version $Revision: 1.1 $
+// */
+//public interface IdentityEventBroadcaster
+//{
+// /**
+// * Fire an event.
+// *
+// * @param event the event to fire
+// */
+// void fireEvent(IdentityEvent event);
+//}
\ No newline at end of file
Modified: idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/event/IdentityEventEmitter.java
===================================================================
--- idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/event/IdentityEventEmitter.java 2009-10-06 22:26:30 UTC (rev 820)
+++ idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/event/IdentityEventEmitter.java 2009-10-07 11:53:31 UTC (rev 821)
@@ -1,48 +1,48 @@
-/******************************************************************************
- * 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.api.event;
-
-import org.jboss.identity.idm.api.event.IdentityEventListener;
-
-/**
- * Interface that allows registration management of identity event listeners.
- *
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public interface IdentityEventEmitter
-{
- /**
- * Add a listener.
- *
- * @param listener the listener for all identity events
- */
- void addListener(IdentityEventListener listener);
-
- /**
- * Remove a listener.
- *
- * @param listener the listener
- */
- void removeListener(IdentityEventListener listener);
-}
\ No newline at end of file
+///******************************************************************************
+// * 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.api.event;
+//
+//import org.jboss.identity.idm.api.event.IdentityEventListener;
+//
+///**
+// * Interface that allows registration management of identity event listeners.
+// *
+// * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+// * @version $Revision: 1.1 $
+// */
+//public interface IdentityEventEmitter
+//{
+// /**
+// * Add a listener.
+// *
+// * @param listener the listener for all identity events
+// */
+// void addListener(IdentityEventListener listener);
+//
+// /**
+// * Remove a listener.
+// *
+// * @param listener the listener
+// */
+// void removeListener(IdentityEventListener listener);
+//}
\ No newline at end of file
Modified: idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/event/IdentityEventListener.java
===================================================================
--- idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/event/IdentityEventListener.java 2009-10-06 22:26:30 UTC (rev 820)
+++ idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/event/IdentityEventListener.java 2009-10-07 11:53:31 UTC (rev 821)
@@ -1,41 +1,41 @@
-/******************************************************************************
- * 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.api.event;
-
-import org.jboss.identity.idm.api.event.IdentityEvent;
-
-/**
- * An event listener.
- *
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public interface IdentityEventListener
-{
- /**
- * Fire event on the listener.
- *
- * @param event the identity event
- */
- void onEvent(IdentityEvent event);
-}
\ No newline at end of file
+///******************************************************************************
+// * 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.api.event;
+//
+//import org.jboss.identity.idm.api.event.IdentityEvent;
+//
+///**
+// * An event listener.
+// *
+// * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+// * @version $Revision: 1.1 $
+// */
+//public interface IdentityEventListener
+//{
+// /**
+// * Fire event on the listener.
+// *
+// * @param event the identity event
+// */
+// void onEvent(IdentityEvent event);
+//}
\ No newline at end of file
Modified: idm/trunk/idm-auth/pom.xml
===================================================================
--- idm/trunk/idm-auth/pom.xml 2009-10-06 22:26:30 UTC (rev 820)
+++ idm/trunk/idm-auth/pom.xml 2009-10-07 11:53:31 UTC (rev 821)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.jboss.identity.idm</groupId>
<artifactId>idm-parent</artifactId>
- <version>1.0.0.Beta2</version>
+ <version>1.0.0-BETA3-SNAPSHOT</version>
<relativePath>../parent</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: idm/trunk/idm-cache/pom.xml
===================================================================
--- idm/trunk/idm-cache/pom.xml 2009-10-06 22:26:30 UTC (rev 820)
+++ idm/trunk/idm-cache/pom.xml 2009-10-07 11:53:31 UTC (rev 821)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.jboss.identity.idm</groupId>
<artifactId>idm-parent</artifactId>
- <version>1.0.0.Beta2</version>
+ <version>1.0.0-BETA3-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-10-06 22:26:30 UTC (rev 820)
+++ idm/trunk/idm-common/pom.xml 2009-10-07 11:53:31 UTC (rev 821)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.jboss.identity.idm</groupId>
<artifactId>idm-parent</artifactId>
- <version>1.0.0.Beta2</version>
+ <version>1.0.0-BETA3-SNAPSHOT</version>
<relativePath>../parent</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: idm/trunk/idm-core/pom.xml
===================================================================
--- idm/trunk/idm-core/pom.xml 2009-10-06 22:26:30 UTC (rev 820)
+++ idm/trunk/idm-core/pom.xml 2009-10-07 11:53:31 UTC (rev 821)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.jboss.identity.idm</groupId>
<artifactId>idm-parent</artifactId>
- <version>1.0.0.Beta2</version>
+ <version>1.0.0-BETA3-SNAPSHOT</version>
<relativePath>../parent</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: idm/trunk/idm-hibernate/pom.xml
===================================================================
--- idm/trunk/idm-hibernate/pom.xml 2009-10-06 22:26:30 UTC (rev 820)
+++ idm/trunk/idm-hibernate/pom.xml 2009-10-07 11:53:31 UTC (rev 821)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.jboss.identity.idm</groupId>
<artifactId>idm-parent</artifactId>
- <version>1.0.0.Beta2</version>
+ <version>1.0.0-BETA3-SNAPSHOT</version>
<relativePath>../parent</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: idm/trunk/idm-hibernate/src/main/java/org/jboss/identity/idm/impl/model/hibernate/HibernateIdentityObject.java
===================================================================
--- idm/trunk/idm-hibernate/src/main/java/org/jboss/identity/idm/impl/model/hibernate/HibernateIdentityObject.java 2009-10-06 22:26:30 UTC (rev 820)
+++ idm/trunk/idm-hibernate/src/main/java/org/jboss/identity/idm/impl/model/hibernate/HibernateIdentityObject.java 2009-10-07 11:53:31 UTC (rev 821)
@@ -22,29 +22,30 @@
package org.jboss.identity.idm.impl.model.hibernate;
+import org.jboss.identity.idm.common.exception.PolicyValidationException;
+import org.jboss.identity.idm.spi.model.IdentityObject;
+import org.jboss.identity.idm.spi.model.IdentityObjectCredentialType;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
-import java.util.HashMap;
-import java.util.Collections;
-import java.util.Collection;
+import javax.persistence.CascadeType;
import javax.persistence.Column;
-import javax.persistence.CascadeType;
import javax.persistence.Entity;
+import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.JoinTable;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
-import javax.persistence.FetchType;
import javax.persistence.UniqueConstraint;
-import javax.persistence.JoinColumn;
-import javax.persistence.JoinTable;
-import org.jboss.identity.idm.common.exception.PolicyValidationException;
-import org.jboss.identity.idm.spi.model.IdentityObject;
-import org.jboss.identity.idm.spi.model.IdentityObjectCredentialType;
import org.hibernate.annotations.Cascade;
import org.hibernate.annotations.CollectionOfElements;
@@ -76,6 +77,7 @@
@Id
@GeneratedValue
+ @Column(name = "ID")
private Long id;
@Column(name = "NAME", nullable = false)
@@ -100,7 +102,7 @@
@CollectionOfElements
@JoinTable(name = "identity_obj_properties", joinColumns = @JoinColumn(name = "IDENTITY_OBJ_ID", nullable=false))
- @org.hibernate.annotations.MapKey(columns = @Column(name = "prop_key", nullable=false))
+ @org.hibernate.annotations.MapKey(columns = @Column(name = "PROP_KEY", nullable=false))
@Column(name = "PROPERTY")
private Map<String, String> properties = new HashMap<String, String>();
Modified: idm/trunk/idm-hibernate/src/main/java/org/jboss/identity/idm/impl/model/hibernate/HibernateIdentityObjectBinaryAttribute.java
===================================================================
--- idm/trunk/idm-hibernate/src/main/java/org/jboss/identity/idm/impl/model/hibernate/HibernateIdentityObjectBinaryAttribute.java 2009-10-06 22:26:30 UTC (rev 820)
+++ idm/trunk/idm-hibernate/src/main/java/org/jboss/identity/idm/impl/model/hibernate/HibernateIdentityObjectBinaryAttribute.java 2009-10-07 11:53:31 UTC (rev 821)
@@ -22,19 +22,15 @@
package org.jboss.identity.idm.impl.model.hibernate;
-import org.hibernate.annotations.CollectionOfElements;
+import java.util.HashSet;
+import java.util.Set;
+import javax.persistence.CascadeType;
import javax.persistence.Entity;
-import javax.persistence.Table;
-import javax.persistence.PrimaryKeyJoinColumn;
-import javax.persistence.OneToMany;
-import javax.persistence.Column;
-import javax.persistence.JoinColumn;
import javax.persistence.FetchType;
-import javax.persistence.CascadeType;
-import java.util.Set;
-import java.util.HashSet;
-import java.util.Collections;
+import javax.persistence.OneToMany;
+import javax.persistence.PrimaryKeyJoinColumn;
+import javax.persistence.Table;
/**
* @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
Modified: idm/trunk/idm-hibernate/src/main/java/org/jboss/identity/idm/impl/model/hibernate/HibernateIdentityObjectBinaryAttributeValue.java
===================================================================
--- idm/trunk/idm-hibernate/src/main/java/org/jboss/identity/idm/impl/model/hibernate/HibernateIdentityObjectBinaryAttributeValue.java 2009-10-06 22:26:30 UTC (rev 820)
+++ idm/trunk/idm-hibernate/src/main/java/org/jboss/identity/idm/impl/model/hibernate/HibernateIdentityObjectBinaryAttributeValue.java 2009-10-07 11:53:31 UTC (rev 821)
@@ -22,20 +22,12 @@
package org.jboss.identity.idm.impl.model.hibernate;
-import org.hibernate.annotations.CollectionOfElements;
-
-import javax.persistence.Entity;
-import javax.persistence.Table;
-import javax.persistence.PrimaryKeyJoinColumn;
-import javax.persistence.OneToMany;
import javax.persistence.Column;
-import javax.persistence.JoinColumn;
-import javax.persistence.Id;
+import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
import javax.persistence.Lob;
-import java.util.Set;
-import java.util.HashSet;
-import java.util.Collections;
+import javax.persistence.Table;
/**
* @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
@@ -50,10 +42,11 @@
@Id
@GeneratedValue
+ @Column(name = "ID")
private Long id;
@Lob
- @Column(length = 10240000)
+ @Column(length = 10240000, name="VALUE")
private byte[] value;
public HibernateIdentityObjectBinaryAttributeValue()
Modified: idm/trunk/idm-hibernate/src/main/java/org/jboss/identity/idm/impl/model/hibernate/HibernateIdentityObjectCredential.java
===================================================================
--- idm/trunk/idm-hibernate/src/main/java/org/jboss/identity/idm/impl/model/hibernate/HibernateIdentityObjectCredential.java 2009-10-06 22:26:30 UTC (rev 820)
+++ idm/trunk/idm-hibernate/src/main/java/org/jboss/identity/idm/impl/model/hibernate/HibernateIdentityObjectCredential.java 2009-10-07 11:53:31 UTC (rev 821)
@@ -23,23 +23,24 @@
package org.jboss.identity.idm.impl.model.hibernate;
import org.jboss.identity.idm.spi.model.IdentityObjectCredential;
-import org.hibernate.annotations.CollectionOfElements;
-import org.hibernate.annotations.Type;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.persistence.Column;
import javax.persistence.Entity;
-import javax.persistence.Table;
+import javax.persistence.FetchType;
+import javax.persistence.GeneratedValue;
import javax.persistence.Id;
-import javax.persistence.GeneratedValue;
-import javax.persistence.Column;
-import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
+import javax.persistence.JoinTable;
+import javax.persistence.Lob;
import javax.persistence.ManyToOne;
-import javax.persistence.JoinTable;
+import javax.persistence.Table;
import javax.persistence.UniqueConstraint;
-import javax.persistence.Lob;
-import java.util.Map;
-import java.util.HashMap;
+import org.hibernate.annotations.CollectionOfElements;
+
/**
* @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
* @version : 0.1 $
@@ -55,6 +56,7 @@
@Id
@GeneratedValue
+ @Column(name = "ID")
private Long id;
@ManyToOne(fetch = FetchType.EAGER)
@@ -74,7 +76,7 @@
@CollectionOfElements
@JoinTable(name = "jbid_io_creden_props", joinColumns = @JoinColumn(name = "CREDENTIAL_ID", nullable = false))
- @org.hibernate.annotations.MapKey(columns = @Column(name = "prop_key", nullable=false))
+ @org.hibernate.annotations.MapKey(columns = @Column(name = "PROP_KEY", nullable=false))
@Column(name = "PROPERTY")
private Map<String, String> properties = new HashMap<String, String>();
Modified: idm/trunk/idm-hibernate/src/main/java/org/jboss/identity/idm/impl/model/hibernate/HibernateIdentityObjectCredentialType.java
===================================================================
--- idm/trunk/idm-hibernate/src/main/java/org/jboss/identity/idm/impl/model/hibernate/HibernateIdentityObjectCredentialType.java 2009-10-06 22:26:30 UTC (rev 820)
+++ idm/trunk/idm-hibernate/src/main/java/org/jboss/identity/idm/impl/model/hibernate/HibernateIdentityObjectCredentialType.java 2009-10-07 11:53:31 UTC (rev 821)
@@ -41,6 +41,7 @@
@Id
@GeneratedValue
+ @Column(name = "ID")
private Long id;
@Column(name = "NAME", unique = true)
Modified: idm/trunk/idm-hibernate/src/main/java/org/jboss/identity/idm/impl/model/hibernate/HibernateIdentityObjectRelationship.java
===================================================================
--- idm/trunk/idm-hibernate/src/main/java/org/jboss/identity/idm/impl/model/hibernate/HibernateIdentityObjectRelationship.java 2009-10-06 22:26:30 UTC (rev 820)
+++ idm/trunk/idm-hibernate/src/main/java/org/jboss/identity/idm/impl/model/hibernate/HibernateIdentityObjectRelationship.java 2009-10-07 11:53:31 UTC (rev 821)
@@ -22,34 +22,31 @@
package org.jboss.identity.idm.impl.model.hibernate;
+import org.jboss.identity.idm.spi.model.IdentityObjectRelationship;
+import org.jboss.identity.idm.spi.model.IdentityObjectRelationshipType;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.persistence.Column;
import javax.persistence.Entity;
+import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.JoinTable;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
-import javax.persistence.NamedQueries;
-import javax.persistence.NamedQuery;
-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 $
*/
@Entity
-@Table(name="jbid_io_rel", uniqueConstraints = {@UniqueConstraint(columnNames = {"NAME", "TYPE", "FROM_IDENTITY", "TO_IDENTITY"})})
+@Table(name="jbid_io_rel", uniqueConstraints = {@UniqueConstraint(columnNames = {"NAME", "REL_TYPE", "FROM_IDENTITY", "TO_IDENTITY"})})
public class HibernateIdentityObjectRelationship implements IdentityObjectRelationship
{
public static final String findIdentityObjectRelationshipsByType =
@@ -61,6 +58,7 @@
@Id
@GeneratedValue
+ @Column(name = "ID")
private Long id;
@ManyToOne
@@ -68,7 +66,7 @@
private HibernateIdentityObjectRelationshipName name;
@ManyToOne
- @JoinColumn(nullable = false, name="TYPE")
+ @JoinColumn(nullable = false, name="REL_TYPE")
private HibernateIdentityObjectRelationshipType type;
@ManyToOne(fetch = FetchType.EAGER)
@@ -81,7 +79,7 @@
@CollectionOfElements
@JoinTable(name = "jbid_io_rel_props", joinColumns = @JoinColumn(name = "REALATIONSHIP_ID", nullable=false))
- @org.hibernate.annotations.MapKey(columns = @Column(name = "prop_key", nullable=false))
+ @org.hibernate.annotations.MapKey(columns = @Column(name = "PROP_KEY", nullable=false))
@Column(name = "PROPERTY")
private Map<String, String> properties = new HashMap<String, String>();
Modified: idm/trunk/idm-hibernate/src/main/java/org/jboss/identity/idm/impl/model/hibernate/HibernateIdentityObjectRelationshipName.java
===================================================================
--- idm/trunk/idm-hibernate/src/main/java/org/jboss/identity/idm/impl/model/hibernate/HibernateIdentityObjectRelationshipName.java 2009-10-06 22:26:30 UTC (rev 820)
+++ idm/trunk/idm-hibernate/src/main/java/org/jboss/identity/idm/impl/model/hibernate/HibernateIdentityObjectRelationshipName.java 2009-10-07 11:53:31 UTC (rev 821)
@@ -22,22 +22,21 @@
package org.jboss.identity.idm.impl.model.hibernate;
-import org.hibernate.annotations.CollectionOfElements;
+import java.util.HashMap;
+import java.util.Map;
-import javax.persistence.Table;
+import javax.persistence.Column;
import javax.persistence.Entity;
-import javax.persistence.Column;
-import javax.persistence.NamedQueries;
-import javax.persistence.NamedQuery;
+import javax.persistence.GeneratedValue;
import javax.persistence.Id;
-import javax.persistence.GeneratedValue;
+import javax.persistence.JoinColumn;
+import javax.persistence.JoinTable;
import javax.persistence.ManyToOne;
-import javax.persistence.JoinColumn;
+import javax.persistence.Table;
import javax.persistence.UniqueConstraint;
-import javax.persistence.JoinTable;
-import java.util.Map;
-import java.util.HashMap;
+import org.hibernate.annotations.CollectionOfElements;
+
/**
* @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
* @version : 0.1 $
@@ -79,6 +78,7 @@
@Id
@GeneratedValue
+ @Column(name = "ID")
private Long id;
@Column(nullable = false, unique = true, name = "NAME")
@@ -90,7 +90,7 @@
@CollectionOfElements
@JoinTable(name = "jbid_io_rel_name_props", joinColumns = @JoinColumn(name = "REALATIONSHIP_NAME_ID", nullable=false))
- @org.hibernate.annotations.MapKey(columns = @Column(name = "prop_key", nullable=false))
+ @org.hibernate.annotations.MapKey(columns = @Column(name = "PROP_KEY", nullable=false))
@Column(name = "PROPERTY")
private Map<String, String> properties = new HashMap<String, String>();
Modified: idm/trunk/idm-hibernate/src/main/java/org/jboss/identity/idm/impl/model/hibernate/HibernateIdentityObjectRelationshipType.java
===================================================================
--- idm/trunk/idm-hibernate/src/main/java/org/jboss/identity/idm/impl/model/hibernate/HibernateIdentityObjectRelationshipType.java 2009-10-06 22:26:30 UTC (rev 820)
+++ idm/trunk/idm-hibernate/src/main/java/org/jboss/identity/idm/impl/model/hibernate/HibernateIdentityObjectRelationshipType.java 2009-10-07 11:53:31 UTC (rev 821)
@@ -22,16 +22,14 @@
package org.jboss.identity.idm.impl.model.hibernate;
+import org.jboss.identity.idm.spi.model.IdentityObjectRelationshipType;
+
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
-import javax.persistence.NamedQueries;
-import javax.persistence.NamedQuery;
-import org.jboss.identity.idm.spi.model.IdentityObjectRelationshipType;
-
/**
* @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
* @version : 0.1 $
@@ -53,9 +51,10 @@
@Id
@GeneratedValue
+ @Column(name = "ID")
private Long id;
- @Column(nullable = false, unique = true)
+ @Column(nullable = false, unique = true, name="NAME")
private String name;
public HibernateIdentityObjectRelationshipType()
Modified: idm/trunk/idm-hibernate/src/main/java/org/jboss/identity/idm/impl/model/hibernate/HibernateIdentityObjectTextAttribute.java
===================================================================
--- idm/trunk/idm-hibernate/src/main/java/org/jboss/identity/idm/impl/model/hibernate/HibernateIdentityObjectTextAttribute.java 2009-10-06 22:26:30 UTC (rev 820)
+++ idm/trunk/idm-hibernate/src/main/java/org/jboss/identity/idm/impl/model/hibernate/HibernateIdentityObjectTextAttribute.java 2009-10-07 11:53:31 UTC (rev 821)
@@ -27,9 +27,10 @@
import java.util.Set;
import javax.persistence.Entity;
+import javax.persistence.JoinColumn;
+import javax.persistence.JoinTable;
+import javax.persistence.PrimaryKeyJoinColumn;
import javax.persistence.Table;
-import javax.persistence.PrimaryKeyJoinColumn;
-import javax.persistence.OneToMany;
import org.hibernate.annotations.CollectionOfElements;
@@ -44,6 +45,7 @@
{
@CollectionOfElements
+ @JoinTable(name = "jbid_io_attr_text_values", joinColumns = @JoinColumn(name = "value"))
private Set<String> values = new HashSet<String>();
public HibernateIdentityObjectTextAttribute()
Modified: idm/trunk/idm-hibernate/src/main/java/org/jboss/identity/idm/impl/model/hibernate/HibernateIdentityObjectType.java
===================================================================
--- idm/trunk/idm-hibernate/src/main/java/org/jboss/identity/idm/impl/model/hibernate/HibernateIdentityObjectType.java 2009-10-06 22:26:30 UTC (rev 820)
+++ idm/trunk/idm-hibernate/src/main/java/org/jboss/identity/idm/impl/model/hibernate/HibernateIdentityObjectType.java 2009-10-07 11:53:31 UTC (rev 821)
@@ -52,9 +52,10 @@
@Id
@GeneratedValue
+ @Column(name = "ID")
private Long id;
- @Column(nullable = false, unique = true)
+ @Column(nullable = false, unique = true, name="NAME")
private String name;
Modified: idm/trunk/idm-hibernate/src/main/java/org/jboss/identity/idm/impl/model/hibernate/HibernateRealm.java
===================================================================
--- idm/trunk/idm-hibernate/src/main/java/org/jboss/identity/idm/impl/model/hibernate/HibernateRealm.java 2009-10-06 22:26:30 UTC (rev 820)
+++ idm/trunk/idm-hibernate/src/main/java/org/jboss/identity/idm/impl/model/hibernate/HibernateRealm.java 2009-10-07 11:53:31 UTC (rev 821)
@@ -22,23 +22,20 @@
package org.jboss.identity.idm.impl.model.hibernate;
-import org.hibernate.annotations.CollectionOfElements;
+import java.util.HashMap;
+import java.util.Map;
+import javax.persistence.Column;
import javax.persistence.Entity;
-import javax.persistence.Table;
-import javax.persistence.UniqueConstraint;
-import javax.persistence.Id;
import javax.persistence.GeneratedValue;
-import javax.persistence.Column;
-import javax.persistence.NamedQueries;
-import javax.persistence.NamedQuery;
-import javax.persistence.JoinTable;
+import javax.persistence.Id;
import javax.persistence.JoinColumn;
-import javax.persistence.AttributeOverride;
-import javax.persistence.MapKey;
-import java.util.Map;
-import java.util.HashMap;
+import javax.persistence.JoinTable;
+import javax.persistence.Table;
+import javax.persistence.UniqueConstraint;
+import org.hibernate.annotations.CollectionOfElements;
+
/**
* @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
* @version : 0.1 $
@@ -53,6 +50,7 @@
@Id
@GeneratedValue
+ @Column(name = "ID")
private Long id;
@Column(name = "NAME", nullable = false)
Deleted: idm/trunk/idm-hibernate/src/main/java/org/jboss/identity/idm/impl/model/hibernate/MaterializedBlobType.java
===================================================================
--- idm/trunk/idm-hibernate/src/main/java/org/jboss/identity/idm/impl/model/hibernate/MaterializedBlobType.java 2009-10-06 22:26:30 UTC (rev 820)
+++ idm/trunk/idm-hibernate/src/main/java/org/jboss/identity/idm/impl/model/hibernate/MaterializedBlobType.java 2009-10-07 11:53:31 UTC (rev 821)
@@ -1,61 +0,0 @@
-/*
-* JBoss, a division of Red Hat
-* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-
-package org.jboss.identity.idm.impl.model.hibernate;
-
-import org.hibernate.type.AbstractBynaryType;
-
-import java.sql.Types;
-
-/**
- * {@inheritDoc}
- *
- * @author Steve Ebersole
- */
-public class MaterializedBlobType extends AbstractBynaryType
-{
-
- public int sqlType()
- {
- return Types.BLOB;
- }
-
- public String getName()
- {
- return "materialized-blob";
- }
-
- public Class getReturnedClass()
- {
- return byte[].class;
- }
-
- protected Object toExternalFormat(byte[] bytes)
- {
- return bytes;
- }
-
- protected byte[] toInternalFormat(Object bytes)
- {
- return ( byte[] ) bytes;
- }
-}
\ No newline at end of file
Modified: idm/trunk/idm-hibernate/src/main/java/org/jboss/identity/idm/impl/store/hibernate/HibernateIdentityStoreImpl.java
===================================================================
--- idm/trunk/idm-hibernate/src/main/java/org/jboss/identity/idm/impl/store/hibernate/HibernateIdentityStoreImpl.java 2009-10-06 22:26:30 UTC (rev 820)
+++ idm/trunk/idm-hibernate/src/main/java/org/jboss/identity/idm/impl/store/hibernate/HibernateIdentityStoreImpl.java 2009-10-07 11:53:31 UTC (rev 821)
@@ -884,19 +884,19 @@
}
}
- org.hibernate.Query query = getHibernateSession(ctx).createQuery(QUERY_RELATIONSHIP_BY_FROM_TO_TYPE_NAME)
- .setParameter("fromIO", fromIO)
- .setParameter("toIO", toIO)
- .setParameter("typeName", type.getName())
- .setParameter("name", name);
+// org.hibernate.Query query = getHibernateSession(ctx).createQuery(QUERY_RELATIONSHIP_BY_FROM_TO_TYPE_NAME)
+// .setParameter("fromIO", fromIO)
+// .setParameter("toIO", toIO)
+// .setParameter("typeName", type.getName())
+// .setParameter("name", name);
+//
+// List results = query.list();
+//
+// if (results.size() != 0)
+// {
+// throw new IdentityException("Relationship already present");
+// }
- List results = query.list();
-
- if (results.size() != 0)
- {
- throw new IdentityException("Relationship already present");
- }
-
HibernateIdentityObjectRelationship relationship = null;
if (name != null)
@@ -919,8 +919,16 @@
relationship = new HibernateIdentityObjectRelationship(type, fromIO, toIO);
}
- getHibernateSession(ctx).persist(relationship);
+ try
+ {
+ getHibernateSession(ctx).persist(relationship);
+ }
+ catch (HibernateException e)
+ {
+ throw new IdentityException("Cannot create relationship: ", e);
+ }
+
return relationship;
}
@@ -974,7 +982,7 @@
if (results == null)
{
- throw new IdentityException("Relationship already present");
+ throw new IdentityException("Relationship not present in the store");
}
HibernateIdentityObjectRelationship relationship = (HibernateIdentityObjectRelationship)results.iterator().next();
Modified: idm/trunk/idm-ldap/pom.xml
===================================================================
--- idm/trunk/idm-ldap/pom.xml 2009-10-06 22:26:30 UTC (rev 820)
+++ idm/trunk/idm-ldap/pom.xml 2009-10-07 11:53:31 UTC (rev 821)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.jboss.identity.idm</groupId>
<artifactId>idm-parent</artifactId>
- <version>1.0.0.Beta2</version>
+ <version>1.0.0-BETA3-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-10-06 22:26:30 UTC (rev 820)
+++ idm/trunk/idm-spi/pom.xml 2009-10-07 11:53:31 UTC (rev 821)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.jboss.identity.idm</groupId>
<artifactId>idm-parent</artifactId>
- <version>1.0.0.Beta2</version>
+ <version>1.0.0-BETA3-SNAPSHOT</version>
<relativePath>../parent</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: idm/trunk/idm-testsuite/pom.xml
===================================================================
--- idm/trunk/idm-testsuite/pom.xml 2009-10-06 22:26:30 UTC (rev 820)
+++ idm/trunk/idm-testsuite/pom.xml 2009-10-07 11:53:31 UTC (rev 821)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.jboss.identity.idm</groupId>
<artifactId>idm-parent</artifactId>
- <version>1.0.0.Beta2</version>
+ <version>1.0.0-BETA3-SNAPSHOT</version>
<relativePath>../parent</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: idm/trunk/idm-testsuite/src/test/resources/log4j.xml
===================================================================
--- idm/trunk/idm-testsuite/src/test/resources/log4j.xml 2009-10-06 22:26:30 UTC (rev 820)
+++ idm/trunk/idm-testsuite/src/test/resources/log4j.xml 2009-10-07 11:53:31 UTC (rev 821)
@@ -1,32 +1,32 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+ <?xml version="1.0" encoding="UTF-8"?>
+ <!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
-<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
- <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
- <layout class="org.apache.log4j.PatternLayout">
- <param name="ConversionPattern"
- value="[%d{dd/MM/yy hh:mm:ss:sss z}] %5p %c{2}: %m%n" />
- </layout>
- </appender>
+ <log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
+ <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
+ <layout class="org.apache.log4j.PatternLayout">
+ <param name="ConversionPattern"
+ value="[%d{dd/MM/yy hh:mm:ss:sss z}] %5p %c{2}: %m%n" />
+ </layout>
+ </appender>
- <appender name="ASYNC" class="org.apache.log4j.AsyncAppender">
- <appender-ref ref="CONSOLE"/>
- <appender-ref ref="FILE"/>
- </appender>
+ <appender name="ASYNC" class="org.apache.log4j.AsyncAppender">
+ <appender-ref ref="CONSOLE"/>
+ <appender-ref ref="FILE"/>
+ </appender>
- <appender name="FILE" class="org.apache.log4j.RollingFileAppender">
- <param name="File" value="log4j-output.log"/>
- <param name="MaxFileSize" value="1MB"/>
- <param name="MaxBackupIndex" value="100"/>
- <layout class="org.apache.log4j.PatternLayout">
- <param name="ConversionPattern"
- value="[%d{dd/MM/yy hh:mm:ss:sss z}] %5p %c{2}: %m%n" />
- </layout>
- </appender>
+ <appender name="FILE" class="org.apache.log4j.RollingFileAppender">
+ <param name="File" value="log4j-output.log"/>
+ <param name="MaxFileSize" value="1MB"/>
+ <param name="MaxBackupIndex" value="100"/>
+ <layout class="org.apache.log4j.PatternLayout">
+ <param name="ConversionPattern"
+ value="[%d{dd/MM/yy hh:mm:ss:sss z}] %5p %c{2}: %m%n" />
+ </layout>
+ </appender>
- <root>
- <priority value="info"/>
- <appender-ref ref="CONSOLE"/>
- <!--<appender-ref ref="ASYNC"/>-->
- </root>
+ <root>
+ <priority value="info"/>
+ <appender-ref ref="CONSOLE"/>
+ <!--<appender-ref ref="ASYNC"/>-->
+ </root>
</log4j:configuration>
\ No newline at end of file
Modified: idm/trunk/integration/deployer/pom.xml
===================================================================
--- idm/trunk/integration/deployer/pom.xml 2009-10-06 22:26:30 UTC (rev 820)
+++ idm/trunk/integration/deployer/pom.xml 2009-10-07 11:53:31 UTC (rev 821)
@@ -8,12 +8,12 @@
<groupId>org.jboss.identity.idm.integration</groupId>
<artifactId>idm-jboss5-deployer</artifactId>
<packaging>jar</packaging>
- <version>1.0.0.Beta2</version>
+ <version>1.0.0-BETA3-SNAPSHOT</version>
<parent>
<groupId>org.jboss.identity.idm</groupId>
<artifactId>idm-integration</artifactId>
- <version>1.0.0.Beta2</version>
+ <version>1.0.0-BETA3-SNAPSHOT</version>
</parent>
<properties>
Modified: idm/trunk/integration/jboss5/pom.xml
===================================================================
--- idm/trunk/integration/jboss5/pom.xml 2009-10-06 22:26:30 UTC (rev 820)
+++ idm/trunk/integration/jboss5/pom.xml 2009-10-07 11:53:31 UTC (rev 821)
@@ -8,12 +8,12 @@
<groupId>org.jboss.identity.idm.integration</groupId>
<artifactId>idm-jboss5</artifactId>
<packaging>jar</packaging>
- <version>1.0.0.Beta2</version>
+ <version>1.0.0-BETA3-SNAPSHOT</version>
<parent>
<groupId>org.jboss.identity.idm</groupId>
<artifactId>idm-integration</artifactId>
- <version>1.0.0.Beta2</version>
+ <version>1.0.0-BETA3-SNAPSHOT</version>
</parent>
<dependencies>
Modified: idm/trunk/integration/pom.xml
===================================================================
--- idm/trunk/integration/pom.xml 2009-10-06 22:26:30 UTC (rev 820)
+++ idm/trunk/integration/pom.xml 2009-10-07 11:53:31 UTC (rev 821)
@@ -13,7 +13,7 @@
<parent>
<groupId>org.jboss.identity.idm</groupId>
<artifactId>idm-parent</artifactId>
- <version>1.0.0.Beta2</version>
+ <version>1.0.0-BETA3-SNAPSHOT</version>
<relativePath>../parent/pom.xml</relativePath>
</parent>
Modified: idm/trunk/parent/pom.xml
===================================================================
--- idm/trunk/parent/pom.xml 2009-10-06 22:26:30 UTC (rev 820)
+++ idm/trunk/parent/pom.xml 2009-10-07 11:53:31 UTC (rev 821)
@@ -8,7 +8,7 @@
<groupId>org.jboss.identity.idm</groupId>
<artifactId>idm-parent</artifactId>
<packaging>pom</packaging>
- <version>1.0.0.Beta2</version>
+ <version>1.0.0-BETA3-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-10-06 22:26:30 UTC (rev 820)
+++ idm/trunk/pom.xml 2009-10-07 11:53:31 UTC (rev 821)
@@ -3,7 +3,7 @@
<parent>
<groupId>org.jboss.identity.idm</groupId>
<artifactId>idm-parent</artifactId>
- <version>1.0.0.Beta2</version>
+ <version>1.0.0-BETA3-SNAPSHOT</version>
<relativePath>parent</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
14 years, 7 months
JBoss Identity SVN: r820 - authz/trunk.
by jboss-identity-commits@lists.jboss.org
Author: sohil.shah(a)jboss.com
Date: 2009-10-06 18:26:30 -0400 (Tue, 06 Oct 2009)
New Revision: 820
Modified:
authz/trunk/pom.xml
Log:
fixing the otb build
Modified: authz/trunk/pom.xml
===================================================================
--- authz/trunk/pom.xml 2009-10-06 21:03:10 UTC (rev 819)
+++ authz/trunk/pom.xml 2009-10-06 22:26:30 UTC (rev 820)
@@ -28,7 +28,7 @@
<version.sun.jaxb>2.1.4</version.sun.jaxb>
<version.sun.jaf>1.1</version.sun.jaf>
- <version.jboss.xacml>2.0.3.SP2-SNAPSHOT</version.jboss.xacml>
+ <version.jboss.xacml>2.0.5-SNAPSHOT</version.jboss.xacml>
<version.org.drools>4.0.7</version.org.drools>
<version.org.mvel.mvel>1.3.1-java1.4</version.org.mvel.mvel>
@@ -335,6 +335,13 @@
<releases>
<enabled>true</enabled>
</releases>
+ </pluginRepository>
+ <pluginRepository>
+ <id>jboss snapshot repository</id>
+ <url>http://repository.jboss.org/maven2/</url>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
</pluginRepository>
</pluginRepositories>
14 years, 7 months
JBoss Identity SVN: r819 - authz/trunk/documentation/reference-guide/en/modules.
by jboss-identity-commits@lists.jboss.org
Author: sohil.shah(a)jboss.com
Date: 2009-10-06 17:03:10 -0400 (Tue, 06 Oct 2009)
New Revision: 819
Modified:
authz/trunk/documentation/reference-guide/en/modules/introduction.xml
Log:
introduction chapter
Modified: authz/trunk/documentation/reference-guide/en/modules/introduction.xml
===================================================================
--- authz/trunk/documentation/reference-guide/en/modules/introduction.xml 2009-10-06 19:18:36 UTC (rev 818)
+++ authz/trunk/documentation/reference-guide/en/modules/introduction.xml 2009-10-06 21:03:10 UTC (rev 819)
@@ -26,25 +26,32 @@
<sect2>
<title>Clean Separation between Security Logic and Application Logic</title>
<para>
-
+ <emphasis>Security Enforcement</emphasis> should be considered a cross cutting concern just like container managed Transactions. This allows easy customization
+ of an application's security policy without having to modify the core application codebase. This framework allows decoupling of both <emphasis>security logic</emphasis>
+ and <emphasis>security data/metadata</emphasis> from the core application.
</para>
</sect2>
<sect2>
<title>Flexibility to apply Security Logic to arbitrary Runtime information</title>
<para>
-
+ A good security framework takes into account arbitrary runtime state of an application while trying to make an access control decision. Most frameworks are satisfied
+ with merely associating roles/group/membership to protected resources. A security framework allows decision making based on other runtime state of the system like, "current time of the day",
+ "allowed range of ip addresses", "the user's age", etc. This framework uses a <ulink url="http://www.oasis-open.org/committees/tc_home.php?wg_abbrev=xacml">XACML specification</ulink> based rule engine to enable <emphasis>Rule based Access Control</emphasis>.
</para>
</sect2>
<sect2>
<title>Runtime Management of Security Policy</title>
<para>
-
+ Besides access control, policy provisioning is the other aspect of a security framework. Security policies should be provisioned dynamically without requiring system
+ restarts. It should also provide a consistent API to build provisioning tools to manage these policies. Depending upon the requirements of the application the tools can be
+ xml configuration based, GUI based, and/or integrated into central monitoring tools like JOPR and JON.
</para>
</sect2>
<sect2>
<title>A user friendly Developer API</title>
<para>
-
+ The framework exposes an easy to use component oriented developer API for portability of the security layer across multiple applications and/or multiple infrastructure layers of
+ the same application.
</para>
</sect2>
</sect1>
14 years, 7 months
JBoss Identity SVN: r818 - in authz/trunk/documentation/reference-guide/en: modules and 1 other directory.
by jboss-identity-commits@lists.jboss.org
Author: sohil.shah(a)jboss.com
Date: 2009-10-06 15:18:36 -0400 (Tue, 06 Oct 2009)
New Revision: 818
Added:
authz/trunk/documentation/reference-guide/en/modules/core-components.xml
Modified:
authz/trunk/documentation/reference-guide/en/master.xml
Log:
core-components chapter
Modified: authz/trunk/documentation/reference-guide/en/master.xml
===================================================================
--- authz/trunk/documentation/reference-guide/en/master.xml 2009-10-06 18:02:54 UTC (rev 817)
+++ authz/trunk/documentation/reference-guide/en/master.xml 2009-10-06 19:18:36 UTC (rev 818)
@@ -20,8 +20,6 @@
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="modules/getting-started.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="modules/framework.xml"/>
- <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="modules/authz-component-spec.xml"/>
- <!--
+ <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="modules/authz-component-spec.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="modules/core-components.xml"/>
- -->
</book>
\ No newline at end of file
Added: authz/trunk/documentation/reference-guide/en/modules/core-components.xml
===================================================================
--- authz/trunk/documentation/reference-guide/en/modules/core-components.xml (rev 0)
+++ authz/trunk/documentation/reference-guide/en/modules/core-components.xml 2009-10-06 19:18:36 UTC (rev 818)
@@ -0,0 +1,302 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<chapter id="core-components">
+ <chapterinfo>
+ <author>
+ <firstname>Sohil</firstname>
+ <surname>Shah</surname>
+ <email>sshah(a)redhat.com</email>
+ </author>
+ </chapterinfo>
+ <title>Core Components</title>
+ <sect1>
+ <title>Subject Components</title>
+ <sect2>
+ <title>Identity</title>
+ <para>
+ <itemizedlist>
+ <listitem>
+ <emphasis role="bold">Description: </emphasis> Represents the unique identity of the authenticated user accessing the system
+ </listitem>
+ <listitem>
+ <emphasis role="bold">Class:</emphasis> <emphasis>org.jboss.security.authz.components.subject.Identity</emphasis>
+ </listitem>
+ <listitem>
+ <emphasis role="bold">ComponentType:</emphasis><link linkend="componentTypeLogic">Logic</link>
+ </listitem>
+ <listitem>
+ <table>
+ <title>Fields</title>
+ <tgroup cols="3" align="left" colsep="1" rowset="1">
+ <colspec colname='c1'/>
+ <colspec colname='c2'/>
+ <colspec colname='c3'/>
+ <thead>
+ <row>
+ <entry align="center">Field Name</entry>
+ <entry align="center">Type</entry>
+ <entry align="center">Description</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry><emphasis role="bold">name</emphasis></entry>
+ <entry><emphasis role="bold">java.lang.String</emphasis></entry>
+ <entry>Unique id/name of the Identity</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ </listitem>
+ </itemizedlist>
+ </para>
+ </sect2>
+ <sect2>
+ <title>Roles</title>
+ <para>
+ <itemizedlist>
+ <listitem>
+ <emphasis role="bold">Description: </emphasis> represents the roles that are assigned to users/identities of the system
+ </listitem>
+ <listitem>
+ <emphasis role="bold">Class:</emphasis> <emphasis>org.jboss.security.authz.components.subject.Roles</emphasis>
+ </listitem>
+ <listitem>
+ <emphasis role="bold">ComponentType:</emphasis><link linkend="componentTypeLogic">Logic</link>
+ </listitem>
+ <listitem>
+ <emphasis role="bold">Boolean Expression Language:</emphasis><emphasis>Drools DRL</emphasis>
+ </listitem>
+ <listitem>
+ <table>
+ <title>Fields</title>
+ <tgroup cols="3" align="left" colsep="1" rowset="1">
+ <colspec colname='c1'/>
+ <colspec colname='c2'/>
+ <colspec colname='c3'/>
+ <thead>
+ <row>
+ <entry align="center">Field Name</entry>
+ <entry align="center">Type</entry>
+ <entry align="center">Description</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry><emphasis role="bold">names</emphasis></entry>
+ <entry><emphasis role="bold">java.util.Set<String></emphasis></entry>
+ <entry>A set of roles associated with the user accessing the system</entry>
+ </row>
+ <row>
+ <entry><emphasis role="bold">mustMatchAll</emphasis></entry>
+ <entry><emphasis role="bold">boolean (default: false)</emphasis></entry>
+ <entry>Indicates whether user must belong to all the specified roles or <emphasis>atleast</emphasis> one of them</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ </listitem>
+ <listitem>
+ <table>
+ <title>Boolean Expressions</title>
+ <tgroup cols="2" align="left" colsep="1" rowset="1">
+ <colspec colname='c1'/>
+ <colspec colname='c2'/>
+ <thead>
+ <row>
+ <entry align="center">Expression</entry>
+ <entry align="center">Description</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry><emphasis role="bold">allowExpression</emphasis></entry>
+ <entry>Suggests that the roles indicated by this object are permitted access to the 'Resource'</entry>
+ </row>
+ <row>
+ <entry><emphasis role="bold">denyExpression</emphasis></entry>
+ <entry>Suggests that the roles indicated by this object are denied access to the 'Resource'</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ </listitem>
+ </itemizedlist>
+ </para>
+ </sect2>
+ </sect1>
+ <sect1>
+ <title>Resource Components</title>
+ <sect2>
+ <title>URIResource</title>
+ <para>
+ <itemizedlist>
+ <listitem>
+ <emphasis role="bold">Description: </emphasis> Represents any System Resource uniquely identified by a URI
+ </listitem>
+ <listitem>
+ <emphasis role="bold">Class:</emphasis> <emphasis>org.jboss.security.authz.components.resource.URIResource</emphasis>
+ </listitem>
+ <listitem>
+ <emphasis role="bold">ComponentType:</emphasis><link linkend="componentTypeTarget">Target</link>
+ </listitem>
+ <listitem>
+ <table>
+ <title>Fields</title>
+ <tgroup cols="3" align="left" colsep="1" rowset="1">
+ <colspec colname='c1'/>
+ <colspec colname='c2'/>
+ <colspec colname='c3'/>
+ <thead>
+ <row>
+ <entry align="center">Field Name</entry>
+ <entry align="center">Type</entry>
+ <entry align="center">Description</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry><emphasis role="bold">uri</emphasis></entry>
+ <entry><emphasis role="bold">java.net.URI</emphasis></entry>
+ <entry>The unique URI that identifies this resource</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ </listitem>
+ </itemizedlist>
+ </para>
+ </sect2>
+ </sect1>
+ <sect1>
+ <title>Action Components</title>
+ <sect2>
+ <title>Read</title>
+ <para>
+ <itemizedlist>
+ <listitem>
+ <emphasis role="bold">Description: </emphasis> Represents a <emphasis>read</emphasis> action that can be performed on a Resource. In a <emphasis>CRUD (CREATE, READ, UPDATE, DELETE)</emphasis>
+ usecase this would represent protection for <emphasis>R</emphasis>.
+ </listitem>
+ <listitem>
+ <emphasis role="bold">Class:</emphasis> <emphasis>org.jboss.security.authz.components.action.Read</emphasis>
+ </listitem>
+ <listitem>
+ <emphasis role="bold">ComponentType:</emphasis><link linkend="componentTypeTarget">Target</link>
+ </listitem>
+
+ </itemizedlist>
+ </para>
+ </sect2>
+ <sect2>
+ <title>Write</title>
+ <para>
+ <itemizedlist>
+ <listitem>
+ <emphasis role="bold">Description: </emphasis> Represents a <emphasis>write</emphasis> action that can be performed on a Resource. In a <emphasis>CRUD (CREATE, READ, UPDATE, DELETE)</emphasis>
+ usecase this would represent protection for <emphasis>C</emphasis> and <emphasis>U</emphasis>.
+ </listitem>
+ <listitem>
+ <emphasis role="bold">Class:</emphasis> <emphasis>org.jboss.security.authz.components.action.Write</emphasis>
+ </listitem>
+ <listitem>
+ <emphasis role="bold">ComponentType:</emphasis><link linkend="componentTypeTarget">Target</link>
+ </listitem>
+ <listitem>
+ <emphasis role="bold">Implied Action:</emphasis> <emphasis>Read</emphasis>
+ </listitem>
+ </itemizedlist>
+ </para>
+ </sect2>
+ <sect2>
+ <title>Manage</title>
+ <para>
+ <itemizedlist>
+ <listitem>
+ <emphasis role="bold">Description: </emphasis> Represents a <emphasis>manage</emphasis> action that can be performed on a Resource. In a <emphasis>CRUD (CREATE, READ, UPDATE, DELETE)</emphasis>
+ usecase this would represent protection for <emphasis>D</emphasis>.
+ </listitem>
+ <listitem>
+ <emphasis role="bold">Class:</emphasis> <emphasis>org.jboss.security.authz.components.action.Manage</emphasis>
+ </listitem>
+ <listitem>
+ <emphasis role="bold">ComponentType:</emphasis><link linkend="componentTypeTarget">Target</link>
+ </listitem>
+ <listitem>
+ <emphasis role="bold">Implied Action:</emphasis> <emphasis>Read</emphasis> and <emphasis>Write</emphasis>
+ </listitem>
+ </itemizedlist>
+ </para>
+ </sect2>
+ </sect1>
+ <sect1>
+ <title>Environment Components</title>
+ <sect2>
+ <title>TimeOfDay</title>
+ <para>
+ <itemizedlist>
+ <listitem>
+ <emphasis role="bold">Description: </emphasis> Represents the "Time of the Day" information to make an access decision
+ </listitem>
+ <listitem>
+ <emphasis role="bold">Class:</emphasis> <emphasis>org.jboss.security.authz.components.environment.TimeOfDay</emphasis>
+ </listitem>
+ <listitem>
+ <emphasis role="bold">ComponentType:</emphasis><link linkend="componentTypeLogic">Logic</link>
+ </listitem>
+ <listitem>
+ <emphasis role="bold">Boolean Expression Language:</emphasis><emphasis>Drools DRL</emphasis>
+ </listitem>
+ <listitem>
+ <table>
+ <title>Fields</title>
+ <tgroup cols="3" align="left" colsep="1" rowset="1">
+ <colspec colname='c1'/>
+ <colspec colname='c2'/>
+ <colspec colname='c3'/>
+ <thead>
+ <row>
+ <entry align="center">Field Name</entry>
+ <entry align="center">Type</entry>
+ <entry align="center">Description</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry><emphasis role="bold">timeofDay</emphasis></entry>
+ <entry><emphasis role="bold">java.util.Calendar</emphasis></entry>
+ <entry>Time referring to the hour and minute of a day</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ </listitem>
+ <listitem>
+ <table>
+ <title>Boolean Expressions</title>
+ <tgroup cols="2" align="left" colsep="1" rowset="1">
+ <colspec colname='c1'/>
+ <colspec colname='c2'/>
+ <thead>
+ <row>
+ <entry align="center">Expression</entry>
+ <entry align="center">Description</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry><emphasis role="bold">matchIfBefore</emphasis></entry>
+ <entry>Suggests that access should be granted if its performed <emphasis>before</emphasis> the specified time of the day</entry>
+ </row>
+ <row>
+ <entry><emphasis role="bold">matchIfAfter</emphasis></entry>
+ <entry>Suggests that access should be granted if the its performed <emphasis>after</emphasis> the specified time of the day</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ </listitem>
+ </itemizedlist>
+ </para>
+ </sect2>
+ </sect1>
+</chapter>
14 years, 7 months
JBoss Identity SVN: r817 - in identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/wstrust: plugins/saml and 1 other directory.
by jboss-identity-commits@lists.jboss.org
Author: sguilhen(a)redhat.com
Date: 2009-10-06 14:02:54 -0400 (Tue, 06 Oct 2009)
New Revision: 817
Modified:
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/wstrust/JBossSTS.java
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/wstrust/StandardRequestHandler.java
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/wstrust/WSTrustJAXBFactory.java
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/wstrust/WSTrustUtil.java
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/wstrust/plugins/saml/SAML20TokenProvider.java
Log:
JBID-141: Added logging statements to STS classes
Modified: identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/wstrust/JBossSTS.java
===================================================================
--- identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/wstrust/JBossSTS.java 2009-10-05 11:16:15 UTC (rev 816)
+++ identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/wstrust/JBossSTS.java 2009-10-06 18:02:54 UTC (rev 817)
@@ -34,17 +34,12 @@
import javax.xml.ws.WebServiceException;
import javax.xml.ws.WebServiceProvider;
+import org.apache.log4j.Logger;
import org.jboss.identity.federation.core.config.STSType;
import org.jboss.identity.federation.core.exceptions.ConfigurationException;
import org.jboss.identity.federation.core.exceptions.ParsingException;
import org.jboss.identity.federation.core.saml.v2.common.SAMLDocumentHolder;
import org.jboss.identity.federation.core.util.JAXBUtil;
-import org.jboss.identity.federation.core.wstrust.STSConfiguration;
-import org.jboss.identity.federation.core.wstrust.SecurityTokenService;
-import org.jboss.identity.federation.core.wstrust.WSTrustConstants;
-import org.jboss.identity.federation.core.wstrust.WSTrustException;
-import org.jboss.identity.federation.core.wstrust.WSTrustJAXBFactory;
-import org.jboss.identity.federation.core.wstrust.WSTrustRequestHandler;
import org.jboss.identity.federation.core.wstrust.wrappers.BaseRequestSecurityToken;
import org.jboss.identity.federation.core.wstrust.wrappers.RequestSecurityToken;
import org.jboss.identity.federation.core.wstrust.wrappers.RequestSecurityTokenCollection;
@@ -63,6 +58,7 @@
@ServiceMode(value = Service.Mode.PAYLOAD)
public class JBossSTS implements SecurityTokenService
{
+ private static Logger logger = Logger.getLogger(JBossSTS.class);
@Resource
protected WebServiceContext context;
@@ -115,6 +111,8 @@
if(this.config == null)
try
{
+ if(logger.isInfoEnabled())
+ logger.info("Loading STS configuration");
this.config = this.getConfiguration();
}
catch (ConfigurationException e)
@@ -124,7 +122,9 @@
WSTrustRequestHandler handler = this.config.getRequestHandler();
String requestType = request.getRequestType().toString();
-
+ if(logger.isDebugEnabled())
+ logger.debug("STS received request of type " + requestType);
+
try
{
if (requestType.equals(WSTrustConstants.ISSUE_REQUEST))
@@ -191,7 +191,10 @@
// get the configuration file and parse it.
URL configurationFile = SecurityActions.getContextClassLoader().getResource("jboss-sts.xml");
if (configurationFile == null)
+ {
+ logger.warn("jboss-sts.xml configuration file not found. Using default configuration values");
return new JBossSTSConfiguration();
+ }
try
{
@@ -199,7 +202,10 @@
InputStream stream = configurationFile.openStream();
JAXBElement<STSType> element = (JAXBElement<STSType>) JAXBUtil.getUnmarshaller(pkgName).unmarshal(stream);
STSType stsConfig = element.getValue();
- return new JBossSTSConfiguration(stsConfig);
+ STSConfiguration configuration = new JBossSTSConfiguration(stsConfig);
+ if(logger.isInfoEnabled())
+ logger.info("jboss-sts.xml configuration file loaded");
+ return configuration;
}
catch (Exception e)
{
Modified: identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/wstrust/StandardRequestHandler.java
===================================================================
--- identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/wstrust/StandardRequestHandler.java 2009-10-05 11:16:15 UTC (rev 816)
+++ identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/wstrust/StandardRequestHandler.java 2009-10-06 18:02:54 UTC (rev 817)
@@ -84,6 +84,9 @@
public RequestSecurityTokenResponse issue(RequestSecurityToken request, Principal callerPrincipal)
throws WSTrustException
{
+ if(trace)
+ log.trace("Issuing token for principal " + callerPrincipal);
+
Document rstDocument = request.getRSTDocument();
if (rstDocument == null)
throw new IllegalArgumentException("Request does not contain the DOM Document");
@@ -122,6 +125,8 @@
if (request.getLifetime() == null && this.configuration.getIssuedTokenTimeout() != 0)
{
// if no lifetime has been specified, use the configured timeout value.
+ if (log.isDebugEnabled())
+ log.debug("Lifetime has not been specified. Using the default timeout value.");
request.setLifetime(WSTrustUtil.createDefaultLifetime(this.configuration.getIssuedTokenTimeout()));
}
requestContext.setServiceProviderPublicKey(providerPublicKey);
@@ -130,16 +135,20 @@
URI keyType = request.getKeyType();
if (keyType == null)
{
+ if(log.isDebugEnabled())
+ log.debug("No key type could be found in the request. Using the default BEARER type.");
keyType = URI.create(WSTrustConstants.KEY_TYPE_BEARER);
request.setKeyType(keyType);
}
long keySize = request.getKeySize();
if (keySize == 0)
{
+ if (log.isDebugEnabled())
+ log.debug("No key size could be found in the request. Using the default size. (" + KEY_SIZE + ")");
keySize = KEY_SIZE;
request.setKeySize(keySize);
}
-
+
// get the key wrap algorithm.
URI keyWrapAlgo = request.getKeyWrapAlgorithm();
@@ -178,20 +187,22 @@
{
throw new WSTrustException("Error generating combined secret key", e);
}
- requestContext.setProofTokenInfo(WSTrustUtil.createKeyInfo(combinedSecret, providerPublicKey, keyWrapAlgo));
+ requestContext.setProofTokenInfo(WSTrustUtil.createKeyInfo(combinedSecret, providerPublicKey,
+ keyWrapAlgo));
}
else
{
// client secret has not been specified - use the sts secret only.
requestedProofToken.setAny(objFactory.createBinarySecret(serverBinarySecret));
- requestContext.setProofTokenInfo(WSTrustUtil.createKeyInfo(serverSecret, providerPublicKey, keyWrapAlgo));
+ requestContext
+ .setProofTokenInfo(WSTrustUtil.createKeyInfo(serverSecret, providerPublicKey, keyWrapAlgo));
}
}
else if (WSTrustConstants.KEY_TYPE_PUBLIC.equalsIgnoreCase(keyType.toString()))
{
// TODO: get the client certificate from a metadata provider or from the UseKey section of the WS-T request.
Certificate certificate = null;
- if(certificate != null)
+ if (certificate != null)
requestContext.setProofTokenInfo(WSTrustUtil.createKeyInfo(certificate));
else
throw new WSTrustException("Unable to locate client public key");
@@ -217,12 +228,12 @@
response.setKeySize(keySize);
response.setKeyType(keyType);
response.setRequestedSecurityToken(requestedSecurityToken);
-
- if(requestedProofToken != null)
+
+ if (requestedProofToken != null)
response.setRequestedProofToken(requestedProofToken);
- if(serverEntropy != null)
+ if (serverEntropy != null)
response.setEntropy(serverEntropy);
-
+
// set the attached and unattached references.
if (requestContext.getAttachedReference() != null)
response.setRequestedAttachedReference(requestContext.getAttachedReference());
@@ -270,9 +281,6 @@
else if (appliesTo == null && request.getTokenType() == null)
throw new WSTrustException("Either AppliesTo or TokenType must be present in a security token request");
- // TODO: get the provider using the token from the request.
- provider = this.configuration.getProviderForTokenType(SAMLUtil.SAML2_TOKEN_TYPE);
-
if (provider != null)
{
// create the request context and delegate token generation to the provider.
@@ -293,8 +301,6 @@
RequestedSecurityTokenType requestedSecurityToken = new RequestedSecurityTokenType();
requestedSecurityToken.setAny(requestContext.getSecurityToken().getTokenValue());
- // TODO: create proof token and encrypt the token if needed
-
RequestSecurityTokenResponse response = new RequestSecurityTokenResponse();
if (request.getContext() != null)
response.setContext(request.getContext());
@@ -324,6 +330,8 @@
public RequestSecurityTokenResponse validate(RequestSecurityToken request, Principal callerPrincipal)
throws WSTrustException
{
+ if (trace)
+ log.trace("Started validation for request " + request.getContext());
Document rstDocument = request.getRSTDocument();
if (rstDocument == null)
throw new IllegalArgumentException("Request does not contain the DOM Document");
@@ -342,7 +350,6 @@
+ securityToken.getLocalName());
WSTrustRequestContext context = new WSTrustRequestContext(request, callerPrincipal);
-
StatusType status = null;
// validate the security token digital signature.
@@ -378,11 +385,18 @@
status.setReason("Validation failure: unable to verify digital signature: " + e.getMessage());
}
}
- // TODO: add logging statements alerting that signature validation was not performed.
-
+ else
+ {
+ if(trace)
+ log.trace("Security Token digital signature has NOT been verified. Either the STS has been configured" +
+ "not to sign tokens or the STS key pair has not been properly specified.");
+ }
+
// if the signature is valid, then let the provider perform any additional validation checks.
if (status == null)
{
+ if (trace)
+ log.trace("Delegating token validation to token provider");
provider.validateToken(context);
status = context.getStatus();
}
@@ -424,49 +438,43 @@
if (this.configuration.signIssuedToken() && this.configuration.getSTSKeyPair() != null)
{
KeyPair keyPair = this.configuration.getSTSKeyPair();
- if (keyPair != null)
+ URI signatureURI = request.getSignatureAlgorithm();
+ String signatureMethod = signatureURI != null ? signatureURI.toString() : SignatureMethod.RSA_SHA1;
+ try
{
- URI signatureURI = request.getSignatureAlgorithm();
- String signatureMethod = signatureURI != null ? signatureURI.toString() : SignatureMethod.RSA_SHA1;
- try
+ Node rst = rstrDocument
+ .getElementsByTagNameNS(WSTrustConstants.BASE_NAMESPACE, "RequestedSecurityToken").item(0);
+ Element tokenElement = (Element) rst.getFirstChild();
+ if (trace)
{
- Node rst = rstrDocument.getElementsByTagNameNS(WSTrustConstants.BASE_NAMESPACE,
- "RequestedSecurityToken").item(0);
- Element tokenElement = (Element) rst.getFirstChild();
- if (trace)
+ log.trace("NamespaceURI of element to be signed:" + tokenElement.getNamespaceURI());
+ }
+ rstrDocument = XMLSignatureUtil.sign(rstrDocument, tokenElement, keyPair, DigestMethod.SHA1,
+ signatureMethod, "#" + tokenElement.getAttribute("ID"));
+ if (trace)
+ {
+ try
{
- log.trace("NamespaceURI of element to be signed:" + tokenElement.getNamespaceURI());
- }
- /* XMLSignatureUtil.sign(tokenElement.getOwnerDocument(), keyPair, DigestMethod.SHA1, signatureMethod,
- "#" + tokenElement.getAttribute("ID"));
- */
- rstrDocument = XMLSignatureUtil.sign(rstrDocument, tokenElement, keyPair, DigestMethod.SHA1,
- signatureMethod, "#" + tokenElement.getAttribute("ID"));
- if (trace)
- {
- try
- {
- log.trace("Signed Token:" + DocumentUtil.getNodeAsString(tokenElement));
+ log.trace("Signed Token:" + DocumentUtil.getNodeAsString(tokenElement));
- Document tokenDocument = DocumentUtil.createDocument();
- tokenDocument.appendChild(tokenDocument.importNode(tokenElement, true));
- log.trace("valid=" + XMLSignatureUtil.validate(tokenDocument, keyPair.getPublic()));
+ Document tokenDocument = DocumentUtil.createDocument();
+ tokenDocument.appendChild(tokenDocument.importNode(tokenElement, true));
+ log.trace("valid=" + XMLSignatureUtil.validate(tokenDocument, keyPair.getPublic()));
- }
- catch (Exception ignore)
- {
- }
}
+ catch (Exception ignore)
+ {
+ }
}
- catch (Exception e)
- {
- throw new WSTrustException("Failed to sign security token", e);
- }
}
+ catch (Exception e)
+ {
+ throw new WSTrustException("Failed to sign security token", e);
+ }
}
}
return rstrDocument;
}
-
+
}
\ No newline at end of file
Modified: identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/wstrust/WSTrustJAXBFactory.java
===================================================================
--- identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/wstrust/WSTrustJAXBFactory.java 2009-10-05 11:16:15 UTC (rev 816)
+++ identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/wstrust/WSTrustJAXBFactory.java 2009-10-06 18:02:54 UTC (rev 817)
@@ -150,42 +150,6 @@
{
throw new ParsingException(e);
}
-
-
- /*Element targetElement = this.getValidateOrRenewOrCancelTarget(document);
-
- try
- {
- Object object = this.unmarshaller.unmarshal(request);
- if (object instanceof JAXBElement)
- {
- JAXBElement<?> element = (JAXBElement<?>) object;
- if (element.getDeclaredType().equals(RequestSecurityTokenType.class))
- {
- RequestSecurityToken parsedRequest = new RequestSecurityToken((RequestSecurityTokenType) element
- .getValue());
- // insert the request target in the parsed request.
- if (targetElement != null)
- {
- if (parsedRequest.getValidateTarget() != null)
- parsedRequest.getValidateTarget().setAny(targetElement);
- else if (parsedRequest.getRenewTarget() != null)
- parsedRequest.getRenewTarget().setAny(targetElement);
- else if (parsedRequest.getCancelTarget() != null)
- parsedRequest.getCancelTarget().setAny(targetElement);
- }
- return parsedRequest;
- }
- else
- throw new RuntimeException("Invalid request type: " + element.getDeclaredType());
- }
- else
- throw new RuntimeException("Invalid request type: " + object.getClass().getName());
- }
- catch (Exception e)
- {
- throw new RuntimeException("Failed to unmarshall security token request", e);
- }*/
}
/**
Modified: identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/wstrust/WSTrustUtil.java
===================================================================
--- identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/wstrust/WSTrustUtil.java 2009-10-05 11:16:15 UTC (rev 816)
+++ identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/wstrust/WSTrustUtil.java 2009-10-06 18:02:54 UTC (rev 817)
@@ -35,6 +35,7 @@
import javax.xml.bind.JAXBElement;
import javax.xml.namespace.QName;
+import org.apache.log4j.Logger;
import org.apache.xml.security.encryption.EncryptedKey;
import org.apache.xml.security.encryption.XMLCipher;
import org.jboss.identity.federation.core.saml.v2.util.DocumentUtil;
@@ -65,6 +66,8 @@
public class WSTrustUtil
{
+ private static Logger logger = Logger.getLogger(WSTrustUtil.class);
+
/**
* <p>
* Creates an instance of {@code KeyIdentifierType} with the specified values.
@@ -311,7 +314,7 @@
}
else
{
- // TODO: log a warn message or throw an exception to inform client that the secret could not be encrypted.
+ logger.warn("Secret key could not be encrypted because the endpoint's PKC has not been specified");
}
return keyInfo;
}
Modified: identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/wstrust/plugins/saml/SAML20TokenProvider.java
===================================================================
--- identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/wstrust/plugins/saml/SAML20TokenProvider.java 2009-10-05 11:16:15 UTC (rev 816)
+++ identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/wstrust/plugins/saml/SAML20TokenProvider.java 2009-10-06 18:02:54 UTC (rev 817)
@@ -29,6 +29,7 @@
import javax.xml.bind.JAXBException;
import javax.xml.namespace.QName;
+import org.apache.log4j.Logger;
import org.jboss.identity.federation.core.saml.v2.common.IDGenerator;
import org.jboss.identity.federation.core.saml.v2.factories.SAMLAssertionFactory;
import org.jboss.identity.federation.core.saml.v2.util.AssertionUtil;
@@ -64,6 +65,8 @@
public class SAML20TokenProvider implements SecurityTokenProvider
{
+ private static Logger logger = Logger.getLogger(SAML20TokenProvider.class);
+
private Map<String, String> properties;
/*
@@ -121,6 +124,9 @@
@SuppressWarnings("unchecked")
public void validateToken(WSTrustRequestContext context) throws WSTrustException
{
+ if (logger.isTraceEnabled())
+ logger.trace("SAML V2.0 token validation started");
+
// get the SAML assertion that must be validated.
ValidateTargetType validateTarget = context.getRequestSecurityToken().getValidateTarget();
if(validateTarget == null)
14 years, 7 months
JBoss Identity SVN: r816 - in authz/trunk/samples/secure-pojo/src: main/java/org/jboss/security/authz/samples/pojo/enforcement and 2 other directories.
by jboss-identity-commits@lists.jboss.org
Author: sohil.shah(a)jboss.com
Date: 2009-10-05 07:16:15 -0400 (Mon, 05 Oct 2009)
New Revision: 816
Added:
authz/trunk/samples/secure-pojo/src/test/java/org/jboss/security/authz/samples/pojo/AbstractPOJOTestCase.java
authz/trunk/samples/secure-pojo/src/test/java/org/jboss/security/authz/samples/pojo/TestRoleBasedSecurity.java
authz/trunk/samples/secure-pojo/src/test/java/org/jboss/security/authz/samples/pojo/TestTimeBasedSecurity.java
Removed:
authz/trunk/samples/secure-pojo/src/test/java/org/jboss/security/authz/samples/pojo/TestSecurePojo.java
Modified:
authz/trunk/samples/secure-pojo/src/main/java/org/jboss/security/authz/samples/pojo/AuthenticatedSession.java
authz/trunk/samples/secure-pojo/src/main/java/org/jboss/security/authz/samples/pojo/enforcement/SecurityInterceptor.java
authz/trunk/samples/secure-pojo/src/main/java/org/jboss/security/authz/samples/pojo/provisioning/SecurityProvisioning.java
Log:
adding time based security usecase
Modified: authz/trunk/samples/secure-pojo/src/main/java/org/jboss/security/authz/samples/pojo/AuthenticatedSession.java
===================================================================
--- authz/trunk/samples/secure-pojo/src/main/java/org/jboss/security/authz/samples/pojo/AuthenticatedSession.java 2009-10-04 14:13:31 UTC (rev 815)
+++ authz/trunk/samples/secure-pojo/src/main/java/org/jboss/security/authz/samples/pojo/AuthenticatedSession.java 2009-10-05 11:16:15 UTC (rev 816)
@@ -23,6 +23,7 @@
import java.util.List;
import java.util.ArrayList;
+import java.util.Date;
/**
* Just a mock AuthenticatedSession that carries security related information about the logged in user...
@@ -46,10 +47,12 @@
private String username;
private List<String> roles;
+ private Date accessTime;
public AuthenticatedSession()
{
this.roles = new ArrayList<String>();
+ this.accessTime = new Date(); //making this currentTime
}
public String getUsername()
@@ -76,4 +79,14 @@
{
this.roles.add(role);
}
+
+ public Date getAccessTime()
+ {
+ return accessTime;
+ }
+
+ public void setAccessTime(Date accessTime)
+ {
+ this.accessTime = accessTime;
+ }
}
Modified: authz/trunk/samples/secure-pojo/src/main/java/org/jboss/security/authz/samples/pojo/enforcement/SecurityInterceptor.java
===================================================================
--- authz/trunk/samples/secure-pojo/src/main/java/org/jboss/security/authz/samples/pojo/enforcement/SecurityInterceptor.java 2009-10-04 14:13:31 UTC (rev 815)
+++ authz/trunk/samples/secure-pojo/src/main/java/org/jboss/security/authz/samples/pojo/enforcement/SecurityInterceptor.java 2009-10-05 11:16:15 UTC (rev 816)
@@ -23,6 +23,7 @@
import java.lang.reflect.Method;
import java.net.URI;
+import java.util.Calendar;
import org.apache.log4j.Logger;
@@ -36,6 +37,7 @@
import org.jboss.security.authz.components.resource.URIResource;
import org.jboss.security.authz.components.action.Read;
import org.jboss.security.authz.components.action.Write;
+import org.jboss.security.authz.components.environment.TimeOfDay;
import org.jboss.security.authz.agent.enforcement.EnforcementContext;
import org.jboss.security.authz.agent.enforcement.PolicyEnforcementPoint;
@@ -109,6 +111,12 @@
{
action = new Write();
}
+
+ //TimeOfDay expressing accesstime information
+ TimeOfDay accessTime = new TimeOfDay();
+ Calendar access = Calendar.getInstance();
+ access.setTime(session.getAccessTime());
+ accessTime.setTimeofDay(access);
//Create an EnforcementContext and start the "Enforcement Phase" with the security framework----------------------------------------------------------------------
EnforcementContext context = new EnforcementContext();
@@ -117,6 +125,7 @@
context.setAttribute("method", action);
context.setAttribute("identity", identity);
context.setAttribute("roles", roles);
+ context.setAttribute("accessTime", accessTime);
//Process the result from Enforcement Phase execution-------------------------------------------------------------------------------------------------------------
EnforcementResponse response = this.getEnforcer().checkAccess(context);
Modified: authz/trunk/samples/secure-pojo/src/main/java/org/jboss/security/authz/samples/pojo/provisioning/SecurityProvisioning.java
===================================================================
--- authz/trunk/samples/secure-pojo/src/main/java/org/jboss/security/authz/samples/pojo/provisioning/SecurityProvisioning.java 2009-10-04 14:13:31 UTC (rev 815)
+++ authz/trunk/samples/secure-pojo/src/main/java/org/jboss/security/authz/samples/pojo/provisioning/SecurityProvisioning.java 2009-10-05 11:16:15 UTC (rev 816)
@@ -23,6 +23,7 @@
import java.net.URI;
import java.util.Set;
+import java.util.Calendar;
import org.apache.log4j.Logger;
import org.jboss.security.authz.bootstrap.ServiceContainer;
@@ -36,6 +37,7 @@
import org.jboss.security.authz.components.action.Write;
import org.jboss.security.authz.components.resource.URIResource;
import org.jboss.security.authz.components.subject.Roles;
+import org.jboss.security.authz.components.environment.TimeOfDay;
import org.jboss.security.authz.samples.pojo.Pojo;
@@ -50,12 +52,28 @@
{
private static Logger log = Logger.getLogger(SecurityProvisioning.class);
- public void bootup()
+ public static final int rbac = 1;
+ public static final int timebased = 2;
+
+ public void bootup(int usecaseType)
{
try
{
// Provision POJO Policy
- this.provisionPOJOPolicy();
+ switch(usecaseType)
+ {
+ case rbac:
+ this.provisionRBACPOJOPolicy();
+ break;
+
+ case timebased:
+ this.provisionTimebasedPOJOPolicy();
+ break;
+
+ default:
+ this.provisionRBACPOJOPolicy();
+ break;
+ }
Set<Policy> policies = this.getProvisioner().readAllPolicies();
for(Policy policy: policies)
@@ -70,7 +88,7 @@
}
}
// -------------------------------------------------------------------------------------------------------------------------------------------------------------------------
- private void provisionPOJOPolicy() throws Exception
+ private void provisionRBACPOJOPolicy() throws Exception
{
// SetUp Resource
URIResource resource = new URIResource();
@@ -87,16 +105,54 @@
writeRoles.setMustMatchAll(false);
writeRoles.addName("admin");
+ //Make the POJO inaccessible after 5:30 pm
+ Calendar restriction = Calendar.getInstance();
+ restriction.set(Calendar.HOUR_OF_DAY, 17);
+ restriction.set(Calendar.MINUTE, 30);
+ TimeOfDay accessTimeRestriction = new TimeOfDay();
+ accessTimeRestriction.setTimeofDay(restriction);
+
// Setup the Context for the Composition with these components
CompositionContext context = new CompositionContext();
context.setPolicyTarget(resource);
+
+ //role based rule
context.addPolicyRule(Effect.PERMIT, read, readRoles,"allowExpression");
- context.addPolicyRule(Effect.PERMIT, write, writeRoles,"allowExpression");
+ context.addPolicyRule(Effect.PERMIT, write, writeRoles,"allowExpression");
// Store the policy into the Policy Server
this.getProvisioner().deploy(context);
- }
+ }
+ private void provisionTimebasedPOJOPolicy() throws Exception
+ {
+ // SetUp Resource
+ URIResource resource = new URIResource();
+ resource.setUri(new URI(Pojo.class.getName()));
+
+ Read read = new Read();
+
+
+ //Make the POJO inaccessible after 5:30 pm
+ Calendar officeHours = Calendar.getInstance();
+ officeHours.set(Calendar.HOUR_OF_DAY, 17);
+ officeHours.set(Calendar.MINUTE, 30);
+ TimeOfDay accessTimeRestriction = new TimeOfDay();
+ accessTimeRestriction.setTimeofDay(officeHours);
+
+
+ // Setup the Context for the Composition with these components
+ CompositionContext context = new CompositionContext();
+ context.setPolicyTarget(resource);
+
+ //time based rule
+ context.addPolicyRule(Effect.PERMIT, read, accessTimeRestriction,"matchIfBefore");
+ context.addPolicyRule(Effect.DENY, read, accessTimeRestriction,"matchIfAfter");
+
+ // Store the policy into the Policy Server
+ this.getProvisioner().deploy(context);
+ }
+
private PolicyProvisioner getProvisioner()
{
return (PolicyProvisioner) ServiceContainer.lookup("/agent/LocalPolicyProvisioner");
Added: authz/trunk/samples/secure-pojo/src/test/java/org/jboss/security/authz/samples/pojo/AbstractPOJOTestCase.java
===================================================================
--- authz/trunk/samples/secure-pojo/src/test/java/org/jboss/security/authz/samples/pojo/AbstractPOJOTestCase.java (rev 0)
+++ authz/trunk/samples/secure-pojo/src/test/java/org/jboss/security/authz/samples/pojo/AbstractPOJOTestCase.java 2009-10-05 11:16:15 UTC (rev 816)
@@ -0,0 +1,50 @@
+/*
+* 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.security.authz.samples.pojo;
+
+import org.apache.log4j.Logger;
+import org.jboss.security.authz.bootstrap.ServiceContainer;
+
+import junit.framework.TestCase;
+
+/**
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ */
+public abstract class AbstractPOJOTestCase extends TestCase
+{
+ private static Logger log = Logger.getLogger(AbstractPOJOTestCase.class);
+
+ public void setUp() throws Exception
+ {
+ // Bootstrap the Security Service
+ ServiceContainer.bootstrap();
+
+ // Start in Anonymous mode....each testcase will select its own
+ // authentication scenario
+ AuthenticatedSession.activeSession.set(null);
+ }
+
+ public void tearDown() throws Exception
+ {
+ ServiceContainer.shutdown();
+ }
+}
Copied: authz/trunk/samples/secure-pojo/src/test/java/org/jboss/security/authz/samples/pojo/TestRoleBasedSecurity.java (from rev 815, authz/trunk/samples/secure-pojo/src/test/java/org/jboss/security/authz/samples/pojo/TestSecurePojo.java)
===================================================================
--- authz/trunk/samples/secure-pojo/src/test/java/org/jboss/security/authz/samples/pojo/TestRoleBasedSecurity.java (rev 0)
+++ authz/trunk/samples/secure-pojo/src/test/java/org/jboss/security/authz/samples/pojo/TestRoleBasedSecurity.java 2009-10-05 11:16:15 UTC (rev 816)
@@ -0,0 +1,228 @@
+/*
+ * 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.security.authz.samples.pojo;
+
+import java.util.Calendar;
+
+import org.apache.log4j.Logger;
+
+import org.jboss.security.authz.samples.pojo.provisioning.SecurityProvisioning;
+
+/**
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ */
+public class TestRoleBasedSecurity extends AbstractPOJOTestCase
+{
+ private static Logger log = Logger.getLogger(TestRoleBasedSecurity.class);
+
+ private SecurityProvisioning provisioning;
+
+ public void setUp() throws Exception
+ {
+ super.setUp();
+
+ // Bootup the system with the appropriate Policies
+ provisioning = new SecurityProvisioning();
+ provisioning.bootup(SecurityProvisioning.rbac);
+ }
+
+ public void testAsAnonymous() throws Exception
+ {
+ boolean readGranted = true;
+ boolean writeGranted = true;
+
+ Pojo pojo = new Pojo();
+
+ try
+ {
+ // Write Action on the Pojo
+ pojo.setSensitiveData("This is Top Secret Data!!! Protect Me!!");
+ writeGranted = true;
+ }
+ catch (Exception r)
+ {
+ if (r instanceof IllegalAccessException)
+ {
+ writeGranted = false;
+ }
+ else
+ {
+ log.error(this, r);
+ throw r;
+ }
+ }
+
+ try
+ {
+ String sensitiveData = pojo.getSensitiveData();
+ log.info(sensitiveData);
+ assertEquals("Data Must Match!!", sensitiveData,
+ "This is Top Secret Data!!! Protect Me!!");
+ readGranted = true;
+ }
+ catch (Exception r)
+ {
+ if (r instanceof IllegalAccessException)
+ {
+ readGranted = false;
+ }
+ else
+ {
+ throw r;
+ }
+ }
+
+ assertFalse("Read Access Must *Not* be Granted!!", readGranted);
+ assertFalse("Write Access Must *Not* be Granted!!", writeGranted);
+ }
+
+ public void testAsUser() throws Exception
+ {
+ boolean readGranted = false;
+ boolean writeGranted = true;
+
+ this.loginAsUser();
+ Pojo pojo = new Pojo();
+
+ // Read Action on the Pojo
+ try
+ {
+ String sensitiveData = pojo.getSensitiveData();
+ log.info(sensitiveData);
+ assertNull("Data Must be Null!!", sensitiveData);
+ readGranted = true;
+ }
+ catch (Exception r)
+ {
+ if (r instanceof IllegalAccessException)
+ {
+ readGranted = false;
+ }
+ else
+ {
+ throw r;
+ }
+ }
+
+ // Write Action on the Pojo
+ try
+ {
+ pojo.setSensitiveData("This is Top Secret Data!!! Protect Me!!");
+ }
+ catch (Exception r)
+ {
+ if (r instanceof IllegalAccessException)
+ {
+ writeGranted = false;
+ }
+ else
+ {
+ throw r;
+ }
+ }
+
+ assertTrue("Read Access Must be Granted!!", readGranted);
+ assertFalse("Write Access Must *Not* be Granted!!", writeGranted);
+ }
+
+ public void testAsAdmin() throws Exception
+ {
+ boolean readGranted = false;
+ boolean writeGranted = false;
+
+ this.loginAsAdmin();
+ Pojo pojo = new Pojo();
+
+ try
+ {
+ // Write Action on the Pojo
+ pojo.setSensitiveData("This is Top Secret Data!!! Protect Me!!");
+ writeGranted = true;
+ }
+ catch (Exception r)
+ {
+ if (r instanceof IllegalAccessException)
+ {
+ writeGranted = false;
+ }
+ else
+ {
+ log.error(this, r);
+ throw r;
+ }
+ }
+
+ try
+ {
+ String sensitiveData = pojo.getSensitiveData();
+ log.info(sensitiveData);
+ assertEquals("Data Must Match!!", sensitiveData,
+ "This is Top Secret Data!!! Protect Me!!");
+ readGranted = true;
+ }
+ catch (Exception r)
+ {
+ if (r instanceof IllegalAccessException)
+ {
+ readGranted = false;
+ }
+ else
+ {
+ throw r;
+ }
+ }
+
+ assertTrue("Read Access Must be Granted!!", readGranted);
+ assertTrue("Write Access Must be Granted!!", writeGranted);
+ }
+ // ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+ private void loginAsAdmin()
+ {
+ AuthenticatedSession session = new AuthenticatedSession();
+
+ session.setUsername("admin");
+ session.addRole("admin");
+ // session.addRole("/system/admin/badassdude/blah/blah");
+
+ Calendar accessTime = Calendar.getInstance();
+ accessTime.set(Calendar.HOUR_OF_DAY, 8);
+ accessTime.set(Calendar.MINUTE, 0);
+ session.setAccessTime(accessTime.getTime());
+
+ AuthenticatedSession.activeSession.set(session);
+ }
+
+ private void loginAsUser()
+ {
+ AuthenticatedSession session = new AuthenticatedSession();
+
+ session.setUsername("user");
+ session.addRole("regular");
+
+ Calendar accessTime = Calendar.getInstance();
+ accessTime.set(Calendar.HOUR_OF_DAY, 8);
+ accessTime.set(Calendar.MINUTE, 0);
+ session.setAccessTime(accessTime.getTime());
+
+ AuthenticatedSession.activeSession.set(session);
+ }
+}
Property changes on: authz/trunk/samples/secure-pojo/src/test/java/org/jboss/security/authz/samples/pojo/TestRoleBasedSecurity.java
___________________________________________________________________
Name: svn:mergeinfo
+
Deleted: authz/trunk/samples/secure-pojo/src/test/java/org/jboss/security/authz/samples/pojo/TestSecurePojo.java
===================================================================
--- authz/trunk/samples/secure-pojo/src/test/java/org/jboss/security/authz/samples/pojo/TestSecurePojo.java 2009-10-04 14:13:31 UTC (rev 815)
+++ authz/trunk/samples/secure-pojo/src/test/java/org/jboss/security/authz/samples/pojo/TestSecurePojo.java 2009-10-05 11:16:15 UTC (rev 816)
@@ -1,231 +0,0 @@
-/*
- * JBoss, a division of Red Hat
- * Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.security.authz.samples.pojo;
-
-import org.apache.log4j.Logger;
-
-import junit.framework.TestCase;
-
-import org.jboss.security.authz.bootstrap.ServiceContainer;
-
-import org.jboss.security.authz.samples.pojo.provisioning.SecurityProvisioning;
-
-/**
- * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
- */
-public class TestSecurePojo extends TestCase
-{
- private static Logger log = Logger.getLogger(TestSecurePojo.class);
-
- private SecurityProvisioning provisioning;
-
- public void setUp() throws Exception
- {
- // Bootstrap the Security Service
- ServiceContainer.bootstrap();
-
- // Bootup the system with the appropriate Policies
- provisioning = new SecurityProvisioning();
- provisioning.bootup();
-
- // Start in Anonymous mode....each testcase will select its own
- // authentication scenario
- AuthenticatedSession.activeSession.set(null);
- }
-
- public void tearDown() throws Exception
- {
- ServiceContainer.shutdown();
- }
-
- public void testAsAnonymous() throws Exception
- {
- boolean readGranted = true;
- boolean writeGranted = true;
-
- Pojo pojo = new Pojo();
-
- try
- {
- // Write Action on the Pojo
- pojo.setSensitiveData("This is Top Secret Data!!! Protect Me!!");
- writeGranted = true;
- }
- catch (Exception r)
- {
- if (r instanceof IllegalAccessException)
- {
- writeGranted = false;
- }
- else
- {
- log.error(this, r);
- throw r;
- }
- }
-
- try
- {
- String sensitiveData = pojo.getSensitiveData();
- log.info(sensitiveData);
- assertEquals("Data Must Match!!", sensitiveData,
- "This is Top Secret Data!!! Protect Me!!");
- readGranted = true;
- }
- catch (Exception r)
- {
- if (r instanceof IllegalAccessException)
- {
- readGranted = false;
- }
- else
- {
- throw r;
- }
- }
-
- assertFalse("Read Access Must *Not* be Granted!!", readGranted);
- assertFalse("Write Access Must *Not* be Granted!!", writeGranted);
- }
-
- public void testAsUser() throws Exception
- {
- boolean readGranted = false;
- boolean writeGranted = true;
-
- this.loginAsUser();
- Pojo pojo = new Pojo();
-
- // Read Action on the Pojo
- try
- {
- String sensitiveData = pojo.getSensitiveData();
- log.info(sensitiveData);
- assertNull("Data Must be Null!!", sensitiveData);
- readGranted = true;
- }
- catch (Exception r)
- {
- if (r instanceof IllegalAccessException)
- {
- readGranted = false;
- }
- else
- {
- throw r;
- }
- }
-
- // Write Action on the Pojo
- try
- {
- pojo.setSensitiveData("This is Top Secret Data!!! Protect Me!!");
- }
- catch (Exception r)
- {
- if (r instanceof IllegalAccessException)
- {
- writeGranted = false;
- }
- else
- {
- throw r;
- }
- }
-
- assertTrue("Read Access Must be Granted!!", readGranted);
- assertFalse("Write Access Must *Not* be Granted!!", writeGranted);
- }
-
- public void testAsAdmin() throws Exception
- {
- boolean readGranted = false;
- boolean writeGranted = false;
-
- this.loginAsAdmin();
- Pojo pojo = new Pojo();
-
- try
- {
- // Write Action on the Pojo
- pojo.setSensitiveData("This is Top Secret Data!!! Protect Me!!");
- writeGranted = true;
- }
- catch (Exception r)
- {
- if (r instanceof IllegalAccessException)
- {
- writeGranted = false;
- }
- else
- {
- log.error(this, r);
- throw r;
- }
- }
-
- try
- {
- String sensitiveData = pojo.getSensitiveData();
- log.info(sensitiveData);
- assertEquals("Data Must Match!!", sensitiveData,
- "This is Top Secret Data!!! Protect Me!!");
- readGranted = true;
- }
- catch (Exception r)
- {
- if (r instanceof IllegalAccessException)
- {
- readGranted = false;
- }
- else
- {
- throw r;
- }
- }
-
- assertTrue("Read Access Must be Granted!!", readGranted);
- assertTrue("Write Access Must be Granted!!", writeGranted);
- }
-
- // ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------
- private void loginAsAdmin()
- {
- AuthenticatedSession session = new AuthenticatedSession();
-
- session.setUsername("admin");
- session.addRole("admin");
- // session.addRole("/system/admin/badassdude/blah/blah");
-
- AuthenticatedSession.activeSession.set(session);
- }
-
- private void loginAsUser()
- {
- AuthenticatedSession session = new AuthenticatedSession();
-
- session.setUsername("user");
- session.addRole("regular");
-
- AuthenticatedSession.activeSession.set(session);
- }
-}
Added: authz/trunk/samples/secure-pojo/src/test/java/org/jboss/security/authz/samples/pojo/TestTimeBasedSecurity.java
===================================================================
--- authz/trunk/samples/secure-pojo/src/test/java/org/jboss/security/authz/samples/pojo/TestTimeBasedSecurity.java (rev 0)
+++ authz/trunk/samples/secure-pojo/src/test/java/org/jboss/security/authz/samples/pojo/TestTimeBasedSecurity.java 2009-10-05 11:16:15 UTC (rev 816)
@@ -0,0 +1,122 @@
+/*
+ * 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.security.authz.samples.pojo;
+
+import java.util.Calendar;
+
+import org.apache.log4j.Logger;
+
+import org.jboss.security.authz.samples.pojo.provisioning.SecurityProvisioning;
+
+/**
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ */
+public class TestTimeBasedSecurity extends AbstractPOJOTestCase
+{
+ private static Logger log = Logger.getLogger(TestTimeBasedSecurity.class);
+
+ private SecurityProvisioning provisioning;
+
+ public void setUp() throws Exception
+ {
+ super.setUp();
+
+ // Bootup the system with the appropriate Policies
+ provisioning = new SecurityProvisioning();
+ provisioning.bootup(SecurityProvisioning.timebased);
+ }
+
+ public void testAsUser() throws Exception
+ {
+ boolean readGranted = false;
+ this.loginOfficeHours();
+ Pojo pojo = new Pojo();
+ // Read Action on the Pojo
+ try
+ {
+ pojo.getSensitiveData();
+ readGranted = true;
+ }
+ catch (Exception r)
+ {
+ if (r instanceof IllegalAccessException)
+ {
+ readGranted = false;
+ }
+ else
+ {
+ throw r;
+ }
+ }
+ assertTrue("Read Access Must be Granted!!", readGranted);
+
+ this.loginAfterHours();
+ // Read Action on the Pojo
+ try
+ {
+ pojo.getSensitiveData();
+ readGranted = true;
+ }
+ catch (Exception r)
+ {
+ if (r instanceof IllegalAccessException)
+ {
+ readGranted = false;
+ }
+ else
+ {
+ throw r;
+ }
+ }
+ assertFalse("Read Access Must *Not* be Granted!!", readGranted);
+ }
+ // ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+ private void loginOfficeHours()
+ {
+ AuthenticatedSession session = new AuthenticatedSession();
+
+ session.setUsername("user");
+ session.addRole("regular");
+
+ Calendar accessTime = Calendar.getInstance();
+ accessTime.set(Calendar.HOUR_OF_DAY, 8);
+ accessTime.set(Calendar.MINUTE, 0);
+ session.setAccessTime(accessTime.getTime());
+
+ AuthenticatedSession.activeSession.set(session);
+ }
+
+ private void loginAfterHours()
+ {
+ AuthenticatedSession session = new AuthenticatedSession();
+
+ session.setUsername("user");
+ session.addRole("regular");
+
+ Calendar accessTime = Calendar.getInstance();
+ accessTime.set(Calendar.HOUR_OF_DAY, 18);
+ accessTime.set(Calendar.MINUTE, 0);
+ session.setAccessTime(accessTime.getTime());
+
+ AuthenticatedSession.activeSession.set(session);
+ }
+}
14 years, 7 months