From e86a1428b2712c1747d097ba178b2ca0fdec3265 Mon Sep 17 00:00:00 2001 From: a-maurice Date: Wed, 27 May 2026 16:40:32 -0700 Subject: [PATCH 1/2] Add Recaptcha App Check Provider stubs --- app_check/CMakeLists.txt | 6 ++ .../app_check/recaptcha_enterprise_provider.h | 56 +++++++++++++++++++ .../recaptcha_enterprise_provider_stub.cc | 35 ++++++++++++ 3 files changed, 97 insertions(+) create mode 100644 app_check/src/include/firebase/app_check/recaptcha_enterprise_provider.h create mode 100644 app_check/src/stub/recaptcha_enterprise_provider_stub.cc diff --git a/app_check/CMakeLists.txt b/app_check/CMakeLists.txt index 78c1a30912..1e737ed5fe 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/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..1a4597c238 --- /dev/null +++ b/app_check/src/include/firebase/app_check/recaptcha_enterprise_provider.h @@ -0,0 +1,56 @@ +// 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..34c055d2be --- /dev/null +++ b/app_check/src/stub/recaptcha_enterprise_provider_stub.cc @@ -0,0 +1,35 @@ +// 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() {} + +RecaptchaEnterpriseProviderFactory::~RecaptchaEnterpriseProviderFactory() {} + +AppCheckProvider* RecaptchaEnterpriseProviderFactory::CreateProvider(App* app) { + return nullptr; +} + +} // namespace app_check +} // namespace firebase From 70b6a8cc23159f1dd85f6e55d7f54b88efd378d1 Mon Sep 17 00:00:00 2001 From: a-maurice Date: Wed, 27 May 2026 16:44:27 -0700 Subject: [PATCH 2/2] Fix issues --- app_check/CMakeLists.txt | 2 +- .../firebase/app_check/recaptcha_enterprise_provider.h | 7 ++++--- app_check/src/stub/recaptcha_enterprise_provider_stub.cc | 6 ++++-- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/app_check/CMakeLists.txt b/app_check/CMakeLists.txt index 1e737ed5fe..ea7d313cca 100644 --- a/app_check/CMakeLists.txt +++ b/app_check/CMakeLists.txt @@ -24,7 +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/recaptcha_enterprise_provider.h + src/include/firebase/app_check/recaptcha_enterprise_provider.h ) # Run gradle command to make jar 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 index 1a4597c238..bf4206e261 100644 --- a/app_check/src/include/firebase/app_check/recaptcha_enterprise_provider.h +++ b/app_check/src/include/firebase/app_check/recaptcha_enterprise_provider.h @@ -29,9 +29,10 @@ class RecaptchaEnterpriseProviderFactoryInternal; class RecaptchaEnterpriseProviderFactory : public AppCheckProviderFactory { public: #if !defined(DOXYGEN) - RecaptchaEnterpriseProviderFactory(const RecaptchaEnterpriseProviderFactory&) = delete; - RecaptchaEnterpriseProviderFactory& operator=(const RecaptchaEnterpriseProviderFactory&) = - delete; + RecaptchaEnterpriseProviderFactory( + const RecaptchaEnterpriseProviderFactory&) = delete; + RecaptchaEnterpriseProviderFactory& operator=( + const RecaptchaEnterpriseProviderFactory&) = delete; #endif // !defined(DOXYGEN) /// Gets an instance of this class for installation into a diff --git a/app_check/src/stub/recaptcha_enterprise_provider_stub.cc b/app_check/src/stub/recaptcha_enterprise_provider_stub.cc index 34c055d2be..c39a9756cc 100644 --- a/app_check/src/stub/recaptcha_enterprise_provider_stub.cc +++ b/app_check/src/stub/recaptcha_enterprise_provider_stub.cc @@ -18,12 +18,14 @@ namespace firebase { namespace app_check { -RecaptchaEnterpriseProviderFactory* RecaptchaEnterpriseProviderFactory::GetInstance() { +RecaptchaEnterpriseProviderFactory* +RecaptchaEnterpriseProviderFactory::GetInstance() { LogError("Recaptcha Enterprise is not supported on this platform."); return nullptr; } -RecaptchaEnterpriseProviderFactory::RecaptchaEnterpriseProviderFactory() {} +RecaptchaEnterpriseProviderFactory::RecaptchaEnterpriseProviderFactory() + : internal_(nullptr) {} RecaptchaEnterpriseProviderFactory::~RecaptchaEnterpriseProviderFactory() {}