pygmy.handlers
Class BasicWebAuthHandler
java.lang.Object
pygmy.core.AbstractHandler
pygmy.handlers.BasicWebAuthHandler
- All Implemented Interfaces:
- Handler
public class BasicWebAuthHandler
- extends AbstractHandler
- implements Handler
This handler implements the Basic web authentication protocol outlined in RFC 2617. This handler sits in front
of a set of handlers within a chain see DefaultChainHandler
. Everything it's in front of
will be protected. It checks it's url-prefix configuration to know when it should handle a request. Properties used
for configuring:
url-prefix | The prefix to filter request urls. | None | Yes |
realm | This is the realm reported to the client. See RFC 2617 for explanation of the realm parameter. | None | Yes |
users | This the path to a file containing all the users and their passwords allowed to access this url.
To create a file you can run this class and hand it the file, username, and password to create. WARNING do
not put this file in a place where it could be downloaded through this server. | None | Yes |
Here is the syntax for running this class to create a password file:
java pgymy.handlers.BasicWebAuthHandler <file> <username> <password>
An existing file can be added to by calling this program again.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
REALM_OPTION
public static final ConfigOption REALM_OPTION
USERS_OPTION
public static final ConfigOption USERS_OPTION
BasicWebAuthHandler
public BasicWebAuthHandler()
initialize
public boolean initialize(java.lang.String handlerName,
Server server)
- Specified by:
initialize
in interface Handler
- Overrides:
initialize
in class AbstractHandler
handleBody
protected boolean handleBody(HttpRequest request,
HttpResponse response)
throws java.io.IOException
- Overrides:
handleBody
in class AbstractHandler
- Throws:
java.io.IOException
main
public static void main(java.lang.String[] args)
throws java.io.IOException,
java.security.NoSuchAlgorithmException
- Throws:
java.io.IOException
java.security.NoSuchAlgorithmException
shutdown
public boolean shutdown(Server server)
- Specified by:
shutdown
in interface Handler
- Overrides:
shutdown
in class AbstractHandler