in src/main/java/org/apache/directory/fortress/rest/FortressInterceptor.java [124:175]
protected void findRoles( Class<?> cls, Map<String, String> rolesMap )
{
LOG.info( "FortressInterceptor.findRoles:" + rolesMap );
if ( ( cls == null ) || ( cls == Object.class ) )
{
return;
}
String classRolesAllowed = getRoles( cls.getAnnotations(), annotationClassName );
// Process all the methods for the given class itself
for ( Method m : cls.getMethods() )
{
if ( SKIP_METHODS.contains( m.getName() ) )
{
continue;
}
String methodRolesAllowed = getRoles( m.getAnnotations(), annotationClassName );
if ( methodRolesAllowed != null )
{
rolesMap.put( m.getName(), methodRolesAllowed );
}
else if ( classRolesAllowed != null )
{
rolesMap.put( m.getName(), classRolesAllowed );
}
}
// We have found roles in the current class, get out
if ( !rolesMap.isEmpty() )
{
return;
}
// Chekc the super class now
findRoles( cls.getSuperclass(), rolesMap );
// Get out if we have some roles
if ( !rolesMap.isEmpty() )
{
return;
}
// Still nothing ? let's check the interfaces
for ( Class<?> interfaceCls : cls.getInterfaces() )
{
findRoles( interfaceCls, rolesMap );
}
}