mirror of
https://github.com/Bubka/2FAuth.git
synced 2024-11-27 02:36:06 +01:00
Fix and complete auth proxy tests
This commit is contained in:
parent
990fca3912
commit
37c1f475c2
@ -49,6 +49,25 @@ public function test_user_is_set_from_reverse_proxy_info()
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function test_user_is_set_from_reverse_proxy_without_email()
|
||||
{
|
||||
Config::set('auth.auth_proxy_headers.user', 'HTTP_REMOTE_USER');
|
||||
|
||||
$this->app['auth']->shouldUse('reverse-proxy-guard');
|
||||
|
||||
$this->json('GET', '/api/v1/groups', [], [
|
||||
'HTTP_REMOTE_USER' => self::USER_NAME
|
||||
]);
|
||||
$this->assertAuthenticated('reverse-proxy-guard');
|
||||
|
||||
$user = $this->app->make('auth')->guard('reverse-proxy-guard')->user();
|
||||
$this->assertEquals('fake.email@do.not.use', $user->email);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
@ -62,7 +81,7 @@ public function test_it_does_not_authenticate_with_empty_header()
|
||||
$this->json('GET', '/api/v1/groups', [], [
|
||||
'HTTP_REMOTE_USER' => '',
|
||||
'HTTP_REMOTE_EMAIL' => ''
|
||||
])->assertUnauthorized();
|
||||
])->assertStatus(407);
|
||||
}
|
||||
|
||||
|
||||
@ -74,7 +93,7 @@ public function test_it_does_not_authenticate_with_missing_header()
|
||||
$this->app['auth']->shouldUse('reverse-proxy-guard');
|
||||
|
||||
$this->json('GET', '/api/v1/groups', [], [])
|
||||
->assertUnauthorized();
|
||||
->assertStatus(407);
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user