mirror of
https://github.com/Bubka/2FAuth.git
synced 2025-06-24 05:51:48 +02:00
Fix and complete auth proxy tests
This commit is contained in:
parent
990fca3912
commit
37c1f475c2
@ -49,6 +49,25 @@ class AuthenticateMiddlewareTest extends FeatureTestCase
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @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
|
* @test
|
||||||
*/
|
*/
|
||||||
@ -62,7 +81,7 @@ class AuthenticateMiddlewareTest extends FeatureTestCase
|
|||||||
$this->json('GET', '/api/v1/groups', [], [
|
$this->json('GET', '/api/v1/groups', [], [
|
||||||
'HTTP_REMOTE_USER' => '',
|
'HTTP_REMOTE_USER' => '',
|
||||||
'HTTP_REMOTE_EMAIL' => ''
|
'HTTP_REMOTE_EMAIL' => ''
|
||||||
])->assertUnauthorized();
|
])->assertStatus(407);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -74,7 +93,7 @@ class AuthenticateMiddlewareTest extends FeatureTestCase
|
|||||||
$this->app['auth']->shouldUse('reverse-proxy-guard');
|
$this->app['auth']->shouldUse('reverse-proxy-guard');
|
||||||
|
|
||||||
$this->json('GET', '/api/v1/groups', [], [])
|
$this->json('GET', '/api/v1/groups', [], [])
|
||||||
->assertUnauthorized();
|
->assertStatus(407);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user