Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Changed

- Dev: test fixtures use RFC 2606 reserved domains only —
`provider.example.org` for IdP-side URLs (metadata, authorization) and
`app.example.org` for application-side URLs (redirect/callback, CLI
login), replacing real registrable domains (`app.com`, `provider.com`,
`other.com`, `test.com`). No effect on the published package.
- Dev: strengthened Security tests based on mutation testing findings —
the redirect-route parameters are asserted to reach the router when
building a provider redirect URI, `validateClaims` is asserted to look
Expand Down
4 changes: 2 additions & 2 deletions tests/Controller/LoginControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public function testLogin(): void
->expects($this->exactly(1))
->method('getAuthorizationUrl')
->with(['state' => 'abcd', 'nonce' => '1234', 'response_type' => 'code', 'scope' => 'openid email profile'])
->willReturn('https://test.com');
->willReturn('https://provider.example.org/authorize');

$controller = $this->createController($mockProvider);

Expand All @@ -58,7 +58,7 @@ public function testLogin(): void
});

$response = $controller->login($request, $mockSession, 'test');
$this->assertSame('https://test.com', $response->getTargetUrl());
$this->assertSame('https://provider.example.org/authorize', $response->getTargetUrl());
}

public function testUnknownProviderKeyMapsTo404(): void
Expand Down
8 changes: 4 additions & 4 deletions tests/DependencyInjection/ConfigurationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public function testFullConfig(): void
$input['user_provider'] = 'my_user_provider';
$input['openid_providers']['provider1']['options']['leeway'] = 30;
$input['openid_providers']['provider1']['options']['cache_duration'] = 3600;
$input['openid_providers']['provider1']['options']['redirect_uri'] = 'https://app.com/callback';
$input['openid_providers']['provider1']['options']['redirect_uri'] = 'https://app.example.org/callback';
$input['openid_providers']['provider1']['options']['allow_http'] = true;

$config = $this->processor->processConfiguration(
Expand All @@ -79,7 +79,7 @@ public function testFullConfig(): void
$provider = $config['openid_providers']['provider1']['options'];
$this->assertSame(30, $provider['leeway']);
$this->assertSame(3600, $provider['cache_duration']);
$this->assertSame('https://app.com/callback', $provider['redirect_uri']);
$this->assertSame('https://app.example.org/callback', $provider['redirect_uri']);
$this->assertTrue($provider['allow_http']);
}

