equal
deleted
inserted
replaced
|
1 from __future__ import absolute_import |
|
2 |
|
3 import base64 |
|
4 |
|
5 from mercurial.hgweb import common |
|
6 |
|
7 def perform_authentication(hgweb, req, op): |
|
8 auth = req.headers.get(b'Authorization') |
|
9 if not auth: |
|
10 raise common.ErrorResponse(common.HTTP_UNAUTHORIZED, b'who', |
|
11 [(b'WWW-Authenticate', b'Basic Realm="mercurial"')]) |
|
12 |
|
13 if base64.b64decode(auth.split()[1]).split(b':', 1) != [b'user', b'pass']: |
|
14 raise common.ErrorResponse(common.HTTP_FORBIDDEN, b'no') |
|
15 |
|
16 def extsetup(ui): |
|
17 common.permhooks.insert(0, perform_authentication) |