A free open source IT asset/license management system
Sync Adapters - updated omnissa API URL
snipe9018dec80713
diff --git a/app/SyncAdapters/WorkspaceOne/WorkspaceOneAdapter.php b/app/SyncAdapters/WorkspaceOne/WorkspaceOneAdapter.phpindex e945178a28..e4e2d1d838 100644--- a/app/SyncAdapters/WorkspaceOne/WorkspaceOneAdapter.php+++ b/app/SyncAdapters/WorkspaceOne/WorkspaceOneAdapter.php@@ -5,7 +5,6 @@ namespace App\SyncAdapters\WorkspaceOne;use App\Models\Asset;use App\SyncAdapters\HostInventoryRecord;use App\SyncAdapters\PushableSyncAdapter;-use App\SyncAdapters\SyncAdapter;use Carbon\Carbon;use Illuminate\Support\Arr;use Illuminate\Support\Facades\Log;@@ -18,8 +17,11 @@ use Illuminate\Support\Facades\Log;* device-update endpoint.** Modern Workspace ONE tenants use OAuth 2.0 client credentials- * against a per-region auth endpoint (na.uemauth.vmwservices.com,- * emea.uemauth.vmwservices.com, apac.uemauth.vmwservices.com, etc.).+ * against a per-region auth endpoint (na.uemauth.workspaceone.com,+ * emea.uemauth.workspaceone.com, apac.uemauth.workspaceone.com, etc.).+ * The vendor renamed from VMware to Omnissa in 2024 and the auth+ * hosts moved from *.vmwservices.com to *.workspaceone.com. Full+ * regional list: https://kb.omnissa.com/s/article/6000867.* The access token is carried as `Authorization: Bearer` on Dashboard* API calls plus an `aw-tenant-code` header identifying which tenant* to scope the call to. tenant_code and client_id are non-secret.@@ -98,24 +100,30 @@ class WorkspaceOneAdapter extends PushableSyncAdapter/*** Derive the region-scoped OAuth token host from the API host.* Workspace ONE uses a per-region auth endpoint. asXXX.awmdm.com- * → na.uemauth.vmwservices.com etc. The mapping is inferred from- * the first two chars of the API host (as-, ds-, uat-).+ * → na.uemauth.workspaceone.com etc. The mapping is inferred from+ * the first three chars of the API host (as-, ds-, uat-).* Falls back to the NA endpoint when the base URL doesn't parse.+ *+ * Hosts migrated from *.vmwservices.com to *.workspaceone.com+ * following the Omnissa rebrand. Older vmwservices.com URLs no+ * longer resolve. If Omnissa adds a region beyond APAC / EMEA /+ * NA / UAT, add it here and reference the published list at+ * https://kb.omnissa.com/s/article/6000867.*/private function deriveAuthBaseUrl(string $apiBaseUrl): string{$host = parse_url($apiBaseUrl, PHP_URL_HOST);if (! is_string($host)) {- return 'https://na.uemauth.vmwservices.com';+ return 'https://na.uemauth.workspaceone.com';}$prefix = strtolower(substr($host, 0, 3));return match ($prefix) {- 'apa' => 'https://apac.uemauth.vmwservices.com',- 'eme' => 'https://emea.uemauth.vmwservices.com',- 'uat' => 'https://uat.uemauth.vmwservices.com',- default => 'https://na.uemauth.vmwservices.com',+ 'apa' => 'https://apac.uemauth.workspaceone.com',+ 'eme' => 'https://emea.uemauth.workspaceone.com',+ 'uat' => 'https://uat.uemauth.workspaceone.com',+ default => 'https://na.uemauth.workspaceone.com',};}diff --git a/tests/Feature/SyncAdapters/WorkspaceOne/WorkspaceOneAdapterTest.php b/tests/Feature/SyncAdapters/WorkspaceOne/WorkspaceOneAdapterTest.phpindex 4fe2d91076..f42760cbe8 100644--- a/tests/Feature/SyncAdapters/WorkspaceOne/WorkspaceOneAdapterTest.php+++ b/tests/Feature/SyncAdapters/WorkspaceOne/WorkspaceOneAdapterTest.php@@ -98,6 +98,68 @@ class WorkspaceOneAdapterTest extends TestCase$this->assertNotNull($record->lastSeen);}+ /**+ * Regression for issue #20003. The vendor renamed from VMware to+ * Omnissa and the OAuth token hosts migrated from+ * *.vmwservices.com to *.workspaceone.com. The old hosts no longer+ * resolve, which left every pre-fix tenant failing with a cURL 28+ * DNS-timeout on first token exchange. Assert the per-region auth+ * host that goes out on the wire so a future rename or typo in the+ * derived URL gets caught at test time.+ *+ * Each case covers one branch of the match in+ * WorkspaceOneAdapter::deriveAuthBaseUrl, keyed off the first+ * three chars of the API host.+ *+ * @return array<string, array{apiHost: string, expectedAuthHost: string}>+ */+ public static function regionAuthHostCases(): array+ {+ return [+ 'na default (asXXX)' => [+ 'apiHost' => 'as123.awmdm.com',+ 'expectedAuthHost' => 'na.uemauth.workspaceone.com',+ ],+ 'na default (dsXXX)' => [+ 'apiHost' => 'ds456.awmdm.com',+ 'expectedAuthHost' => 'na.uemauth.workspaceone.com',+ ],+ 'apac' => [+ 'apiHost' => 'apac789.awmdm.com',+ 'expectedAuthHost' => 'apac.uemauth.workspaceone.com',+ ],+ 'emea' => [+ 'apiHost' => 'emea101.awmdm.com',+ 'expectedAuthHost' => 'emea.uemauth.workspaceone.com',+ ],+ 'uat' => [+ 'apiHost' => 'uat202.awmdm.com',+ 'expectedAuthHost' => 'uat.uemauth.workspaceone.com',+ ],+ ];+ }++ #[\PHPUnit\Framework\Attributes\DataProvider('regionAuthHostCases')]+ public function test_oauth_token_request_hits_the_rebranded_omnissa_host(string $apiHost, string $expectedAuthHost): void+ {+ $instance = SyncAdapterInstance::where('slug', 'workspace_one')->firstOrFail();+ SyncAdapterConfig::put($instance->id, 'url', 'https://'.$apiHost);+ SyncAdapterConfig::put($instance->id, 'tenant_code', 'stub-tenant');+ SyncAdapterConfig::put($instance->id, 'client_id', 'stub-client');+ SyncAdapterConfig::put($instance->id, 'client_secret', Crypt::encrypt('fake-secret'));+ $adapter = new WorkspaceOneAdapter($instance->fresh());++ Http::fake([+ '*/connect/token' => Http::response(['access_token' => 'stub-bearer', 'expires_in' => 3600]),+ '*/api/mdm/devices/search*' => Http::response(['Total' => 0, 'PageSize' => 500, 'Page' => 0, 'Devices' => []]),+ ]);++ iterator_to_array($adapter->pull());++ Http::assertSent(fn ($request) => str_contains($request->url(), 'https://'.$expectedAuthHost.'/connect/token'));+ Http::assertNotSent(fn ($request) => str_contains($request->url(), 'vmwservices.com'));+ }+private function configuredAdapter(): WorkspaceOneAdapter{$instance = SyncAdapterInstance::where('slug', 'workspace_one')->firstOrFail();