Expand All @@ -100,7 +100,7 @@ public function testRedirectRouteConfig(): void
public function testBothRedirectUriAndRouteThrows(): void
{
$input = $this->getMinimalConfig();
$input['openid_providers']['provider1']['options']['redirect_uri'] = 'https://app.com/callback';
$input['openid_providers']['provider1']['options']['redirect_uri'] = 'https://app.example.org/callback';
$input['openid_providers']['provider1']['options']['redirect_route'] = 'my_route';

$this->expectException(InvalidConfigurationException::class);
Expand Down Expand Up @@ -186,7 +186,7 @@ public function testMultipleProviders(): void
$input = $this->getMinimalConfig();
$input['openid_providers']['provider2'] = [
'options' => [
'metadata_url' => 'https://other.com/.well-known/openid-configuration',
'metadata_url' => 'https://other-provider.example.org/.well-known/openid-configuration',
'client_id' => 'other_id',
'client_secret' => 'other_secret',
],
Expand Down
16 changes: 8 additions & 8 deletions tests/Security/OpenIdConfigurationProviderManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public function testGetProviderWithRedirectRoute(): void
$mockRouter->expects($this->once())
->method('generate')
->with('my_route', ['param' => 'value'], UrlGeneratorInterface::ABSOLUTE_URL)
->willReturn('https://app.com/callback');
->willReturn('https://app.example.org/callback');
$this->stubRouter = $mockRouter;

$manager = $this->createManager([
Expand All @@ -102,7 +102,7 @@ public function testGetProviderWithRedirectRouteNoParameters(): void
{
$this->stubRouter
->method('generate')
->willReturn('https://app.com/callback');
->willReturn('https://app.example.org/callback');

$manager = $this->createManager([
'test' => $this->getBaseProviderConfig() + [
Expand All @@ -118,7 +118,7 @@ public function testGetProviderWithLeeway(): void
{
$manager = $this->createManager([
'test' => $this->getBaseProviderConfig() + [
'redirect_uri' => 'https://app.com/callback',
'redirect_uri' => 'https://app.example.org/callback',
'leeway' => 30,
],
]);
Expand All @@ -131,7 +131,7 @@ public function testGetProviderWithCacheDuration(): void
{
$manager = $this->createManager([
'test' => $this->getBaseProviderConfig() + [
'redirect_uri' => 'https://app.com/callback',
'redirect_uri' => 'https://app.example.org/callback',
'cache_duration' => 3600,
],
]);
Expand All @@ -144,7 +144,7 @@ public function testGetProviderWithAllowHttp(): void
{
$manager = $this->createManager([
'test' => $this->getBaseProviderConfig() + [
'redirect_uri' => 'https://app.com/callback',
'redirect_uri' => 'https://app.example.org/callback',
'allow_http' => true,
],
]);
Expand Down Expand Up @@ -172,7 +172,7 @@ public function testGetProviderForwardsHttpClientOptions(): void
{
$manager = $this->createManager([
'test' => $this->getBaseProviderConfig() + [
'redirect_uri' => 'https://app.com/callback',
'redirect_uri' => 'https://app.example.org/callback',
'http_client_options' => [
'timeout' => 1.5,
'proxy' => 'http://proxy:8080',
Expand All @@ -195,7 +195,7 @@ public function testGetProviderWithoutHttpClientOptionsLeavesGuzzleDefaults(): v
{
$manager = $this->createManager([
'test' => $this->getBaseProviderConfig() + [
'redirect_uri' => 'https://app.com/callback',
'redirect_uri' => 'https://app.example.org/callback',
],
]);

Expand All @@ -211,7 +211,7 @@ public function testGetProviderCachesInstance(): void
{
$manager = $this->createManager([
'test' => $this->getBaseProviderConfig() + [
'redirect_uri' => 'https://app.com/callback',
'redirect_uri' => 'https://app.example.org/callback',
],
]);

Expand Down
4 changes: 2 additions & 2 deletions tests/Security/OpenIdLoginAuthenticatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public function testValidateClaimsSuccess(): void
$stubProvider = $this->createStub(OpenIdConfigurationProvider::class);

$claims = new \stdClass();
$claims->email = 'test@test.com';
$claims->email = 'test@example.org';
$claims->name = 'Test Tester';
$stubProvider->method('validateIdToken')->willReturn($claims);

Expand All @@ -128,7 +128,7 @@ public function testValidateClaimsSuccess(): void

$passport = $authenticator->authenticate($request);

$this->assertSame('test@test.com', $passport->getUser()->getUserIdentifier());
$this->assertSame('test@example.org', $passport->getUser()->getUserIdentifier());

// The claims contract: the IdP claims plus the provider key that
// authenticated the user.
Expand Down
8 changes: 4 additions & 4 deletions tests/config/itkdev_openid_connect.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ itkdev_openid_connect:
openid_providers:
test_provider_1:
options:
metadata_url: "https://provider.com/openid-configuration"
metadata_url: "https://provider.example.org/openid-configuration"
client_id: "test_id"
client_secret: "test_secret"
redirect_uri: "https://app.com/callback_uri"
redirect_uri: "https://app.example.org/callback_uri"
test_provider_2:
options:
metadata_url: "https://provider.com/openid-configuration"
metadata_url: "https://provider.example.org/openid-configuration"
client_id: "test_id"
leeway: 5
client_secret: "test_secret"
redirect_uri: "https://app.com/callback_uri"
redirect_uri: "https://app.example.org/callback_uri"