From b35909368b3bd78bb3c7401c694aef02d6a560dd Mon Sep 17 00:00:00 2001 From: Greg Bowler Date: Thu, 5 Nov 2026 22:09:32 +0000 Subject: [PATCH 1/2] Allow HTTP providers on test domains --- README.md | 2 + src/Authenticator.php | 2 +- src/ProviderUri/BaseProviderUri.php | 3 ++ test/phpunit/ProviderUri/TestDomainTest.php | 42 +++++++++++++++++++++ 4 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 test/phpunit/ProviderUri/TestDomainTest.php diff --git a/README.md b/README.md index 9778c37..e0b69e3 100644 --- a/README.md +++ b/README.md @@ -104,3 +104,5 @@ composer test ``` The test script runs PHPUnit, PHPStan, PHP_CodeSniffer and PHPMD. To run the unit tests alone, use `composer phpunit`. + +For a local test provider, HTTP is supported for hosts ending in `.test`, such as `http://login.realtest.authwave.test:9090`. Configure local DNS or a hosts-file entry for the provider. This exception applies only to HTTP and the complete `.test` hostname suffix; `.authwave-test` and names such as `example.test.com` do not qualify. Other remote providers require HTTPS. Use test accounts on a trusted development network; the suffix does not encrypt traffic or guarantee that it stays on your machine. diff --git a/src/Authenticator.php b/src/Authenticator.php index 482bd81..797ec54 100644 --- a/src/Authenticator.php +++ b/src/Authenticator.php @@ -12,7 +12,7 @@ use GT\Cipher\Message\EncryptedMessage; use GT\Cipher\Message\PlainTextMessage; use GT\Http\Uri; -use Gt\Logger\Log; +use GT\Logger\Log; use GT\Session\SessionContainer; use Psr\Http\Message\UriInterface; diff --git a/src/ProviderUri/BaseProviderUri.php b/src/ProviderUri/BaseProviderUri.php index 0153555..86d04ff 100644 --- a/src/ProviderUri/BaseProviderUri.php +++ b/src/ProviderUri/BaseProviderUri.php @@ -25,8 +25,11 @@ protected function normaliseBaseUri(string $baseUri):Uri { ->withHost($host) ->withPort($port); + $isTestHttp = $uri->getScheme() === "http" + && str_ends_with(strtolower(rtrim($uri->getHost(), ".")), ".test"); if($uri->getHost() !== "localhost" && $uri->getHost() !== "127.0.0.127" + && !$isTestHttp && $uri->getScheme() !== "https") { throw new InsecureProtocolException($uri->getScheme()); } diff --git a/test/phpunit/ProviderUri/TestDomainTest.php b/test/phpunit/ProviderUri/TestDomainTest.php new file mode 100644 index 0000000..88d5128 --- /dev/null +++ b/test/phpunit/ProviderUri/TestDomainTest.php @@ -0,0 +1,42 @@ +getPath()); + if($allowed && str_starts_with($host, "http://")) { + self::assertSame("http", $uri->getScheme()); + } + if(str_contains($host, ":9090")) { + self::assertSame(9090, $uri->getPort()); + } + } +} From 4dcc01fe5d07933400c82695bf9574097ee19d43 Mon Sep 17 00:00:00 2001 From: Greg Bowler Date: Thu, 5 Nov 2026 22:11:55 +0000 Subject: [PATCH 2/2] Keep logger import compatible with the locked dependency --- src/Authenticator.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Authenticator.php b/src/Authenticator.php index 797ec54..482bd81 100644 --- a/src/Authenticator.php +++ b/src/Authenticator.php @@ -12,7 +12,7 @@ use GT\Cipher\Message\EncryptedMessage; use GT\Cipher\Message\PlainTextMessage; use GT\Http\Uri; -use GT\Logger\Log; +use Gt\Logger\Log; use GT\Session\SessionContainer; use Psr\Http\Message\UriInterface;