[seam-commits] Seam SVN: r13036 - in modules/security/trunk/impl/src/main/java/org/jboss/seam/security: jaas and 4 other directories.
seam-commits at lists.jboss.org
seam-commits at lists.jboss.org
Thu Jun 3 22:29:59 EDT 2010
Author: shane.bryzak at jboss.com
Date: 2010-06-03 22:29:58 -0400 (Thu, 03 Jun 2010)
New Revision: 13036
Modified:
modules/security/trunk/impl/src/main/java/org/jboss/seam/security/CredentialsImpl.java
modules/security/trunk/impl/src/main/java/org/jboss/seam/security/JpaTokenStore.java
modules/security/trunk/impl/src/main/java/org/jboss/seam/security/PasswordCredential.java
modules/security/trunk/impl/src/main/java/org/jboss/seam/security/jaas/SeamLoginModule.java
modules/security/trunk/impl/src/main/java/org/jboss/seam/security/management/IdentityManagerImpl.java
modules/security/trunk/impl/src/main/java/org/jboss/seam/security/management/JpaIdentityStore.java
modules/security/trunk/impl/src/main/java/org/jboss/seam/security/management/action/RoleAction.java
modules/security/trunk/impl/src/main/java/org/jboss/seam/security/management/action/UserAction.java
modules/security/trunk/impl/src/main/java/org/jboss/seam/security/management/action/UserSearch.java
modules/security/trunk/impl/src/main/java/org/jboss/seam/security/management/picketlink/PicketLinkIdentityStore.java
modules/security/trunk/impl/src/main/java/org/jboss/seam/security/permission/JpaPermissionStore.java
Log:
fix compiler errors, JpaIdentityStore config
Modified: modules/security/trunk/impl/src/main/java/org/jboss/seam/security/CredentialsImpl.java
===================================================================
--- modules/security/trunk/impl/src/main/java/org/jboss/seam/security/CredentialsImpl.java 2010-06-03 17:43:51 UTC (rev 13035)
+++ modules/security/trunk/impl/src/main/java/org/jboss/seam/security/CredentialsImpl.java 2010-06-04 02:29:58 UTC (rev 13036)
@@ -86,15 +86,14 @@
{
if (this.credential == null)
{
- this.credential = new PasswordCredential();
- ((PasswordCredential) this.credential).setPassword(password);
+ this.credential = new PasswordCredential(password);
}
else if (this.credential != null && this.credential instanceof PasswordCredential &&
((PasswordCredential) this.credential).getPassword() != password &&
((PasswordCredential) this.credential).getPassword() == null ||
!((PasswordCredential) this.credential).getPassword().equals(password))
{
- ((PasswordCredential) this.credential).setPassword(password);
+ this.credential = new PasswordCredential(password);
invalid = false;
manager.fireEvent(new CredentialsUpdatedEvent());
}
Modified: modules/security/trunk/impl/src/main/java/org/jboss/seam/security/JpaTokenStore.java
===================================================================
--- modules/security/trunk/impl/src/main/java/org/jboss/seam/security/JpaTokenStore.java 2010-06-03 17:43:51 UTC (rev 13035)
+++ modules/security/trunk/impl/src/main/java/org/jboss/seam/security/JpaTokenStore.java 2010-06-04 02:29:58 UTC (rev 13036)
@@ -13,7 +13,7 @@
import org.jboss.seam.security.annotations.TokenUsername;
import org.jboss.seam.security.annotations.TokenValue;
import org.jboss.seam.security.management.IdentityManagementException;
-import org.jboss.weld.extensions.util.properties.AnnotatedBeanProperty;
+import org.jboss.weld.extensions.util.properties.Property;
/**
* A TokenStore implementation, stores tokens inside a database table.
@@ -27,8 +27,8 @@
private Class<?> tokenEntityClass;
- private AnnotatedBeanProperty<TokenUsername> tokenUsernameProperty;
- private AnnotatedBeanProperty<TokenValue> tokenValueProperty;
+ private Property<String> tokenUsernameProperty;
+ private Property<String> tokenValueProperty;
@Inject BeanManager manager;
@@ -37,9 +37,9 @@
@Inject
public void create()
{
- tokenUsernameProperty = new AnnotatedBeanProperty<TokenUsername>(tokenEntityClass, TokenUsername.class);
- tokenValueProperty = new AnnotatedBeanProperty<TokenValue>(tokenEntityClass, TokenValue.class);
-
+ //tokenUsernameProperty = new AnnotatedBeanProperty<TokenUsername>(tokenEntityClass, TokenUsername.class);
+ //tokenValueProperty = new AnnotatedBeanProperty<TokenValue>(tokenEntityClass, TokenValue.class);
+ /*
if (!tokenUsernameProperty.isSet())
{
throw new IllegalStateException("Invalid tokenClass " + tokenEntityClass.getName() +
@@ -50,7 +50,7 @@
{
throw new IllegalStateException("Invalid tokenClass " + tokenEntityClass.getName() +
" - required annotation @TokenValue not found on any Field or Method.");
- }
+ }*/
}
public void createToken(String username, String value)
Modified: modules/security/trunk/impl/src/main/java/org/jboss/seam/security/PasswordCredential.java
===================================================================
--- modules/security/trunk/impl/src/main/java/org/jboss/seam/security/PasswordCredential.java 2010-06-03 17:43:51 UTC (rev 13035)
+++ modules/security/trunk/impl/src/main/java/org/jboss/seam/security/PasswordCredential.java 2010-06-04 02:29:58 UTC (rev 13036)
@@ -15,6 +15,11 @@
private String password;
+ public PasswordCredential(String password)
+ {
+ this.password = password;
+ }
+
public org.picketlink.idm.api.CredentialType getType()
{
return CREDENTIAL_TYPE;
@@ -24,9 +29,4 @@
{
return password;
}
-
- public void setPassword(String password)
- {
- this.password = password;
- }
}
Modified: modules/security/trunk/impl/src/main/java/org/jboss/seam/security/jaas/SeamLoginModule.java
===================================================================
--- modules/security/trunk/impl/src/main/java/org/jboss/seam/security/jaas/SeamLoginModule.java 2010-06-03 17:43:51 UTC (rev 13035)
+++ modules/security/trunk/impl/src/main/java/org/jboss/seam/security/jaas/SeamLoginModule.java 2010-06-04 02:29:58 UTC (rev 13036)
@@ -12,6 +12,7 @@
import javax.security.auth.login.LoginException;
import javax.security.auth.spi.LoginModule;
+import org.jboss.seam.security.PasswordCredential;
import org.jboss.seam.security.SimplePrincipal;
import org.jboss.seam.security.callbacks.AuthenticatorCallback;
import org.jboss.seam.security.callbacks.IdentityCallback;
@@ -83,10 +84,10 @@
// Otherwise if identity management is enabled, use it.
IdentityManager identityManager = idmCallback.getIdentityManager();
- if (identityManager != null && identityManager.isEnabled())
+ if (identityManager != null)
{
boolean success = identityManager.authenticate(username,
- new String(cbPassword.getPassword()));
+ new PasswordCredential(new String(cbPassword.getPassword())));
if (success)
{
Modified: modules/security/trunk/impl/src/main/java/org/jboss/seam/security/management/IdentityManagerImpl.java
===================================================================
--- modules/security/trunk/impl/src/main/java/org/jboss/seam/security/management/IdentityManagerImpl.java 2010-06-03 17:43:51 UTC (rev 13035)
+++ modules/security/trunk/impl/src/main/java/org/jboss/seam/security/management/IdentityManagerImpl.java 2010-06-04 02:29:58 UTC (rev 13036)
@@ -174,12 +174,7 @@
identity.checkPermission(GROUP_PERMISSION_NAME, PERMISSION_DELETE);
return groupIdentityStore.deleteGroup(groupName, groupType);
}
-
- public boolean removeFromGroup(String username, Group group)
- {
- return groupIdentityStore.removeUserFromGroup(username, group);
- }
-
+
public boolean userExists(String name)
{
identity.checkPermission(USER_PERMISSION_NAME, PERMISSION_READ);
Modified: modules/security/trunk/impl/src/main/java/org/jboss/seam/security/management/JpaIdentityStore.java
===================================================================
--- modules/security/trunk/impl/src/main/java/org/jboss/seam/security/management/JpaIdentityStore.java 2010-06-03 17:43:51 UTC (rev 13035)
+++ modules/security/trunk/impl/src/main/java/org/jboss/seam/security/management/JpaIdentityStore.java 2010-06-04 02:29:58 UTC (rev 13036)
@@ -1,6 +1,10 @@
package org.jboss.seam.security.management;
import java.io.Serializable;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.AnnotatedElement;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -13,8 +17,12 @@
import org.jboss.seam.security.annotations.management.IdentityProperty;
import org.jboss.seam.security.annotations.management.PropertyType;
-import org.jboss.weld.extensions.util.properties.AnnotatedBeanProperty;
-import org.jboss.weld.extensions.util.properties.TypedBeanProperty;
+import org.jboss.weld.extensions.util.properties.Property;
+import org.jboss.weld.extensions.util.properties.query.AnnotatedPropertyCriteria;
+import org.jboss.weld.extensions.util.properties.query.NamedPropertyCriteria;
+import org.jboss.weld.extensions.util.properties.query.PropertyCriteria;
+import org.jboss.weld.extensions.util.properties.query.PropertyQueries;
+import org.jboss.weld.extensions.util.properties.query.TypedPropertyCriteria;
import org.picketlink.idm.api.Credential;
import org.picketlink.idm.api.Group;
import org.picketlink.idm.api.IdentityType;
@@ -32,6 +40,8 @@
{
private static final long serialVersionUID = 7729139146633529501L;
+ private Logger log = LoggerFactory.getLogger(JpaIdentityStore.class);
+
private static final String DEFAULT_USER_IDENTITY_TYPE = "USER";
private static final String DEFAULT_ROLE_IDENTITY_TYPE = "ROLE";
private static final String DEFAULT_GROUP_IDENTITY_TYPE = "GROUP";
@@ -41,44 +51,22 @@
private static final String DEFAULT_ATTRIBUTE_USER_ENABLED = "ENABLED";
private static final String DEFAULT_ATTRIBUTE_PASSWORD_SALT = "PASSWORD_SALT";
+
+ // Property keys
+
+ private static final String PROPERTY_IDENTITY_NAME = "IDENTITY_NAME";
- private Logger log = LoggerFactory.getLogger(JpaIdentityStore.class);
+ // Entity classes
- // The following entity classes are configurable
- private Class<?> identityObjectEntity;
- private Class<?> relationshipEntity;
- private Class<?> credentialEntity;
- private Class<?> attributeEntity;
- private Class<?> roleTypeEntity;
+ private Class<?> identityClass;
+ private Class<?> identityTypeClass;
+ private Class<?> relationshipClass;
+ private Class<?> relationshipTypeClass;
+ private Class<?> credentialClass;
+ private Class<?> credentialTypeClass;
+ private Class<?> attributeClass;
+ private Class<?> roleTypeClass;
- // The following entity classes may be determined automatically
- private Class<?> identityTypeEntity;
- private Class<?> relationshipTypeEntity;
- private Class<?> credentialTypeEntity;
-
- private AnnotatedBeanProperty<IdentityProperty> identityNameProperty;
- private AnnotatedBeanProperty<IdentityProperty> identityTypeProperty;
- private AnnotatedBeanProperty<IdentityProperty> identityTypeNameProperty;
-
- private AnnotatedBeanProperty<IdentityProperty> relationshipNameProperty;
- private AnnotatedBeanProperty<IdentityProperty> relationshipTypeProperty;
- private AnnotatedBeanProperty<IdentityProperty> relationshipFromProperty;
- private AnnotatedBeanProperty<IdentityProperty> relationshipToProperty;
- private AnnotatedBeanProperty<IdentityProperty> relationshipTypeNameProperty;
-
- private AnnotatedBeanProperty<IdentityProperty> credentialTypeProperty;
- private AnnotatedBeanProperty<IdentityProperty> credentialValueProperty;
- private AnnotatedBeanProperty<IdentityProperty> credentialTypeNameProperty;
- private TypedBeanProperty credentialIdentityProperty;
-
- private AnnotatedBeanProperty<IdentityProperty> attributeNameProperty;
- private AnnotatedBeanProperty<IdentityProperty> attributeValueProperty;
-
- private AnnotatedBeanProperty<IdentityProperty> roleTypeNameProperty;
-
- private Map<String,AnnotatedBeanProperty<IdentityProperty>> annotatedProperties =
- new HashMap<String,AnnotatedBeanProperty<IdentityProperty>>();
-
private String userIdentityType = DEFAULT_USER_IDENTITY_TYPE;
private String roleIdentityType = DEFAULT_ROLE_IDENTITY_TYPE;
private String groupIdentityType = DEFAULT_GROUP_IDENTITY_TYPE;
@@ -86,39 +74,118 @@
private String relationshipTypeMembership = DEFAULT_RELATIONSHIP_TYPE_MEMBERSHIP;
private String relationshipTypeRole = DEFAULT_RELATIONSHIP_TYPE_ROLE;
- private class EntityProperty extends AnnotatedBeanProperty<IdentityProperty>
+ /**
+ * Model properties
+ */
+ private Map<String,Property<?>> modelProperties = new HashMap<String,Property<?>>();
+
+ private class PropertyTypeCriteria implements PropertyCriteria
{
- private PropertyType pt;
+ private PropertyType pt;
- public EntityProperty(Class<?> cls, PropertyType pt)
+ public PropertyTypeCriteria(PropertyType pt)
{
- super(cls, IdentityProperty.class);
- this.pt = pt;
+ this.pt = pt;
}
-
- public boolean annotationMatches(IdentityProperty p)
+
+ public boolean fieldMatches(Field f)
{
- return p.value().equals(pt);
- }
+ return f.isAnnotationPresent(IdentityProperty.class) &&
+ f.getAnnotation(IdentityProperty.class).value().equals(pt);
+ }
+
+ public boolean methodMatches(Method m)
+ {
+ return m.isAnnotationPresent(IdentityProperty.class) &&
+ m.getAnnotation(IdentityProperty.class).value().equals(pt);
+ }
+
}
-
+
@Inject
public void init()
{
- if (identityObjectEntity == null)
+ configureIdentityName();
+ configureIdentityType();
+
+ //configureCredentials();
+ //configureRelationships();
+ //configureAttributes();
+
+ //roleTypeNameProperty = new EntityProperty(roleTypeEntity, PropertyType.NAME);
+ }
+
+ protected void configureIdentityName()
+ {
+ if (identityClass == null)
{
throw new IdentityManagementException(
- "Error initializing JpaIdentityStore - identityObjectEntity not set");
+ "Error initializing JpaIdentityStore - identityClass not set");
}
- if (relationshipEntity == null)
+ List<Property<String>> props = PropertyQueries.<String>createPropertyQuery(identityClass)
+ .addCriteria(new PropertyTypeCriteria(PropertyType.NAME))
+ .getResultList();
+
+ if (props.size() == 1)
{
+ modelProperties.put(PROPERTY_IDENTITY_NAME, props.get(0));
+ }
+ else if (props.size() > 1)
+ {
throw new IdentityManagementException(
- "Error initializing JpaIdentityStore - identityObjectRelationshipEntity not set");
+ "Ambiguous identity name property in identity class " + identityClass.getName());
}
-
- identityNameProperty = new EntityProperty(identityObjectEntity, PropertyType.NAME);
-
+ else
+ {
+ // No name property explicitly configured, let's query by property name
+ String[] possibleNames = new String[] { "name", "username", "userName" };
+ props = PropertyQueries.<String>createPropertyQuery(identityClass)
+ .addCriteria(new NamedPropertyCriteria(possibleNames))
+ .getResultList();
+
+ if (props.size() == 1)
+ {
+ // Bingo, use the name property
+ modelProperties.put(PROPERTY_IDENTITY_NAME, props.get(0));
+ }
+ else if (props.size() > 1)
+ {
+ // order of precedence -> username, userName, name
+ search: for (String name : possibleNames)
+ {
+ for (Property<String> p : props)
+ {
+ if (name.equals(p.getName()))
+ {
+ modelProperties.put(PROPERTY_IDENTITY_NAME, p);
+ break search;
+ }
+ }
+ }
+ }
+ else if (props.isEmpty())
+ {
+ // Last resort - check whether the entity class exposes a single String property
+ // if so, let's assume it's the identity name
+ props = PropertyQueries.<String>createPropertyQuery(identityClass)
+ .addCriteria(new TypedPropertyCriteria(String.class))
+ .getResultList();
+ if (props.size() == 1)
+ {
+ modelProperties.put(PROPERTY_IDENTITY_NAME, props.get(0));
+ }
+ }
+ }
+
+ if (!modelProperties.containsKey(PROPERTY_IDENTITY_NAME))
+ {
+ throw new IdentityManagementException("Error initializing JpaIdentityStore - no valid identity name property found.");
+ }
+ }
+
+ protected void configureIdentityType()
+ {
identityTypeProperty = new EntityProperty(identityObjectEntity, PropertyType.TYPE);
if (!String.class.equals(identityTypeProperty.getPropertyType()))
@@ -129,20 +196,11 @@
identityTypeNameProperty = new EntityProperty(identityTypeEntity, PropertyType.NAME);
}
- relationshipNameProperty = new EntityProperty(relationshipEntity, PropertyType.NAME);
-
- relationshipFromProperty = new EntityProperty(relationshipEntity, PropertyType.RELATIONSHIP_FROM);
-
- relationshipToProperty = new EntityProperty(relationshipEntity, PropertyType.RELATIONSHIP_TO);
-
- relationshipTypeProperty = new EntityProperty(relationshipEntity, PropertyType.TYPE);
-
- if (!String.class.equals(relationshipTypeProperty.getPropertyType()))
- {
- relationshipTypeEntity = (Class<?>) relationshipTypeProperty.getPropertyType();
- relationshipTypeNameProperty = new EntityProperty(relationshipTypeEntity, PropertyType.NAME);
- }
-
+
+ }
+
+ protected void configureCredentials()
+ {
// If a credential entity has been configured, scan it
if (credentialEntity != null)
{
@@ -169,9 +227,40 @@
credentialValueProperty = new EntityProperty(identityObjectEntity, PropertyType.CREDENTIAL);
}
- roleTypeNameProperty = new EntityProperty(roleTypeEntity, PropertyType.NAME);
+
}
+ protected void configureRelationships()
+ {
+ if (relationshipEntity == null)
+ {
+ throw new IdentityManagementException(
+ "Error initializing JpaIdentityStore - identityObjectRelationshipEntity not set");
+ }
+
+ relationshipNameProperty = new EntityProperty(relationshipEntity, PropertyType.NAME);
+
+ relationshipFromProperty = new EntityProperty(relationshipEntity, PropertyType.RELATIONSHIP_FROM);
+
+ relationshipToProperty = new EntityProperty(relationshipEntity, PropertyType.RELATIONSHIP_TO);
+
+ relationshipTypeProperty = new EntityProperty(relationshipEntity, PropertyType.TYPE);
+
+ if (!String.class.equals(relationshipTypeProperty.getPropertyType()))
+ {
+ relationshipTypeEntity = (Class<?>) relationshipTypeProperty.getPropertyType();
+ relationshipTypeNameProperty = new EntityProperty(relationshipTypeEntity, PropertyType.NAME);
+ }
+
+
+ }
+
+ protected void configureAttributes()
+ {
+
+ }
+
+
public Class<?> getIdentityObjectEntity()
{
return identityObjectEntity;
Modified: modules/security/trunk/impl/src/main/java/org/jboss/seam/security/management/action/RoleAction.java
===================================================================
--- modules/security/trunk/impl/src/main/java/org/jboss/seam/security/management/action/RoleAction.java 2010-06-03 17:43:51 UTC (rev 13035)
+++ modules/security/trunk/impl/src/main/java/org/jboss/seam/security/management/action/RoleAction.java 2010-06-04 02:29:58 UTC (rev 13036)
@@ -43,14 +43,16 @@
//identityManager.deleteRole(originalRole);
}
- if (identityManager.roleTypeExists(role))
+ /*if (identityManager.roleTypeExists(role))
{
return saveExistingRole();
}
else
{
return saveNewRole();
- }
+ }*/
+
+ return null;
}
private String saveNewRole()
Modified: modules/security/trunk/impl/src/main/java/org/jboss/seam/security/management/action/UserAction.java
===================================================================
--- modules/security/trunk/impl/src/main/java/org/jboss/seam/security/management/action/UserAction.java 2010-06-03 17:43:51 UTC (rev 13035)
+++ modules/security/trunk/impl/src/main/java/org/jboss/seam/security/management/action/UserAction.java 2010-06-04 02:29:58 UTC (rev 13036)
@@ -9,6 +9,7 @@
import javax.inject.Inject;
import javax.inject.Named;
+import org.jboss.seam.security.PasswordCredential;
import org.jboss.seam.security.management.IdentityManager;
import org.picketlink.idm.api.Role;
@@ -73,7 +74,7 @@
return "failure";
}
- boolean success = identityManager.createUser(username, password);
+ boolean success = identityManager.createUser(username, new PasswordCredential(password));
if (success)
{
@@ -108,7 +109,7 @@
}
else
{
- identityManager.changePassword(username, password);
+ identityManager.updateCredential(username, new PasswordCredential(password));
}
}
@@ -119,7 +120,8 @@
for (Role role : grantedRoles)
{
if (!roles.contains(role)) identityManager.revokeRole(username,
- role.getRoleType().getName(), role.getGroup());
+ role.getRoleType().getName(), role.getGroup().getName(),
+ role.getGroup().getGroupType());
}
}
@@ -127,7 +129,8 @@
{
if (grantedRoles == null || !grantedRoles.contains(role))
{
- identityManager.grantRole(username, role.getRoleType().getName(), role.getGroup());
+ identityManager.grantRole(username, role.getRoleType().getName(),
+ role.getGroup().getName(), role.getGroup().getGroupType());
}
}
Modified: modules/security/trunk/impl/src/main/java/org/jboss/seam/security/management/action/UserSearch.java
===================================================================
--- modules/security/trunk/impl/src/main/java/org/jboss/seam/security/management/action/UserSearch.java 2010-06-03 17:43:51 UTC (rev 13035)
+++ modules/security/trunk/impl/src/main/java/org/jboss/seam/security/management/action/UserSearch.java 2010-06-04 02:29:58 UTC (rev 13036)
@@ -24,7 +24,7 @@
public void loadUsers()
{
- users = identityManager.getUsers();
+ users = identityManager.findUsers(null);
}
public String getUserRoles(String username)
Modified: modules/security/trunk/impl/src/main/java/org/jboss/seam/security/management/picketlink/PicketLinkIdentityStore.java
===================================================================
--- modules/security/trunk/impl/src/main/java/org/jboss/seam/security/management/picketlink/PicketLinkIdentityStore.java 2010-06-03 17:43:51 UTC (rev 13035)
+++ modules/security/trunk/impl/src/main/java/org/jboss/seam/security/management/picketlink/PicketLinkIdentityStore.java 2010-06-04 02:29:58 UTC (rev 13036)
@@ -1,15 +1,16 @@
package org.jboss.seam.security.management.picketlink;
import java.util.List;
+import java.util.Map;
import javax.enterprise.context.Dependent;
import javax.inject.Inject;
import org.jboss.seam.security.management.IdentityStore;
+import org.picketlink.idm.api.Credential;
import org.picketlink.idm.api.Group;
import org.picketlink.idm.api.IdentitySession;
import org.picketlink.idm.api.IdentityType;
-import org.picketlink.idm.api.PersistenceManager;
import org.picketlink.idm.api.Role;
@Dependent
@@ -17,233 +18,189 @@
{
@Inject IdentitySession identitySession;
- public boolean createGroup(String name)
+ public boolean associateGroup(String groupName, String groupType,
+ String memberGroupName, String memberGroupType)
{
// TODO Auto-generated method stub
- PersistenceManager pm = identitySession.getPersistenceManager();
-
return false;
}
-
-
- public boolean addUserToGroup(String username, Group group)
+ public boolean associateUser(String groupName, String groupType,
+ String username)
{
// TODO Auto-generated method stub
return false;
}
-
-
- public boolean authenticate(String username, String password)
+ public boolean authenticate(String username, Credential credential)
{
// TODO Auto-generated method stub
return false;
}
-
-
- public boolean changePassword(String username, String password)
+ public boolean createGroup(String name, String groupType)
{
// TODO Auto-generated method stub
return false;
}
-
-
- public boolean createGroup(String name, String groupType)
+ public boolean createRoleType(String roleType)
{
// TODO Auto-generated method stub
return false;
}
-
-
- public boolean createRoleType(String roleType)
+ public boolean createUser(String username, Credential credential,
+ Map<String, ?> attributes)
{
// TODO Auto-generated method stub
return false;
}
-
-
- public boolean createUser(String username, String password)
+ public boolean deleteGroup(String name, String groupType)
{
// TODO Auto-generated method stub
return false;
}
-
-
- public boolean createUser(String username, String password,
- String firstname, String lastname)
+ public boolean deleteRoleType(String roleType)
{
// TODO Auto-generated method stub
return false;
}
-
-
- public boolean deleteGroup(String name, String groupType)
+ public boolean deleteUser(String username)
{
// TODO Auto-generated method stub
return false;
}
-
-
- public boolean deleteRoleType(String roleType)
+ public boolean deleteUserAttribute(String username, String attribute)
{
// TODO Auto-generated method stub
return false;
}
-
-
- public boolean deleteUser(String username)
+ public boolean disableUser(String username)
{
// TODO Auto-generated method stub
return false;
}
-
-
- public boolean disableUser(String username)
+ public boolean disassociateGroup(String groupName, String groupType,
+ String memberGroupName, String memberGroupType)
{
// TODO Auto-generated method stub
return false;
}
-
-
- public boolean enableUser(String username)
+ public boolean disassociateUser(String groupName, String groupType,
+ String username)
{
// TODO Auto-generated method stub
return false;
}
-
-
- public Group findGroup(String name, String groupType)
+ public boolean enableUser(String username)
{
// TODO Auto-generated method stub
- return null;
+ return false;
}
-
-
- public List<String> findUsers()
+ public Group findGroup(String name, String groupType)
{
// TODO Auto-generated method stub
return null;
}
-
-
public List<String> findUsers(String filter)
{
// TODO Auto-generated method stub
return null;
}
-
-
- public boolean grantRole(String username, String roleType, Group group)
+ public boolean grantRole(String username, String roleType, String groupName,
+ String groupType)
{
// TODO Auto-generated method stub
return false;
}
-
-
public boolean isUserEnabled(String username)
{
// TODO Auto-generated method stub
return false;
}
-
-
public List<String> listGrantableRoleTypes()
{
// TODO Auto-generated method stub
return null;
}
-
-
public List<Role> listGrantedRoles(String username)
{
// TODO Auto-generated method stub
return null;
}
-
-
public List<IdentityType> listGroupMembers(Group group)
{
// TODO Auto-generated method stub
return null;
}
-
-
public List<Role> listImpliedRoles(String username)
{
// TODO Auto-generated method stub
return null;
}
-
-
- public List<IdentityType> listRoleMembers(String roleType, Group group)
+ public List<IdentityType> listRoleMembers(String roleType, String groupName,
+ String groupType)
{
// TODO Auto-generated method stub
return null;
}
-
-
public List<String> listRoleTypes()
{
// TODO Auto-generated method stub
return null;
}
-
-
- public boolean removeUserFromGroup(String username, Group group)
+ public boolean revokeRole(String username, String roleType,
+ String groupName, String groupType)
{
// TODO Auto-generated method stub
return false;
}
-
-
- public boolean revokeRole(String username, String roleType, Group group)
+ public boolean roleTypeExists(String roleType)
{
// TODO Auto-generated method stub
return false;
}
-
-
- public boolean roleTypeExists(String roleType)
+ public boolean setUserAttribute(String username, String attribute,
+ Object value)
{
// TODO Auto-generated method stub
return false;
}
-
-
public boolean supportsFeature(Feature feature)
{
// TODO Auto-generated method stub
return false;
}
+ public boolean updateCredential(String username, Credential credential)
+ {
+ // TODO Auto-generated method stub
+ return false;
+ }
-
public boolean userExists(String username)
{
// TODO Auto-generated method stub
Modified: modules/security/trunk/impl/src/main/java/org/jboss/seam/security/permission/JpaPermissionStore.java
===================================================================
--- modules/security/trunk/impl/src/main/java/org/jboss/seam/security/permission/JpaPermissionStore.java 2010-06-03 17:43:51 UTC (rev 13035)
+++ modules/security/trunk/impl/src/main/java/org/jboss/seam/security/permission/JpaPermissionStore.java 2010-06-04 02:29:58 UTC (rev 13036)
@@ -24,7 +24,7 @@
import org.jboss.seam.security.annotations.permission.PermissionTarget;
import org.jboss.seam.security.management.IdentityManager;
import org.jboss.seam.security.permission.PermissionMetadata.ActionSet;
-import org.jboss.weld.extensions.util.properties.AnnotatedBeanProperty;
+import org.jboss.weld.extensions.util.properties.Property;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -45,15 +45,15 @@
private Class<?> userPermissionClass;
private Class<?> rolePermissionClass;
- private AnnotatedBeanProperty<PermissionRecipient> recipientProperty;
- private AnnotatedBeanProperty<PermissionRole> roleProperty;
+ private Property recipientProperty;
+ private Property roleProperty;
- private AnnotatedBeanProperty<PermissionTarget> targetProperty;
- private AnnotatedBeanProperty<PermissionAction> actionProperty;
- private AnnotatedBeanProperty<PermissionRecipientType> recipientTypeProperty;
+ private Property<String> targetProperty;
+ private Property<String> actionProperty;
+ private Property<String> recipientTypeProperty;
- private AnnotatedBeanProperty<PermissionTarget> roleTargetProperty;
- private AnnotatedBeanProperty<PermissionAction> roleActionProperty;
+ private Property<String> roleTargetProperty;
+ private Property<String> roleActionProperty;
private Map<Integer,String> queryCache = new HashMap<Integer,String>();
@@ -107,7 +107,7 @@
PermissionRecipientType.class);
}
}
- */
+
if (!recipientProperty.isSet())
{
throw new RuntimeException("Invalid userPermissionClass " + userPermissionClass.getName() +
@@ -139,7 +139,7 @@
throw new RuntimeException("Invalid userPermissionClass " + userPermissionClass.getName() +
" - no rolePermissionClass set and @PermissionDiscriminator annotation not found on " +
"any Field or Method");
- }
+ }*/
}
/**
@@ -338,7 +338,7 @@
return true;
}
- if (!recipientTypeProperty.isSet())
+ if (recipientTypeProperty == null)
{
throw new RuntimeException("Could not grant permission, rolePermissionClass not set");
}
@@ -375,9 +375,10 @@
recipientProperty.setValue(instance, resolvePrincipalEntity(recipient));
}
- if (recipientTypeProperty.isSet())
+ if (recipientTypeProperty != null)
{
- PermissionRecipientType discriminator = recipientTypeProperty.getAnnotation();
+ PermissionRecipientType discriminator = recipientTypeProperty
+ .getAnnotatedElement().getAnnotation(PermissionRecipientType.class);
// TODO need to populate the correct recipient type
//recipientTypeProperty.setValue(instance, recipientIsRole ? discriminator.roleValue() :
// discriminator.userValue());
@@ -514,7 +515,8 @@
private String getDiscriminatorValue(boolean isRole)
{
- PermissionRecipientType discriminator = recipientTypeProperty.getAnnotation();
+ PermissionRecipientType discriminator = recipientTypeProperty
+ .getAnnotatedElement().getAnnotation(PermissionRecipientType.class);
// TODO fix
//return isRole ? discriminator.roleValue() : discriminator.userValue();
return null;
@@ -532,13 +534,13 @@
{
boolean recipientIsRole = recipient instanceof RoleImpl;
- if (identityManager.getIdentityStore() != null //&&
+ //if (identityManager.getIdentityStore() != null //&&
//identityManager.getIdentityStore() instanceof JpaIdentityStore)
- )
+ // )
{
// TODO review this code
- if (recipientIsRole && roleProperty.isSet() //&&
+ if (recipientIsRole && roleProperty != null //&&
//roleProperty.getPropertyType().equals(config.getRoleEntityClass()))
)
{
@@ -556,9 +558,7 @@
}
protected Principal resolvePrincipal(Object principal, boolean isUser)
- {
- identityManager.getRoleIdentityStore();
-
+ {
// TODO review this
/*
@@ -622,7 +622,7 @@
Map<String,Principal> principalCache = new HashMap<String,Principal>();
- boolean useDiscriminator = rolePermissionClass == null && recipientTypeProperty.isSet();
+ boolean useDiscriminator = rolePermissionClass == null && recipientTypeProperty != null;
Map<String,Object> identifierCache = null;
More information about the seam-commits
mailing list