56 | | As HTTP authentication is generally performed by the web server, testing a web app relying on HTTP authentication is often inconvenient. The Diva DevelopmentServer makes it easy by providing built-in support for HTTP Basic and Digest authentication, which can be enabled simply by specifying a couple of command-line options: |
57 | | |
58 | | {{{ |
59 | | $ ./geddit/app.py --help |
60 | | Usage: app.py [options] |
61 | | |
62 | | Options: |
63 | | -h, --help show this help message and exit |
64 | | -O name=value set a configuration option |
65 | | -b HOST, --host=HOST hostname or IP address to bind to (default 127.0.0.1) |
66 | | -p PORT, --port=PORT port number to listen to (default 8080) |
67 | | -r, --auto-reload automatically restart after code changes (default off) |
68 | | |
69 | | Authentication: |
70 | | -B FILE, --basic=FILE |
71 | | path to an unencrypted password file to use for basic |
72 | | authentication |
73 | | -D FILE, --digest=FILE |
74 | | path to a htdigest file to use for authentication |
75 | | --realm=REALM name of the authentication realm (default "Geddit") |
76 | | --protect=PATH path(s) to protect by authentication |
77 | | |
78 | | Logging: |
79 | | -v, --verbose print as much as possible |
80 | | -q, --quiet print as little as possible |
81 | | }}} |
82 | | |
83 | | The `--digest` option is used to specify the text file containing the credentials for digest authentication, in a format compatible with the [http://httpd.apache.org/docs/2.2/programs/htdigest.html Apache htdigest tool]. The ``--basic`` option allows you to use an unencrypted password file for even simpler setup. The `--realm` option can be used to specify a different realm, where the default is the name of the `Application` class. This realm needs to match the realm used in the digest file. |
84 | | |
85 | | Finally, the `--protect` option can be used to require authentication only on the specified sub-resources. When the `--protect` option is not provided, the whole URI space will require authentication. When it is specified, authentication is only required on the specified paths. To protect more than one path, simply specifiy the option as often as you need. |
86 | | |
87 | | For example: |
88 | | |
89 | | {{{ |
90 | | $ ./geddit/app.py -rv --digest auth.digest --protect /login |
91 | | }}} |
| 56 | As HTTP authentication is generally performed by the web server, testing a web app relying on HTTP authentication is often inconvenient. The Diva DevelopmentServer makes it easy by providing built-in support for HTTP Basic and Digest authentication, which can be configured using command-line options. |