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
{@link sunlabs.brazil.server.Request#props}
, and allows/denies
access based on those prefixes.
This is expected to work in conjunction with an upstream handler,
such as
{@link sunlabs.brazil.handler.RolesHandler}
or
{@link sunlabs.brazil.handler.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 {@link #init} prefix
for this handler is prepended.
Properties:
- prefix, suffix, glob, match
- Sepcify the URL that triggers this handler.
(See {@link 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
public boolean init(
Server server, String prefix)
public boolean respond(
Request request)