| 1 |
from conf import rule |
| 2 |
|
| 3 |
""" Rule: Authentication |
| 4 |
This file defines an authentication rule which when applied to any file will |
| 5 |
cause the server to prompt the client for the required authentication details |
| 6 |
before serving it. |
| 7 |
auth_type must be either of: Basic, Digest, Both or Both-inline |
| 8 |
When auth_type is Basic or Digest, the server asks for the respective |
| 9 |
authentication in its response. When auth_type is Both, the server sends two |
| 10 |
Authenticate headers, one requesting Basic and the other requesting Digest |
| 11 |
authentication. If auth_type is Both-inline, the server sends only one |
| 12 |
Authenticate header, but lists both Basic and Digest as supported mechanisms in |
| 13 |
that. |
| 14 |
""" |
| 15 |
|
| 16 |
|
| 17 |
@rule() |
| 18 |
class Authentication: |
| 19 |
def __init__(self, auth_obj): |
| 20 |
self.auth_type = auth_obj['Type'] |
| 21 |
self.auth_user = auth_obj['User'] |
| 22 |
self.auth_pass = auth_obj['Pass'] |
| 23 |
self.auth_parm = auth_obj.get('Parm', None) |