Skip to content

Commit d943639

Browse files
committed
Added skeleton code for PlayIntegrityAppCheckProviderFactory and PlayIntegrityAppCheckProvider.
1 parent d8ee928 commit d943639

File tree

3 files changed

+82
-0
lines changed

3 files changed

+82
-0
lines changed

appcheck/firebase-appcheck-playintegrity/firebase-appcheck-playintegrity.gradle

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ dependencies {
4444
implementation project(':firebase-common')
4545
implementation project(':firebase-components')
4646
implementation project(':appcheck:firebase-appcheck')
47+
implementation 'com.google.android.gms:play-services-base:18.0.1'
48+
implementation 'com.google.android.gms:play-services-tasks:18.0.1'
4749

4850
testImplementation 'junit:junit:4.13-beta-2'
4951
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
// Copyright 2022 Google LLC
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
package com.google.firebase.appcheck.playintegrity;
16+
17+
import androidx.annotation.NonNull;
18+
import com.google.firebase.FirebaseApp;
19+
import com.google.firebase.appcheck.AppCheckProvider;
20+
import com.google.firebase.appcheck.AppCheckProviderFactory;
21+
import com.google.firebase.appcheck.playintegrity.internal.PlayIntegrityAppCheckProvider;
22+
23+
/**
24+
* Implementation of an {@link AppCheckProviderFactory} that builds {@link
25+
* PlayIntegrityAppCheckProvider}s. This is the default implementation.
26+
*/
27+
public class PlayIntegrityAppCheckProviderFactory implements AppCheckProviderFactory {
28+
29+
private static final PlayIntegrityAppCheckProviderFactory instance =
30+
new PlayIntegrityAppCheckProviderFactory();
31+
32+
/**
33+
* Gets an instance of this class for installation into a {@link
34+
* com.google.firebase.appcheck.FirebaseAppCheck} instance.
35+
*/
36+
@NonNull
37+
public static PlayIntegrityAppCheckProviderFactory getInstance() {
38+
return instance;
39+
}
40+
41+
@NonNull
42+
@Override
43+
public AppCheckProvider create(@NonNull FirebaseApp firebaseApp) {
44+
return new PlayIntegrityAppCheckProvider();
45+
}
46+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
// Copyright 2022 Google LLC
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
package com.google.firebase.appcheck.playintegrity.internal;
16+
17+
import androidx.annotation.NonNull;
18+
import com.google.android.gms.tasks.Task;
19+
import com.google.android.gms.tasks.Tasks;
20+
import com.google.firebase.FirebaseException;
21+
import com.google.firebase.appcheck.AppCheckProvider;
22+
import com.google.firebase.appcheck.AppCheckToken;
23+
24+
public class PlayIntegrityAppCheckProvider implements AppCheckProvider {
25+
26+
public PlayIntegrityAppCheckProvider() {}
27+
28+
@NonNull
29+
@Override
30+
public Task<AppCheckToken> getToken() {
31+
// TODO(rosalyntan): Implement this.
32+
return Tasks.forException(new FirebaseException("Unimplemented"));
33+
}
34+
}

0 commit comments

Comments
 (0)