Erwin, the whole idea of ActiveWeb is to be lightweight and easy to use, unlike Spring, so adding a built-in role-based authentication is not on the plan.
However, it is really easy to add to the secure app I wrote before.
For instance, you can do the following:
1. Create a table caller ROLES with the following structure:
* role_name (varchar)
2. Create a table called PATHS with the following structure:
* controlle_name
* action_name
* role_id
3. Assuming that you have a table called USERS (or similar), add column to this table:
* role_id
At this point, you have defined that "a role has many users" and "a role has many paths"
4. Add a bit of code to your Authorization filter (or write a new filter)
The code will look like this:
Route route = getRoute();
User user = (User)session("user");
Role role = user.getRole(); alternatively, cach this in session to save extra database trip
if(!role.hasRoute(route)){
redirect(elswhere);
}
implementation of hasRoute() will look like this:
public class Role{
public boolean hasRoute(Route route){
return Path.count("conrtoller_name = ? and action_name = ? and role_id = ?",
route.getController().getClass().getName(), route.getActionName(), getId()) > 0;
}
}
You can even make it more elegant by wrapping this code into something like this:
if(!user.canAccessRoute(route)){
redirect(elswhere)
}
At this point, all you need is to add records to table PATHS and relate users to roles. If your users need to be in multiple roles, use many-to-many relationship from USERS and ROLES.
As you can see, you can implement role based authorization in 20 minutes or so, and there is absolutely no need to add "authorization support like Spring" to the framework!
I hope this helps