Author: anil.saldhana(a)jboss.com
Date: 2008-07-14 13:26:07 -0400 (Mon, 14 Jul 2008)
New Revision: 25
Added:
trunk/identity-model/src/main/java/org/jboss/identity/model/attribute/
trunk/identity-model/src/main/java/org/jboss/identity/model/attribute/PasswordAttribute.java
trunk/identity-model/src/main/java/org/jboss/identity/model/policy/
trunk/identity-model/src/main/java/org/jboss/identity/model/policy/IdentityTypePolicy.java
trunk/identity-model/src/main/java/org/jboss/identity/model/policy/PasswordExpirationPolicy.java
trunk/identity-model/src/main/java/org/jboss/identity/model/policy/PolicyValidationException.java
trunk/identity-model/src/main/java/org/jboss/identity/model/policy/RelationshipPolicy.java
Modified:
trunk/identity-model/src/main/java/org/jboss/identity/model/groups/Group.java
Log:
JBID-15: weave in policy
Added:
trunk/identity-model/src/main/java/org/jboss/identity/model/attribute/PasswordAttribute.java
===================================================================
---
trunk/identity-model/src/main/java/org/jboss/identity/model/attribute/PasswordAttribute.java
(rev 0)
+++
trunk/identity-model/src/main/java/org/jboss/identity/model/attribute/PasswordAttribute.java 2008-07-14
17:26:07 UTC (rev 25)
@@ -0,0 +1,68 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.identity.model.attribute;
+
+import java.util.Date;
+
+import org.jboss.identity.model.IdentityAttribute;
+import org.jboss.identity.model.IdentityType;
+import org.jboss.identity.model.policy.PasswordExpirationPolicy;
+
+/**
+ * Represents a password
+ * @author Anil.Saldhana(a)redhat.com
+ * @since Jul 13, 2008
+ */
+public class PasswordAttribute<T extends IdentityType>
+implements IdentityAttribute
+{
+ /**
+ * Password policy governing this attribute.
+ * A null value indicates that there is no policy.
+ */
+ protected PasswordExpirationPolicy<T> passwordPolicy;
+
+ /**
+ * Get the date time when the password was last updated.
+ * The update can be based on password expiration.
+ */
+ protected Date lastUpdated = new Date();
+
+ public PasswordAttribute()
+ {
+ }
+
+ public PasswordAttribute(PasswordExpirationPolicy<T> aPasswordPolicy)
+ {
+ this.passwordPolicy = aPasswordPolicy;
+ }
+
+ public PasswordExpirationPolicy<T> getPasswordPolicy()
+ {
+ return passwordPolicy;
+ }
+
+ public void setPasswordPolicy(PasswordExpirationPolicy<T> passwordPolicy)
+ {
+ this.passwordPolicy = passwordPolicy;
+ }
+}
\ No newline at end of file
Modified: trunk/identity-model/src/main/java/org/jboss/identity/model/groups/Group.java
===================================================================
---
trunk/identity-model/src/main/java/org/jboss/identity/model/groups/Group.java 2008-07-11
16:33:16 UTC (rev 24)
+++
trunk/identity-model/src/main/java/org/jboss/identity/model/groups/Group.java 2008-07-14
17:26:07 UTC (rev 25)
@@ -24,10 +24,12 @@
*/
package org.jboss.identity.model.groups;
+import java.util.Collection;
import java.util.List;
import org.jboss.identity.model.IdentityType;
import org.jboss.identity.model.Role;
+import org.jboss.identity.model.policy.RelationshipPolicy;
/**
* Represents a Group
@@ -61,4 +63,22 @@
* @return
*/
List<Group> getSubGroups();
+
+ /**
+ * Add a relationship policy
+ * @param aRelationPolicy
+ */
+ void add(RelationshipPolicy<Group,Group> aRelationPolicy);
+
+ /**
+ * Add a collection of relationship policies
+ * @param relationList
+ */
+ void addAll(Collection<RelationshipPolicy<Group,Group>> relationList);
+
+ /**
+ * Return a list of relationship policies
+ * @return
+ */
+ List<RelationshipPolicy<Group,Group>> getRelationshipPolicies();
}
\ No newline at end of file
Added:
trunk/identity-model/src/main/java/org/jboss/identity/model/policy/IdentityTypePolicy.java
===================================================================
---
trunk/identity-model/src/main/java/org/jboss/identity/model/policy/IdentityTypePolicy.java
(rev 0)
+++
trunk/identity-model/src/main/java/org/jboss/identity/model/policy/IdentityTypePolicy.java 2008-07-14
17:26:07 UTC (rev 25)
@@ -0,0 +1,32 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.identity.model.policy;
+
+/**
+ * Marker Interface to indicate a policy
+ * that governs one or more IdentityType(s)
+ * @author Anil.Saldhana(a)redhat.com
+ * @since Jul 13, 2008
+ */
+public interface IdentityTypePolicy
+{
+}
\ No newline at end of file
Added:
trunk/identity-model/src/main/java/org/jboss/identity/model/policy/PasswordExpirationPolicy.java
===================================================================
---
trunk/identity-model/src/main/java/org/jboss/identity/model/policy/PasswordExpirationPolicy.java
(rev 0)
+++
trunk/identity-model/src/main/java/org/jboss/identity/model/policy/PasswordExpirationPolicy.java 2008-07-14
17:26:07 UTC (rev 25)
@@ -0,0 +1,34 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.identity.model.policy;
+
+import org.jboss.identity.model.IdentityType;
+
+/**
+ * Policy to govern Passwords
+ * @author Anil.Saldhana(a)redhat.com
+ * @since Jul 13, 2008
+ */
+public interface PasswordExpirationPolicy<P extends IdentityType>
+extends IdentityTypePolicy
+{
+}
\ No newline at end of file
Added:
trunk/identity-model/src/main/java/org/jboss/identity/model/policy/PolicyValidationException.java
===================================================================
---
trunk/identity-model/src/main/java/org/jboss/identity/model/policy/PolicyValidationException.java
(rev 0)
+++
trunk/identity-model/src/main/java/org/jboss/identity/model/policy/PolicyValidationException.java 2008-07-14
17:26:07 UTC (rev 25)
@@ -0,0 +1,34 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.identity.model.policy;
+
+import java.security.GeneralSecurityException;
+
+/**
+ * Exception to denote failure in policy
+ * @author Anil.Saldhana(a)redhat.com
+ * @since Jul 13, 2008
+ */
+public class PolicyValidationException extends GeneralSecurityException
+{
+ private static final long serialVersionUID = 1L;
+}
\ No newline at end of file
Added:
trunk/identity-model/src/main/java/org/jboss/identity/model/policy/RelationshipPolicy.java
===================================================================
---
trunk/identity-model/src/main/java/org/jboss/identity/model/policy/RelationshipPolicy.java
(rev 0)
+++
trunk/identity-model/src/main/java/org/jboss/identity/model/policy/RelationshipPolicy.java 2008-07-14
17:26:07 UTC (rev 25)
@@ -0,0 +1,49 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.identity.model.policy;
+
+import org.jboss.identity.model.IdentityType;
+
+/**
+ * A Policy that governs the Relationships
+ * @author Anil.Saldhana(a)redhat.com
+ * @since Jul 13, 2008
+ */
+public interface RelationshipPolicy<P extends IdentityType, Q extends IdentityType>
+extends IdentityTypePolicy
+{
+ /**
+ * Define a relationship
+ * @param pIdentityType
+ * @param qIdentityType
+ */
+ void definePolicy(P pIdentityType, Q qIdentityType);
+
+ /**
+ * Validate a relationship
+ * @param typeA first type
+ * @param typeB second type
+ * @throws PolicyValidationException
+ */
+ void validate(P typeA, Q typeB)
+ throws PolicyValidationException;
+}
\ No newline at end of file