Skip to content

Commit

Permalink
basic auth for ui
Browse files Browse the repository at this point in the history
  • Loading branch information
kyleferguson committed Jan 30, 2017
1 parent e1299ab commit 1dd69c9
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/Support/HealthzServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,17 @@ protected function healthzHandler()
protected function healthzUIHandler()
{
return function() {
$username = getenv('HEALTHZ_USERNAME');
$password = getenv('HEALTHZ_PASSWORD');
if ($username != "") {
if (
request()->getUser() !== $username ||
request()->getPassword() !== $password
) {
return response('Invalid credentials', 401, ['WWW-Authenticate' => 'Basic']);
}
}

$healthz = app(Healthz::class);
$results = $healthz->run();
$html = $healthz->html($results);
Expand Down

0 comments on commit 1dd69c9

Please sign in to comment.