sunlabs.brazil.handler

Class AclSwitchHandler

public class AclSwitchHandler extends Object implements Handler

Simple access control hander based on url prefixes or regexps. Looks up list of valid prefixes or regular expressions in props , and allows/denies access based on those prefixes. This is expected to work in conjunction with an upstream handler, such as RolesHandler or BasicAuthHandler that examines the request, and place credentials into the request object. The credentials consist of url prefixes or regular expressions that match classes of url's. Documents whose URL prefix don't match a credential are rejected. If a credential does not begin with a slash (/), the AclSwitchHandler prefix for this handler is prepended.

Properties:

prefix, suffix, glob, match
Sepcify the URL that triggers this handler. (See MatchString).
authName
The name of the request.props entry to find a white-space delimited list of url prefixes or regular expression patterns. (defaults to "roles"). If the items in the list don't start with "/", then the url prefix is prepended (only for prefix matching).
redirect
Name of the url to re-direct to if permission is denied. If not specified, a simple message is sent to the client.
useRegexp
If provided, the list of credentials is interpreted as regular expressions, otherwise url prefixes are used.

Version: 2.2, 06/11/13

Author: Stephen Uhler

Method Summary
booleaninit(Server server, String prefix)
booleanrespond(Request request)

Method Detail

init

public boolean init(Server server, String prefix)

respond

public boolean respond(Request request)