| 1 |
40c40,41 |
|---|
| 2 |
< from trac.web.standalone import BasicAuth, DigestAuth, TracHTTPServer |
|---|
| 3 |
--- |
|---|
| 4 |
> from trac.web.standalone import BasicAuthentication, DigestAuthentication, TracHTTPServer, TracEnvironMiddleware, AuthenticationMiddleware |
|---|
| 5 |
> from trac.web.main import dispatch_request |
|---|
| 6 |
119c120 |
|---|
| 7 |
< add_auth(auths, a, DigestAuth) |
|---|
| 8 |
--- |
|---|
| 9 |
> add_auth(auths, a, DigestAuthentication) |
|---|
| 10 |
121c122 |
|---|
| 11 |
< add_auth(auths, a, BasicAuth) |
|---|
| 12 |
--- |
|---|
| 13 |
> add_auth(auths, a, BasicAuthentication) |
|---|
| 14 |
136c137,153 |
|---|
| 15 |
< return TracHTTPServer(server_address, env_parent_dir, ARGS, auths) |
|---|
| 16 |
--- |
|---|
| 17 |
> |
|---|
| 18 |
> # TODO: set single_env to false if multiple environments are found in ARGS |
|---|
| 19 |
> # single_env = False |
|---|
| 20 |
> single_env = True |
|---|
| 21 |
> |
|---|
| 22 |
> wsgi_app = TracEnvironMiddleware(dispatch_request, |
|---|
| 23 |
> env_parent_dir, ARGS, |
|---|
| 24 |
> single_env) |
|---|
| 25 |
> if auths: |
|---|
| 26 |
> if single_env: |
|---|
| 27 |
> project_name = os.path.basename(os.path.normpath(ARGS[0])) |
|---|
| 28 |
> wsgi_app = AuthenticationMiddleware(wsgi_app, auths, project_name) |
|---|
| 29 |
> else: |
|---|
| 30 |
> wsgi_app = AuthenticationMiddleware(wsgi_app, auths) |
|---|
| 31 |
> |
|---|
| 32 |
> |
|---|
| 33 |
> return TracHTTPServer(server_address, wsgi_app, env_parent_dir, ARGS) |
|---|