Mercurial > hg > ngx_http_auth_request_module
comparison t/auth-request.t @ 1:dfc5ae42367a
Auth request: support switching off.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Fri, 26 Feb 2010 21:21:22 +0300 |
parents | 436da5355bd5 |
children | 35f0ee7a3c28 |
comparison
equal
deleted
inserted
replaced
0:436da5355bd5 | 1:dfc5ae42367a |
---|---|
16 | 16 |
17 select STDERR; $| = 1; | 17 select STDERR; $| = 1; |
18 select STDOUT; $| = 1; | 18 select STDOUT; $| = 1; |
19 | 19 |
20 my $t = Test::Nginx->new()->has(qw/http rewrite proxy fastcgi auth_basic/) | 20 my $t = Test::Nginx->new()->has(qw/http rewrite proxy fastcgi auth_basic/) |
21 ->plan(13); | 21 ->plan(14); |
22 | 22 |
23 $t->write_file_expand('nginx.conf', <<'EOF'); | 23 $t->write_file_expand('nginx.conf', <<'EOF'); |
24 | 24 |
25 master_process off; | 25 master_process off; |
26 daemon off; | 26 daemon off; |
72 } | 72 } |
73 location = /auth-error { | 73 location = /auth-error { |
74 return 404; | 74 return 404; |
75 } | 75 } |
76 | 76 |
77 location /off { | |
78 auth_request off; | |
79 } | |
80 | |
77 location /proxy { | 81 location /proxy { |
78 auth_request /auth-proxy; | 82 auth_request /auth-proxy; |
79 } | 83 } |
80 location = /auth-proxy { | 84 location = /auth-proxy { |
81 proxy_pass http://127.0.0.1:8080/auth-basic; | 85 proxy_pass http://127.0.0.1:8080/auth-basic; |
107 | 111 |
108 like(http_get('/open'), qr/ 404 /, 'auth open'); | 112 like(http_get('/open'), qr/ 404 /, 'auth open'); |
109 like(http_get('/unauthorized'), qr/ 401 /, 'auth unauthorized'); | 113 like(http_get('/unauthorized'), qr/ 401 /, 'auth unauthorized'); |
110 like(http_get('/forbidden'), qr/ 403 /, 'auth forbidden'); | 114 like(http_get('/forbidden'), qr/ 403 /, 'auth forbidden'); |
111 like(http_get('/error'), qr/ 500 /, 'auth error'); | 115 like(http_get('/error'), qr/ 500 /, 'auth error'); |
116 like(http_get('/off'), qr/ 404 /, 'auth off'); | |
112 | 117 |
113 like(http_get('/open-static'), qr/ 404 /, 'auth open static'); | 118 like(http_get('/open-static'), qr/ 404 /, 'auth open static'); |
114 unlike(http_get('/open-static'), qr/INVISIBLE/, 'auth static no content'); | 119 unlike(http_get('/open-static'), qr/INVISIBLE/, 'auth static no content'); |
115 | 120 |
116 like(http_get('/proxy'), qr/ 401 /, 'proxy auth unauthorized'); | 121 like(http_get('/proxy'), qr/ 401 /, 'proxy auth unauthorized'); |