i am having only rolename with no url field in my role table , so how can i
load database roles
as i am getting example that are parsed by url that are in role table
and after below configuration when i call my login page the
system.out.println statement is is continuosly running and the browser
refreshing
how can i rectify this prob?
public class DbBasedFilterInvocationDefinitionMap extends
AbstractFilterInvocationDefinitionSource
implements FilterInvocationDefinitionSource {
private RoleDao roleDao;
private Map actionsToTruncate;
public void setActionsToTruncate(Map actionsToTruncate) {
this.actionsToTruncate = actionsToTruncate;
}
public void setRoleDao(RoleDao roleDao) {
this.roleDao = roleDao;
}
public ConfigAttributeDefinition lookupAttributes(String url) {
// if (url == null)
// throw new NullPointerException("Parametr of url is null");
try {
//url = prepareUrl(url);
//Role act = roleDao.findByUrl(url);
return obtainRolesInConfigAttributeDefinitionObject();
}
catch (IncorrectResultSizeDataAccessException ex) {
return null;
}
}
private String prepareUrl(String url) {
String actionName = "";
url = url.toLowerCase();
if (url.charAt(0) == '/')
url = url.substring(1);
if (url.indexOf(".") != -1)
actionName = url.substring(0, url.indexOf("."));
if (actionsToTruncate.containsKey(actionName)) {
if (url.contains("?")) {
url = url.substring(0, url.indexOf("?"));
}
}
if (url.contains("&"))
url = url.substring(0, url.indexOf("&"));
return url;
}
private ConfigAttributeDefinition
obtainRolesInConfigAttributeDefinitionObject() {
ConfigAttributeDefinition cad = new ConfigAttributeDefinition();
System.out.println("size "+roleDao.getRoles());
Iterator it = roleDao.getRoles().iterator();
while(it.hasNext()) {
Role ra = (Role) it.next();
SecurityConfig sc = new SecurityConfig(ra.getName());
System.out.println("name " +sc.getAttribute());
cad.addConfigAttribute(sc);
}
return cad;
}
public Iterator getConfigAttributeDefinitions() {
return null;
}
}
<bean id="filterInvocationInterceptor" class=
"org.acegisecurity.intercept.web.FilterSecurityInterceptor">
<property name="authenticationManager" ref="authenticationManager"/>
<property name="accessDecisionManager" ref="accessDecisionManager"/>
<property name="objectDefinitionSource" ref="objectDefinitionSourceTarget">
</property>
</bean>
<bean id="objectDefinitionSourceTarget" class=
"com.techi.beanstalk.cp.webapp.filter.DbBasedFilterInvocationDefinitionMap">
<property name="roleDao">
<ref bean="roleDao"/>
</property>
</bean>
On Fri, Mar 6, 2009 at 8:17 PM, Matt Raible <[email protected]> wrote:
> You could load your URL -> role names from a database instead of the
> security.xml file.
>
> http://forum.springframework.org/showthread.php?t=29750
>
> Matt
>
> On Fri, Mar 6, 2009 at 7:11 AM, Anil Rawat <[email protected]> wrote:
> > hi all,
> >
> > i am using appfuse 1.9.3, when i make a new role in role table and
> assign
> > to a user then that role is also have to be mentioned in security.xml ,
> if
> > i don't mention the name of the new role it does not process the user to
> > whom the new role was assigned.
> > i think this a dependency of appfuse .
> >
> > how can i by pass this so that whenever i make a new role i dont have to
> > mention in security.xml.
> >
> >
> > Regards,
> > Anil
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>