diff --git a/appcheck/firebase-appcheck-playintegrity/firebase-appcheck-playintegrity.gradle b/appcheck/firebase-appcheck-playintegrity/firebase-appcheck-playintegrity.gradle new file mode 100644 index 00000000000..4e02b8282fa --- /dev/null +++ b/appcheck/firebase-appcheck-playintegrity/firebase-appcheck-playintegrity.gradle @@ -0,0 +1,51 @@ +// Copyright 2022 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. + +plugins { + id 'firebase-library' +} + +firebaseLibrary { + publishSources = true +} + +android { + adbOptions { + timeOutInMs 60 * 1000 + } + + compileSdkVersion project.targetSdkVersion + defaultConfig { + targetSdkVersion project.targetSdkVersion + minSdkVersion project.minSdkVersion + versionName version + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" + } + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } + + testOptions.unitTests.includeAndroidResources = false +} + +dependencies { + implementation project(':firebase-common') + implementation project(':firebase-components') + implementation project(':appcheck:firebase-appcheck') + implementation 'com.google.android.gms:play-services-base:18.0.1' + implementation 'com.google.android.gms:play-services-tasks:18.0.1' + + testImplementation 'junit:junit:4.13-beta-2' +} diff --git a/appcheck/firebase-appcheck-playintegrity/gradle.properties b/appcheck/firebase-appcheck-playintegrity/gradle.properties new file mode 100644 index 00000000000..29ae9e151c9 --- /dev/null +++ b/appcheck/firebase-appcheck-playintegrity/gradle.properties @@ -0,0 +1 @@ +version=16.0.0-beta01 diff --git a/appcheck/firebase-appcheck-playintegrity/src/main/AndroidManifest.xml b/appcheck/firebase-appcheck-playintegrity/src/main/AndroidManifest.xml new file mode 100644 index 00000000000..3599f8e6755 --- /dev/null +++ b/appcheck/firebase-appcheck-playintegrity/src/main/AndroidManifest.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + diff --git a/appcheck/firebase-appcheck-playintegrity/src/main/java/com/google/firebase/appcheck/playintegrity/PlayIntegrityAppCheckProviderFactory.java b/appcheck/firebase-appcheck-playintegrity/src/main/java/com/google/firebase/appcheck/playintegrity/PlayIntegrityAppCheckProviderFactory.java new file mode 100644 index 00000000000..4c08c783039 --- /dev/null +++ b/appcheck/firebase-appcheck-playintegrity/src/main/java/com/google/firebase/appcheck/playintegrity/PlayIntegrityAppCheckProviderFactory.java @@ -0,0 +1,46 @@ +// Copyright 2022 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. + +package com.google.firebase.appcheck.playintegrity; + +import androidx.annotation.NonNull; +import com.google.firebase.FirebaseApp; +import com.google.firebase.appcheck.AppCheckProvider; +import com.google.firebase.appcheck.AppCheckProviderFactory; +import com.google.firebase.appcheck.playintegrity.internal.PlayIntegrityAppCheckProvider; + +/** + * Implementation of an {@link AppCheckProviderFactory} that builds {@link + * PlayIntegrityAppCheckProvider}s. This is the default implementation. + */ +public class PlayIntegrityAppCheckProviderFactory implements AppCheckProviderFactory { + + private static final PlayIntegrityAppCheckProviderFactory instance = + new PlayIntegrityAppCheckProviderFactory(); + + /** + * Gets an instance of this class for installation into a {@link + * com.google.firebase.appcheck.FirebaseAppCheck} instance. + */ + @NonNull + public static PlayIntegrityAppCheckProviderFactory getInstance() { + return instance; + } + + @NonNull + @Override + public AppCheckProvider create(@NonNull FirebaseApp firebaseApp) { + return new PlayIntegrityAppCheckProvider(); + } +} diff --git a/appcheck/firebase-appcheck-playintegrity/src/main/java/com/google/firebase/appcheck/playintegrity/internal/PlayIntegrityAppCheckProvider.java b/appcheck/firebase-appcheck-playintegrity/src/main/java/com/google/firebase/appcheck/playintegrity/internal/PlayIntegrityAppCheckProvider.java new file mode 100644 index 00000000000..22d77a846cf --- /dev/null +++ b/appcheck/firebase-appcheck-playintegrity/src/main/java/com/google/firebase/appcheck/playintegrity/internal/PlayIntegrityAppCheckProvider.java @@ -0,0 +1,34 @@ +// Copyright 2022 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. + +package com.google.firebase.appcheck.playintegrity.internal; + +import androidx.annotation.NonNull; +import com.google.android.gms.tasks.Task; +import com.google.android.gms.tasks.Tasks; +import com.google.firebase.FirebaseException; +import com.google.firebase.appcheck.AppCheckProvider; +import com.google.firebase.appcheck.AppCheckToken; + +public class PlayIntegrityAppCheckProvider implements AppCheckProvider { + + public PlayIntegrityAppCheckProvider() {} + + @NonNull + @Override + public Task getToken() { + // TODO(rosalyntan): Implement this. + return Tasks.forException(new FirebaseException("Unimplemented")); + } +} diff --git a/subprojects.cfg b/subprojects.cfg index f3d61498230..b8e1dd646c1 100644 --- a/subprojects.cfg +++ b/subprojects.cfg @@ -2,6 +2,7 @@ appcheck appcheck:firebase-appcheck-debug-testing appcheck:firebase-appcheck-debug appcheck:firebase-appcheck-interop +appcheck:firebase-appcheck-playintegrity appcheck:firebase-appcheck-safetynet appcheck:firebase-appcheck appcheck:firebase-appcheck:test-app