按 DDD 重构认证流程并复用用户 bind 实现 LDAP 仓储
This commit is contained in:
@@ -59,7 +59,7 @@ def main():
|
||||
|
||||
def request(path, authenticated=False):
|
||||
headers = {'Accept': 'text/plain' if authenticated and path == '/actuator/prometheus' else 'application/json'}
|
||||
if path == '/preview':
|
||||
if path == '/signin':
|
||||
headers['Accept'] = 'text/html'
|
||||
if authenticated:
|
||||
headers['Authorization'] = f'Basic {basic}'
|
||||
@@ -80,7 +80,7 @@ def main():
|
||||
ready_seconds = time.monotonic() - started
|
||||
assert request('/actuator/prometheus')[0] == 401, 'Anonymous metrics must be rejected'
|
||||
assert request('/')[0] == 401, 'Anonymous application access must be rejected'
|
||||
assert request('/preview')[0] == 404, 'UI preview must be disabled by default'
|
||||
assert request('/signin')[0] == 404, 'Sign-in must be disabled without directory configuration'
|
||||
status, before = request('/actuator/prometheus', authenticated=True)
|
||||
assert status == 200, 'Authenticated Prometheus scrape failed'
|
||||
for _ in range(3):
|
||||
|
||||
Reference in New Issue
Block a user