[seam-commits] Seam SVN: r10728 - in modules/trunk/security/src/main/java/org/jboss/seam/security: management and 1 other directory.
seam-commits at lists.jboss.org
seam-commits at lists.jboss.org
Wed Apr 29 19:56:19 EDT 2009
Author: shane.bryzak at jboss.com
Date: 2009-04-29 19:56:18 -0400 (Wed, 29 Apr 2009)
New Revision: 10728
Modified:
modules/trunk/security/src/main/java/org/jboss/seam/security/Identity.java
modules/trunk/security/src/main/java/org/jboss/seam/security/management/IdentityManagementException.java
modules/trunk/security/src/main/java/org/jboss/seam/security/management/IdentityStore.java
modules/trunk/security/src/main/java/org/jboss/seam/security/management/JpaIdentityStore.java
modules/trunk/security/src/main/java/org/jboss/seam/security/management/LdapIdentityStore.java
modules/trunk/security/src/main/java/org/jboss/seam/security/management/NoSuchRoleException.java
modules/trunk/security/src/main/java/org/jboss/seam/security/management/NoSuchUserException.java
Log:
get JpaIdentityStore compiling, fixed other warnings
Modified: modules/trunk/security/src/main/java/org/jboss/seam/security/Identity.java
===================================================================
--- modules/trunk/security/src/main/java/org/jboss/seam/security/Identity.java 2009-04-29 23:00:22 UTC (rev 10727)
+++ modules/trunk/security/src/main/java/org/jboss/seam/security/Identity.java 2009-04-29 23:56:18 UTC (rev 10728)
@@ -26,8 +26,6 @@
import javax.security.auth.login.LoginContext;
import javax.security.auth.login.LoginException;
-import org.jboss.webbeans.log.LogProvider;
-import org.jboss.webbeans.log.Logging;
import org.jboss.seam.security.callbacks.AuthenticatorCallback;
import org.jboss.seam.security.callbacks.IdentityCallback;
import org.jboss.seam.security.callbacks.IdentityManagerCallback;
@@ -42,6 +40,8 @@
import org.jboss.seam.security.events.QuietLoginEvent;
import org.jboss.seam.security.management.IdentityManager;
import org.jboss.seam.security.permission.PermissionMapper;
+import org.jboss.webbeans.log.LogProvider;
+import org.jboss.webbeans.log.Logging;
/**
* API for authorization and authentication via Seam security.
@@ -570,7 +570,7 @@
}
}
- public void filterByPermission(Collection collection, String action)
+ public void filterByPermission(Collection<?> collection, String action)
{
permissionMapper.filterByPermission(collection, action);
}
Modified: modules/trunk/security/src/main/java/org/jboss/seam/security/management/IdentityManagementException.java
===================================================================
--- modules/trunk/security/src/main/java/org/jboss/seam/security/management/IdentityManagementException.java 2009-04-29 23:00:22 UTC (rev 10727)
+++ modules/trunk/security/src/main/java/org/jboss/seam/security/management/IdentityManagementException.java 2009-04-29 23:56:18 UTC (rev 10728)
@@ -7,6 +7,8 @@
*/
public class IdentityManagementException extends RuntimeException
{
+ private static final long serialVersionUID = -8682163627028954352L;
+
public IdentityManagementException(String message)
{
super(message);
Modified: modules/trunk/security/src/main/java/org/jboss/seam/security/management/IdentityStore.java
===================================================================
--- modules/trunk/security/src/main/java/org/jboss/seam/security/management/IdentityStore.java 2009-04-29 23:00:22 UTC (rev 10727)
+++ modules/trunk/security/src/main/java/org/jboss/seam/security/management/IdentityStore.java 2009-04-29 23:56:18 UTC (rev 10728)
@@ -6,7 +6,7 @@
import java.util.Set;
/**
- * The identity store does the actual work of persisting user accounts in a
+ * The identity store does the actual work of persisting user accounts and roles in a
* database, LDAP directory, etc.
*
* @author Shane Bryzak
Modified: modules/trunk/security/src/main/java/org/jboss/seam/security/management/JpaIdentityStore.java
===================================================================
--- modules/trunk/security/src/main/java/org/jboss/seam/security/management/JpaIdentityStore.java 2009-04-29 23:00:22 UTC (rev 10727)
+++ modules/trunk/security/src/main/java/org/jboss/seam/security/management/JpaIdentityStore.java 2009-04-29 23:56:18 UTC (rev 10728)
@@ -13,14 +13,14 @@
import javax.annotation.Named;
import javax.context.ApplicationScoped;
-import javax.event.Observes;
import javax.inject.Current;
import javax.inject.Initializer;
-import javax.inject.manager.Bean;
import javax.inject.manager.Manager;
import javax.persistence.EntityManager;
import javax.persistence.NoResultException;
+import org.jboss.seam.security.Role;
+import org.jboss.seam.security.SimplePrincipal;
import org.jboss.seam.security.annotations.management.PasswordSalt;
import org.jboss.seam.security.annotations.management.RoleConditional;
import org.jboss.seam.security.annotations.management.RoleGroups;
@@ -31,19 +31,15 @@
import org.jboss.seam.security.annotations.management.UserPassword;
import org.jboss.seam.security.annotations.management.UserPrincipal;
import org.jboss.seam.security.annotations.management.UserRoles;
-import org.jboss.webbeans.log.LogProvider;
-import org.jboss.webbeans.log.Logging;
-import org.jboss.seam.security.Identity;
-import org.jboss.seam.security.Role;
-import org.jboss.seam.security.SimplePrincipal;
import org.jboss.seam.security.crypto.BinTools;
-import org.jboss.seam.security.events.PostAuthenticateEvent;
import org.jboss.seam.security.events.PrePersistUserEvent;
import org.jboss.seam.security.events.PrePersistUserRoleEvent;
import org.jboss.seam.security.events.UserAuthenticatedEvent;
import org.jboss.seam.security.events.UserCreatedEvent;
import org.jboss.seam.security.util.AnnotatedBeanProperty;
import org.jboss.seam.security.util.TypedBeanProperty;
+import org.jboss.webbeans.log.LogProvider;
+import org.jboss.webbeans.log.Logging;
/**
* The default identity store implementation, uses JPA as its persistence mechanism.
@@ -54,19 +50,18 @@
@ApplicationScoped
public class JpaIdentityStore implements IdentityStore, Serializable
{
+ private static final long serialVersionUID = 1171875389743972646L;
+
private static final LogProvider log = Logging.getLogProvider(JpaIdentityStore.class);
protected FeatureSet featureSet;
-
- private ValueExpression<EntityManager> entityManager;
- private Bean<EntityManager> entityManagerBean;
-
+
@Current Manager manager;
@Current PasswordHash passwordHash;
- private Class<?> userClass;
- private Class<?> roleClass;
- private Class<?> xrefClass;
+ private Class<?> userEntityClass;
+ private Class<?> roleEntityClass;
+ private Class<?> xrefEntityClass;
private TypedBeanProperty xrefUserProperty;
private TypedBeanProperty xrefRoleProperty;
@@ -103,15 +98,10 @@
{
featureSet = new FeatureSet();
featureSet.enableAll();
- }
+ }
- if (entityManager == null)
+ if (userEntityClass == null)
{
- entityManager = Expressions.instance().createValueExpression("#{entityManager}", EntityManager.class);
- }
-
- if (userClass == null)
- {
log.error("Error in JpaIdentityStore configuration - userClass must be configured.");
return;
}
@@ -121,35 +111,35 @@
private void initProperties()
{
- userPrincipalProperty = new AnnotatedBeanProperty<UserPrincipal>(userClass, UserPrincipal.class);
- userPasswordProperty = new AnnotatedBeanProperty<UserPassword>(userClass, UserPassword.class);
- passwordSaltProperty = new AnnotatedBeanProperty<PasswordSalt>(userClass, PasswordSalt.class);
- userRolesProperty = new AnnotatedBeanProperty<UserRoles>(userClass, UserRoles.class);
- userEnabledProperty = new AnnotatedBeanProperty<UserEnabled>(userClass, UserEnabled.class);
- userFirstNameProperty = new AnnotatedBeanProperty<UserFirstName>(userClass, UserFirstName.class);
- userLastNameProperty = new AnnotatedBeanProperty<UserLastName>(userClass, UserLastName.class);
+ userPrincipalProperty = new AnnotatedBeanProperty<UserPrincipal>(userEntityClass, UserPrincipal.class);
+ userPasswordProperty = new AnnotatedBeanProperty<UserPassword>(userEntityClass, UserPassword.class);
+ passwordSaltProperty = new AnnotatedBeanProperty<PasswordSalt>(userEntityClass, PasswordSalt.class);
+ userRolesProperty = new AnnotatedBeanProperty<UserRoles>(userEntityClass, UserRoles.class);
+ userEnabledProperty = new AnnotatedBeanProperty<UserEnabled>(userEntityClass, UserEnabled.class);
+ userFirstNameProperty = new AnnotatedBeanProperty<UserFirstName>(userEntityClass, UserFirstName.class);
+ userLastNameProperty = new AnnotatedBeanProperty<UserLastName>(userEntityClass, UserLastName.class);
if (!userPrincipalProperty.isSet())
{
- throw new IdentityManagementException("Invalid userClass " + userClass.getName() +
+ throw new IdentityManagementException("Invalid userClass " + userEntityClass.getName() +
" - required annotation @UserPrincipal not found on any Field or Method.");
}
if (!userRolesProperty.isSet())
{
- throw new IdentityManagementException("Invalid userClass " + userClass.getName() +
+ throw new IdentityManagementException("Invalid userClass " + userEntityClass.getName() +
" - required annotation @UserRoles not found on any Field or Method.");
}
- if (roleClass != null)
+ if (roleEntityClass != null)
{
- roleNameProperty = new AnnotatedBeanProperty<RoleName>(roleClass, RoleName.class);
- roleGroupsProperty = new AnnotatedBeanProperty<RoleGroups>(roleClass, RoleGroups.class);
- roleConditionalProperty = new AnnotatedBeanProperty<RoleConditional>(roleClass, RoleConditional.class);
+ roleNameProperty = new AnnotatedBeanProperty<RoleName>(roleEntityClass, RoleName.class);
+ roleGroupsProperty = new AnnotatedBeanProperty<RoleGroups>(roleEntityClass, RoleGroups.class);
+ roleConditionalProperty = new AnnotatedBeanProperty<RoleConditional>(roleEntityClass, RoleConditional.class);
if (!roleNameProperty.isSet())
{
- throw new IdentityManagementException("Invalid roleClass " + roleClass.getName() +
+ throw new IdentityManagementException("Invalid roleClass " + roleEntityClass.getName() +
" - required annotation @RoleName not found on any Field or Method.");
}
@@ -167,11 +157,11 @@
// If the @UserRoles property isn't a collection of <roleClass>, then assume the relationship
// is going through a cross-reference table
- if (!genType.equals(roleClass))
+ if (!genType.equals(roleEntityClass))
{
- xrefClass = (Class<?>) genType;
- xrefUserProperty = new TypedBeanProperty(xrefClass, userClass);
- xrefRoleProperty = new TypedBeanProperty(xrefClass, roleClass);
+ xrefEntityClass = (Class<?>) genType;
+ xrefUserProperty = new TypedBeanProperty(xrefEntityClass, userEntityClass);
+ xrefRoleProperty = new TypedBeanProperty(xrefEntityClass, roleEntityClass);
if (!xrefUserProperty.isSet())
{
@@ -193,7 +183,7 @@
{
try
{
- if (userClass == null)
+ if (userEntityClass == null)
{
throw new IdentityManagementException("Could not create account, userClass not set");
}
@@ -203,7 +193,7 @@
throw new IdentityManagementException("Could not create account, already exists");
}
- Object user = userClass.newInstance();
+ Object user = userEntityClass.newInstance();
userPrincipalProperty.setValue(user, username);
@@ -290,9 +280,10 @@
return true;
}
+ @SuppressWarnings("unchecked")
public boolean grantRole(String username, String role)
{
- if (roleClass == null) return false;
+ if (roleEntityClass == null) return false;
Object user = lookupUser(username);
if (user == null)
@@ -328,16 +319,16 @@
if (userRoles == null)
{
Type propType = userRolesProperty.getPropertyType();
- Class collectionType;
+ Class<?> collectionType;
- if (propType instanceof Class && Collection.class.isAssignableFrom((Class) propType))
+ if (propType instanceof Class && Collection.class.isAssignableFrom((Class<?>) propType))
{
- collectionType = (Class) propType;
+ collectionType = (Class<?>) propType;
}
else if (propType instanceof ParameterizedType &&
- Collection.class.isAssignableFrom((Class) ((ParameterizedType) propType).getRawType()))
+ Collection.class.isAssignableFrom((Class<?>) ((ParameterizedType) propType).getRawType()))
{
- collectionType = (Class) ((ParameterizedType) propType).getRawType();
+ collectionType = (Class<?>) ((ParameterizedType) propType).getRawType();
}
else
{
@@ -347,37 +338,37 @@
// This should either be a Set, or a List...
if (Set.class.isAssignableFrom(collectionType))
{
- userRoles = new HashSet();
+ userRoles = new HashSet<Object>();
}
else if (List.class.isAssignableFrom(collectionType))
{
- userRoles = new ArrayList();
+ userRoles = new ArrayList<Object>();
}
userRolesProperty.setValue(user, userRoles);
}
- else if (((Collection) userRolesProperty.getValue(user)).contains(roleToGrant))
+ else if (((Collection<?>) userRolesProperty.getValue(user)).contains(roleToGrant))
{
return false;
}
- if (xrefClass == null)
+ if (xrefEntityClass == null)
{
// If this is a Many-To-Many relationship, simply add the role
- ((Collection) userRolesProperty.getValue(user)).add(roleToGrant);
+ ((Collection<Object>) userRolesProperty.getValue(user)).add(roleToGrant);
}
else
{
// Otherwise we need to insert a cross-reference entity instance
try
{
- Object xref = xrefClass.newInstance();
+ Object xref = xrefEntityClass.newInstance();
xrefUserProperty.setValue(xref, user);
xrefRoleProperty.setValue(xref, roleToGrant);
manager.fireEvent(new PrePersistUserRoleEvent(xref));
- ((Collection) userRolesProperty.getValue(user)).add(mergeEntity(xref));
+ ((Collection<Object>) userRolesProperty.getValue(user)).add(mergeEntity(xref));
}
catch (Exception ex)
{
@@ -404,13 +395,13 @@
boolean success = false;
- if (xrefClass == null)
+ if (xrefEntityClass == null)
{
- success = ((Collection) userRolesProperty.getValue(user)).remove(roleToRevoke);
+ success = ((Collection<?>) userRolesProperty.getValue(user)).remove(roleToRevoke);
}
else
{
- Collection roles = ((Collection) userRolesProperty.getValue(user));
+ Collection<?> roles = ((Collection<?>) userRolesProperty.getValue(user));
for (Object xref : roles)
{
@@ -425,6 +416,7 @@
return success;
}
+ @SuppressWarnings("unchecked")
public boolean addRoleToGroup(String role, String group)
{
if (!roleGroupsProperty.isSet()) return false;
@@ -441,14 +433,14 @@
throw new NoSuchRoleException("Could not grant role, group '" + group + "' does not exist");
}
- Collection roleGroups = (Collection) roleGroupsProperty.getValue(targetRole);
+ Collection<?> roleGroups = (Collection<?>) roleGroupsProperty.getValue(targetRole);
if (roleGroups == null)
{
// This should either be a Set, or a List...
- Class rawType = null;
+ Class<?> rawType = null;
if (roleGroupsProperty.getPropertyType() instanceof ParameterizedType)
{
- rawType = (Class) ((ParameterizedType) roleGroupsProperty.getPropertyType()).getRawType();
+ rawType = (Class<?>) ((ParameterizedType) roleGroupsProperty.getPropertyType()).getRawType();
}
else
{
@@ -457,21 +449,21 @@
if (Set.class.isAssignableFrom(rawType))
{
- roleGroups = new HashSet();
+ roleGroups = new HashSet<Object>();
}
else if (List.class.isAssignableFrom(rawType))
{
- roleGroups = new ArrayList();
+ roleGroups = new ArrayList<Object>();
}
roleGroupsProperty.setValue(targetRole, roleGroups);
}
- else if (((Collection) roleGroupsProperty.getValue(targetRole)).contains(targetGroup))
+ else if (((Collection<?>) roleGroupsProperty.getValue(targetRole)).contains(targetGroup))
{
return false;
}
- ((Collection) roleGroupsProperty.getValue(targetRole)).add(targetGroup);
+ ((Collection<Object>) roleGroupsProperty.getValue(targetRole)).add(targetGroup);
return true;
}
@@ -492,7 +484,8 @@
throw new NoSuchRoleException("Could not remove role from group, no such group '" + group + "'");
}
- boolean success = ((Collection) roleGroupsProperty.getValue(roleToRemove)).remove(targetGroup);
+ boolean success = ((Collection<?>) roleGroupsProperty.getValue(roleToRemove)).remove(targetGroup);
+
return success;
}
@@ -500,7 +493,7 @@
{
try
{
- if (roleClass == null)
+ if (roleEntityClass == null)
{
throw new IdentityManagementException("Could not create role, roleClass not set");
}
@@ -510,7 +503,7 @@
throw new IdentityManagementException("Could not create role, already exists");
}
- Object instance = roleClass.newInstance();
+ Object instance = roleEntityClass.newInstance();
roleNameProperty.setValue(instance, role);
persistEntity(instance);
@@ -537,9 +530,9 @@
throw new NoSuchRoleException("Could not delete role, role '" + role + "' does not exist");
}
- if (xrefClass != null)
+ if (xrefEntityClass != null)
{
- lookupEntityManager().createQuery("delete " + xrefClass.getName() + " where role = :role")
+ lookupEntityManager().createQuery("delete " + xrefEntityClass.getName() + " where role = :role")
.setParameter("role", roleToDelete)
.executeUpdate();
}
@@ -566,7 +559,7 @@
{
if (!userEnabledProperty.isSet())
{
- log.debug("Can not enable user, no @UserEnabled property configured in userClass " + userClass.getName());
+ log.debug("Can not enable user, no @UserEnabled property configured in userClass " + userEntityClass.getName());
return false;
}
@@ -590,7 +583,7 @@
{
if (!userEnabledProperty.isSet())
{
- log.debug("Can not disable user, no @UserEnabled property configured in userClass " + userClass.getName());
+ log.debug("Can not disable user, no @UserEnabled property configured in userClass " + userEntityClass.getName());
return false;
}
@@ -649,12 +642,12 @@
List<String> roles = new ArrayList<String>();
- Collection userRoles = (Collection) userRolesProperty.getValue(user);
+ Collection<?> userRoles = (Collection<?>) userRolesProperty.getValue(user);
if (userRoles != null)
{
for (Object role : userRoles)
{
- if (xrefClass == null)
+ if (xrefEntityClass == null)
{
roles.add((String) roleNameProperty.getValue(role));
}
@@ -682,7 +675,7 @@
if (roleGroupsProperty.isSet())
{
- Collection roleGroups = (Collection) roleGroupsProperty.getValue(role);
+ Collection<?> roleGroups = (Collection<?>) roleGroupsProperty.getValue(role);
if (roleGroups != null)
{
for (Object group : roleGroups)
@@ -704,7 +697,7 @@
}
Set<String> roles = new HashSet<String>();
- Collection userRoles = (Collection) userRolesProperty.getValue(user);
+ Collection<?> userRoles = (Collection<?>) userRolesProperty.getValue(user);
if (userRoles != null)
{
for (Object role : userRoles)
@@ -724,7 +717,7 @@
if (roleGroupsProperty.isSet())
{
- Collection groups = (Collection) roleGroupsProperty.getValue(instance);
+ Collection<?> groups = (Collection<?>) roleGroupsProperty.getValue(instance);
if (groups != null)
{
@@ -824,32 +817,19 @@
boolean success = passwordHash.equals(userPasswordProperty.getValue(user));
if (success)
- {
- if (Contexts.isEventContextActive())
- {
- Contexts.getEventContext().set(AUTHENTICATED_USER, user);
- }
-
+ {
manager.fireEvent(new UserAuthenticatedEvent(user));
+ }
return success;
}
- public void setUserAccountForSession(@Observes PostAuthenticateEvent event)
- {
- if (Contexts.isEventContextActive() && Contexts.isSessionContextActive())
- {
- Contexts.getSessionContext().set(AUTHENTICATED_USER,
- Contexts.getEventContext().get(AUTHENTICATED_USER));
- }
- }
-
public Object lookupUser(String username)
{
try
{
Object user = lookupEntityManager().createQuery(
- "select u from " + userClass.getName() + " u where " + userPrincipalProperty.getName() +
+ "select u from " + userEntityClass.getName() + " u where " + userPrincipalProperty.getName() +
" = :username")
.setParameter("username", username)
.getSingleResult();
@@ -883,7 +863,7 @@
try
{
Object value = lookupEntityManager().createQuery(
- "select r from " + roleClass.getName() + " r where " + roleNameProperty.getName() +
+ "select r from " + roleEntityClass.getName() + " r where " + roleNameProperty.getName() +
" = :role")
.setParameter("role", role)
.getSingleResult();
@@ -896,27 +876,30 @@
}
}
+ @SuppressWarnings("unchecked")
public List<String> listUsers()
{
- return lookupEntityManager().createQuery(
- "select u." + userPrincipalProperty.getName() + " from " + userClass.getName() + " u")
+ return (List<String>) lookupEntityManager().createQuery(
+ "select u." + userPrincipalProperty.getName() + " from " + userEntityClass.getName() + " u")
.getResultList();
}
+ @SuppressWarnings("unchecked")
public List<String> listUsers(String filter)
{
- return lookupEntityManager().createQuery(
- "select u." + userPrincipalProperty.getName() + " from " + userClass.getName() +
+ return (List<String>) lookupEntityManager().createQuery(
+ "select u." + userPrincipalProperty.getName() + " from " + userEntityClass.getName() +
" u where lower(" + userPrincipalProperty.getName() + ") like :username")
.setParameter("username", "%" + (filter != null ? filter.toLowerCase() : "") +
"%")
.getResultList();
}
+ @SuppressWarnings("unchecked")
public List<String> listRoles()
{
- return lookupEntityManager().createQuery(
- "select r." + roleNameProperty.getName() + " from " + roleClass.getName() + " r").getResultList();
+ return (List<String>) lookupEntityManager().createQuery(
+ "select r." + roleNameProperty.getName() + " from " + roleEntityClass.getName() + " r").getResultList();
}
public List<Principal> listMembers(String role)
@@ -936,20 +919,21 @@
return members;
}
+ @SuppressWarnings("unchecked")
private List<String> listUserMembers(String role)
{
Object roleEntity = lookupRole(role);
- if (xrefClass == null)
+ if (xrefEntityClass == null)
{
- return lookupEntityManager().createQuery("select u." + userPrincipalProperty.getName() +
- " from " + userClass.getName() + " u where :role member of u." + userRolesProperty.getName())
+ return (List<String>) lookupEntityManager().createQuery("select u." + userPrincipalProperty.getName() +
+ " from " + userEntityClass.getName() + " u where :role member of u." + userRolesProperty.getName())
.setParameter("role", roleEntity)
.getResultList();
}
else
{
- List xrefs = lookupEntityManager().createQuery("select x from " + xrefClass.getName() + " x where x." +
+ List<?> xrefs = lookupEntityManager().createQuery("select x from " + xrefEntityClass.getName() + " x where x." +
xrefRoleProperty.getName() + " = :role")
.setParameter("role", roleEntity)
.getResultList();
@@ -967,14 +951,15 @@
}
+ @SuppressWarnings("unchecked")
private List<String> listRoleMembers(String role)
{
if (roleGroupsProperty.isSet())
{
Object roleEntity = lookupRole(role);
- return lookupEntityManager().createQuery("select r." + roleNameProperty.getName() +
- " from " + roleClass.getName() + " r where :role member of r." + roleGroupsProperty.getName())
+ return (List<String>) lookupEntityManager().createQuery("select r." + roleNameProperty.getName() +
+ " from " + roleEntityClass.getName() + " r where :role member of r." + roleGroupsProperty.getName())
.setParameter("role", roleEntity)
.getResultList();
}
@@ -982,6 +967,7 @@
return null;
}
+ @SuppressWarnings("unchecked")
public List<String> listGrantableRoles()
{
StringBuilder roleQuery = new StringBuilder();
@@ -989,7 +975,7 @@
roleQuery.append("select r.");
roleQuery.append(roleNameProperty.getName());
roleQuery.append(" from ");
- roleQuery.append(roleClass.getName());
+ roleQuery.append(roleEntityClass.getName());
roleQuery.append(" r");
if (roleConditionalProperty.isSet())
@@ -999,7 +985,7 @@
roleQuery.append(" = false");
}
- return lookupEntityManager().createQuery(roleQuery.toString()).getResultList();
+ return (List<String>) lookupEntityManager().createQuery(roleQuery.toString()).getResultList();
}
protected void persistEntity(Object entity)
@@ -1017,28 +1003,28 @@
lookupEntityManager().remove(entity);
}
- public Class getUserClass()
+ public Class<?> getUserEntityClass()
{
- return userClass;
+ return userEntityClass;
}
- public void setUserClass(Class userClass)
+ public void setUserEntityClass(Class<?> userEntityClass)
{
- this.userClass = userClass;
+ this.userEntityClass = userEntityClass;
}
- public Class getRoleClass()
+ public Class<?> getRoleEntityClass()
{
- return roleClass;
+ return roleEntityClass;
}
- public void setRoleClass(Class roleClass)
+ public void setRoleEntityClass(Class<?> roleEntityClass)
{
- this.roleClass = roleClass;
+ this.roleEntityClass = roleEntityClass;
}
private EntityManager lookupEntityManager()
{
- return entityManager.getValue();
+ return manager.getInstanceByType(EntityManager.class);
}
}
Modified: modules/trunk/security/src/main/java/org/jboss/seam/security/management/LdapIdentityStore.java
===================================================================
--- modules/trunk/security/src/main/java/org/jboss/seam/security/management/LdapIdentityStore.java 2009-04-29 23:00:22 UTC (rev 10727)
+++ modules/trunk/security/src/main/java/org/jboss/seam/security/management/LdapIdentityStore.java 2009-04-29 23:56:18 UTC (rev 10728)
@@ -627,7 +627,7 @@
roleFilter.append(")");
- NamingEnumeration answer = ctx.search(getUserContextDN(), roleFilter.toString(), filterArgs, controls);
+ NamingEnumeration<?> answer = ctx.search(getUserContextDN(), roleFilter.toString(), filterArgs, controls);
while (answer.hasMore())
{
SearchResult sr = (SearchResult) answer.next();
@@ -678,7 +678,7 @@
String roleFilter = "(&(" + getObjectClassAttribute() + "={0})(" + getRoleNameAttribute() + "={1}))";
Object[] filterArgs = { getRoleObjectClasses(), role};
- NamingEnumeration answer = ctx.search(getRoleContextDN(), roleFilter, filterArgs, controls);
+ NamingEnumeration<?> answer = ctx.search(getRoleContextDN(), roleFilter, filterArgs, controls);
while (answer.hasMore())
{
SearchResult sr = (SearchResult) answer.next();
@@ -864,7 +864,7 @@
controls.setTimeLimit(getSearchTimeLimit());
Object[] filterArgs = {name};
- NamingEnumeration answer = ctx.search(getUserContextDN(), userFilter, filterArgs, controls);
+ NamingEnumeration<?> answer = ctx.search(getUserContextDN(), userFilter, filterArgs, controls);
while (answer.hasMore())
{
SearchResult sr = (SearchResult) answer.next();
@@ -1057,7 +1057,7 @@
filterArgs[i] = getRoleObjectClasses()[i];
}
- NamingEnumeration answer = ctx.search( getRoleContextDN(), roleFilter.toString(),
+ NamingEnumeration<?> answer = ctx.search( getRoleContextDN(), roleFilter.toString(),
filterArgs, controls);
while (answer.hasMore())
{
@@ -1094,7 +1094,6 @@
public List<String> listGrantableRoles()
{
- // TODO should we support conditional roles with LDAP?
return listRoles();
}
@@ -1134,7 +1133,7 @@
userFilter.append(")");
- NamingEnumeration answer = ctx.search(getUserContextDN(), userFilter.toString(), filterArgs, controls);
+ NamingEnumeration<?> answer = ctx.search(getUserContextDN(), userFilter.toString(), filterArgs, controls);
while (answer.hasMore())
{
SearchResult sr = (SearchResult) answer.next();
@@ -1205,7 +1204,7 @@
filterArgs[i] = getUserObjectClasses()[i];
}
- NamingEnumeration answer = ctx.search(getUserContextDN(), userFilter.toString(), filterArgs, controls);
+ NamingEnumeration<?> answer = ctx.search(getUserContextDN(), userFilter.toString(), filterArgs, controls);
while (answer.hasMore())
{
SearchResult sr = (SearchResult) answer.next();
Modified: modules/trunk/security/src/main/java/org/jboss/seam/security/management/NoSuchRoleException.java
===================================================================
--- modules/trunk/security/src/main/java/org/jboss/seam/security/management/NoSuchRoleException.java 2009-04-29 23:00:22 UTC (rev 10727)
+++ modules/trunk/security/src/main/java/org/jboss/seam/security/management/NoSuchRoleException.java 2009-04-29 23:56:18 UTC (rev 10728)
@@ -7,6 +7,8 @@
*/
public class NoSuchRoleException extends RuntimeException
{
+ private static final long serialVersionUID = 7711431103948571607L;
+
public NoSuchRoleException(String message)
{
super(message);
Modified: modules/trunk/security/src/main/java/org/jboss/seam/security/management/NoSuchUserException.java
===================================================================
--- modules/trunk/security/src/main/java/org/jboss/seam/security/management/NoSuchUserException.java 2009-04-29 23:00:22 UTC (rev 10727)
+++ modules/trunk/security/src/main/java/org/jboss/seam/security/management/NoSuchUserException.java 2009-04-29 23:56:18 UTC (rev 10728)
@@ -7,6 +7,8 @@
*/
public class NoSuchUserException extends RuntimeException
{
+ private static final long serialVersionUID = -6117983356287782094L;
+
public NoSuchUserException(String message)
{
super(message);
More information about the seam-commits
mailing list