diff --git a/src/Migration/Resources/Auth/OAuth2/OAuth2Provider.php b/src/Migration/Resources/Auth/OAuth2/OAuth2Provider.php index e029dbdf..54c2ee00 100644 --- a/src/Migration/Resources/Auth/OAuth2/OAuth2Provider.php +++ b/src/Migration/Resources/Auth/OAuth2/OAuth2Provider.php @@ -49,6 +49,7 @@ final class OAuth2Provider extends Resource 'github' => ['clientId' => ['target' => self::TARGET_APP_ID]], 'gitlab' => ['clientId' => ['target' => self::TARGET_APP_ID], 'endpoint' => ['target' => self::TARGET_SECRET]], 'google' => ['clientId' => ['target' => self::TARGET_APP_ID], 'prompt' => ['target' => self::TARGET_SECRET]], + 'huggingface' => ['clientId' => ['target' => self::TARGET_APP_ID]], 'keycloak' => [ 'clientId' => ['target' => self::TARGET_APP_ID], 'endpoint' => ['target' => self::TARGET_SECRET, 'key' => 'keycloakDomain'], diff --git a/tests/Migration/Unit/Resources/OAuth2ProviderTest.php b/tests/Migration/Unit/Resources/OAuth2ProviderTest.php index c24a06cc..c74b009b 100644 --- a/tests/Migration/Unit/Resources/OAuth2ProviderTest.php +++ b/tests/Migration/Unit/Resources/OAuth2ProviderTest.php @@ -25,6 +25,24 @@ public function testFromArrayAppwrite(): void $this->assertTrue($provider->isConfigured()); } + public function testFromArrayHuggingFace(): void + { + $provider = OAuth2Provider::fromArray('huggingface', [ + 'id' => 'huggingface', + 'enabled' => true, + 'clientId' => 'client-123', + 'clientSecret' => 'super-secret', + ]); + + $this->assertNotNull($provider); + $this->assertEquals('huggingface', $provider->getProviderKey()); + $this->assertTrue($provider->getEnabled()); + $this->assertEquals(['clientId' => 'client-123'], $provider->getSettings()); + $this->assertEquals('client-123', $provider->getDestinationAppId()); + $this->assertEquals([], $provider->getDestinationSecretFields()); + $this->assertTrue($provider->isConfigured()); + } + public function testFromArrayNeverCopiesSecrets(): void { foreach (\array_keys(OAuth2Provider::PROVIDERS) as $providerKey) {