mirror of
https://github.com/archtechx/tenancy.git
synced 2026-06-21 07:14:02 +00:00
Added a failing test for determining if a host is a subdomain, then fixed `DomainTenantResolver::isSubdomain()` (similar fix as in #1423) and a related assertion. Previously, while having `tenancy.identification.central_domains` set to e.g. `['site.com']`, the `isSubdomain()` check consider `tenantsite.com` a subdomain because it ends with `site.com`. Now, instead of the `endsWith()` check, the method checks if the passed domain is in the configured central domains. If it is, it returns `false`. Otherwise, loop through all the central domains and check if the passed domain matches any of the central domains prefixed with a dot (e.g. `tenant.site.com` would be considered a subdomain, `tenant.site.com` wouldn't). Because in InitializeTenancyByDomainOrSubdomain, if tenancy fails to initialize using a subdomain (before this PR's changes, e.g. `tenantsite.com` would be considered a subdomain, and `tenantsite` would be used for initializing tenancy), it'll catch the exception and use the whole domain for identification instead, this error will likely never be noticed in real-world usage. So this PR corrects the subdomain detection logic, but the real-world impact of that is negligible. > Note: The subdomain error catching logic in domainOrSubdomain ID MW was added in v4. If we applied this change in v3, it'd fix a real issue where domainOrSubdomain ID MW would just fail at the subdomain initialization, without attempting domain initialization after the failure. --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Samuel Štancl <samuel@archte.ch> |
||
|---|---|---|
| .. | ||
| Bootstrappers | ||
| Etc | ||
| Features | ||
| RLS | ||
| ActionTest.php | ||
| AutomaticModeTest.php | ||
| BroadcastingTest.php | ||
| CachedTenantResolverTest.php | ||
| CloneActionTest.php | ||
| CombinedDomainAndSubdomainIdentificationTest.php | ||
| CommandsTest.php | ||
| DatabaseCacheBootstrapperTest.php | ||
| DatabasePreparationTest.php | ||
| DatabaseUsersTest.php | ||
| DeleteDomainsJobTest.php | ||
| DomainTest.php | ||
| EarlyIdentificationTest.php | ||
| EventListenerTest.php | ||
| GlobalCacheTest.php | ||
| InitializedBootstrappersTest.php | ||
| MailTest.php | ||
| MaintenanceModeTest.php | ||
| ManualModeTest.php | ||
| OriginHeaderIdentificationTest.php | ||
| PathIdentificationTest.php | ||
| PendingTenantsTest.php | ||
| Pest.php | ||
| PreventAccessFromUnwantedDomainsTest.php | ||
| QueueTest.php | ||
| RequestDataIdentificationTest.php | ||
| ResourceSyncingTest.php | ||
| RouteMiddlewareTest.php | ||
| RunForMultipleTest.php | ||
| ScopeSessionsTest.php | ||
| SessionSeparationTest.php | ||
| SingleDatabaseTenancyTest.php | ||
| SingleDomainTenantTest.php | ||
| SubdomainTest.php | ||
| TenantAssetTest.php | ||
| TenantAwareCommandTest.php | ||
| TenantDatabaseManagerTest.php | ||
| TenantModelTest.php | ||
| TenantUserImpersonationTest.php | ||
| TestCase.php | ||
| UniversalRouteTest.php | ||