diff --git a/app_check/CMakeLists.txt b/app_check/CMakeLists.txt index 78c1a30912..ea7d313cca 100644 --- a/app_check/CMakeLists.txt +++ b/app_check/CMakeLists.txt @@ -24,6 +24,7 @@ set(common_SRCS src/include/firebase/app_check/play_integrity_provider.h src/include/firebase/app_check/device_check_provider.h src/include/firebase/app_check/app_attest_provider.h + src/include/firebase/app_check/recaptcha_enterprise_provider.h ) # Run gradle command to make jar @@ -49,6 +50,8 @@ set(android_SRCS # Unsupported providers src/stub/app_attest_provider_stub.cc src/stub/device_check_provider_stub.cc + # TODO: Move when implemented + src/stub/recaptcha_enterprise_provider_stub.cc ) # Source files used by the iOS implementation. @@ -64,6 +67,8 @@ set(ios_SRCS src/ios/device_check_provider_ios.mm # Unsupported providers src/stub/play_integrity_provider_stub.cc + # TODO: Move when implemented + src/stub/recaptcha_enterprise_provider_stub.cc ) # Flatbuffer resource files used by desktop @@ -114,6 +119,7 @@ set(desktop_SRCS src/stub/app_attest_provider_stub.cc src/stub/device_check_provider_stub.cc src/stub/play_integrity_provider_stub.cc + src/stub/recaptcha_enterprise_provider_stub.cc ) if(ANDROID) diff --git a/app_check/src/include/firebase/app_check/recaptcha_enterprise_provider.h b/app_check/src/include/firebase/app_check/recaptcha_enterprise_provider.h new file mode 100644 index 0000000000..bf4206e261 --- /dev/null +++ b/app_check/src/include/firebase/app_check/recaptcha_enterprise_provider.h @@ -0,0 +1,57 @@ +// Copyright 2026 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef FIREBASE_APP_CHECK_SRC_INCLUDE_FIREBASE_APP_CHECK_RECAPTCHA_ENTERPRISE_PROVIDER_H_ +#define FIREBASE_APP_CHECK_SRC_INCLUDE_FIREBASE_APP_CHECK_RECAPTCHA_ENTERPRISE_PROVIDER_H_ + +#include "firebase/app_check.h" + +namespace firebase { +namespace app_check { + +namespace internal { +class RecaptchaEnterpriseProviderFactoryInternal; +} + +/// Implementation of an {@link AppCheckProviderFactory} that builds +/// RecaptchaEnterpriseProviders. This is the default implementation. +class RecaptchaEnterpriseProviderFactory : public AppCheckProviderFactory { + public: +#if !defined(DOXYGEN) + RecaptchaEnterpriseProviderFactory( + const RecaptchaEnterpriseProviderFactory&) = delete; + RecaptchaEnterpriseProviderFactory& operator=( + const RecaptchaEnterpriseProviderFactory&) = delete; +#endif // !defined(DOXYGEN) + + /// Gets an instance of this class for installation into a + /// firebase::app_check::AppCheck instance. + static RecaptchaEnterpriseProviderFactory* GetInstance(); + + /// Gets the AppCheckProvider associated with the given + /// {@link App} instance, or creates one if none + /// already exists. + firebase::app_check::AppCheckProvider* CreateProvider(App* app) override; + + private: + RecaptchaEnterpriseProviderFactory(); + ~RecaptchaEnterpriseProviderFactory() override; + + internal::RecaptchaEnterpriseProviderFactoryInternal* internal_; +}; + +} // namespace app_check +} // namespace firebase + +#endif // FIREBASE_APP_CHECK_SRC_INCLUDE_FIREBASE_APP_CHECK_RECAPTCHA_ENTERPRISE_PROVIDER_H_ diff --git a/app_check/src/stub/recaptcha_enterprise_provider_stub.cc b/app_check/src/stub/recaptcha_enterprise_provider_stub.cc new file mode 100644 index 0000000000..c39a9756cc --- /dev/null +++ b/app_check/src/stub/recaptcha_enterprise_provider_stub.cc @@ -0,0 +1,37 @@ +// Copyright 2026 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "app/src/log.h" +#include "firebase/app_check/recaptcha_enterprise_provider.h" + +namespace firebase { +namespace app_check { + +RecaptchaEnterpriseProviderFactory* +RecaptchaEnterpriseProviderFactory::GetInstance() { + LogError("Recaptcha Enterprise is not supported on this platform."); + return nullptr; +} + +RecaptchaEnterpriseProviderFactory::RecaptchaEnterpriseProviderFactory() + : internal_(nullptr) {} + +RecaptchaEnterpriseProviderFactory::~RecaptchaEnterpriseProviderFactory() {} + +AppCheckProvider* RecaptchaEnterpriseProviderFactory::CreateProvider(App* app) { + return nullptr; +} + +} // namespace app_check +} // namespace firebase