From b390b4be6ab204eaa89d3dd7e9fc11683e37dd5a Mon Sep 17 00:00:00 2001 From: Evan Sims Date: Mon, 6 Jun 2022 12:21:10 -0500 Subject: [PATCH] fix: Ensure custom tenant domains are formatted correctly (#633) --- .gitignore | 1 + src/Configuration/SdkConfiguration.php | 2 +- tests/Unit/Configuration/SdkConfigurationTest.php | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index ea79ddc8..f943eaa9 100644 --- a/.gitignore +++ b/.gitignore @@ -17,3 +17,4 @@ psalm.xml.dist rector.php phpdoc.phar .phpdoc +phpdoc.dist.xml diff --git a/src/Configuration/SdkConfiguration.php b/src/Configuration/SdkConfiguration.php index 05d1069e..ba3e5156 100644 --- a/src/Configuration/SdkConfiguration.php +++ b/src/Configuration/SdkConfiguration.php @@ -468,7 +468,7 @@ private function onStateChange( throw \Auth0\SDK\Exception\ConfigurationException::validationFailed($propertyName); } - if ($propertyName === 'domain') { + if ($propertyName === 'domain' || $propertyName === 'customDomain') { if (is_string($propertyValue) && mb_strlen($propertyValue) !== 0) { $host = parse_url($propertyValue, PHP_URL_HOST); return $host ?? $propertyValue; diff --git a/tests/Unit/Configuration/SdkConfigurationTest.php b/tests/Unit/Configuration/SdkConfigurationTest.php index 34729144..58396761 100644 --- a/tests/Unit/Configuration/SdkConfigurationTest.php +++ b/tests/Unit/Configuration/SdkConfigurationTest.php @@ -288,7 +288,7 @@ $sdk = new SdkConfiguration([ 'domain' => $domain, - 'customDomain' => $customDomain, + 'customDomain' => 'test://' . $customDomain, 'cookieSecret' => uniqid(), 'clientId' => uniqid(), 'redirectUri' => uniqid(),