Skip to content

Commit aab6d2e

Browse files
authored
Merge App Check beta branch to prep for launch (#428)
1 parent 4b4f14b commit aab6d2e

File tree

43 files changed

+3240
-72
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+3240
-72
lines changed

.github/workflows/integration_tests.yml

Lines changed: 74 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,48 @@ on:
99

1010
jobs:
1111

12+
grab-pr-body:
13+
runs-on: ubuntu-latest
14+
outputs:
15+
PR_BODY: ${{ steps.body.outputs.PR_BODY }}
16+
steps:
17+
- id: body
18+
env:
19+
PR_BODY: ${{ github.event.pull_request.body }}
20+
run: |
21+
{
22+
echo "PR_BODY<<EOF"
23+
echo "$PR_BODY"
24+
echo "EOF"
25+
} >> "$GITHUB_OUTPUT"
26+
27+
check-pr-body-for-key:
28+
runs-on: ubuntu-latest
29+
needs: grab-pr-body
30+
outputs:
31+
RUN_INTEGRATION: ${{ steps.check_key.outputs.RUN_INTEGRATION }}
32+
steps:
33+
- id: check_key
34+
env:
35+
PR_BODY: ${{ needs.grab-pr-body.outputs.PR_BODY }}
36+
SKIP_KEY: "SKIP_INTEGRATION_TESTS=YES"
37+
name: Check for key and set bool to skip integration tests
38+
run: |
39+
if [[ "$PR_BODY" == *"$SKIP_KEY"* ]]; then
40+
echo "Skipping integration tests for PR body:"
41+
echo "$PR_BODY"
42+
echo "RUN_INTEGRATION=no" >> "$GITHUB_OUTPUT"
43+
else
44+
echo "Running integration tests for PR body:"
45+
echo "$PR_BODY"
46+
echo "RUN_INTEGRATION=yes" >> "$GITHUB_OUTPUT"
47+
fi
48+
1249
swift-button-functional-test:
1350
runs-on: macOS-12
51+
needs: check-pr-body-for-key
1452
# Don't run if triggered by a PR from a fork since our Secrets won't be provided to the runner.
15-
if: "!github.event.pull_request.head.repo.fork"
53+
if: ${{ needs.check-pr-body-for-key.outputs.RUN_INTEGRATION == 'yes' && !github.event.pull_request.head.repo.fork }}
1654
defaults:
1755
run:
1856
working-directory: Samples/Swift/DaysUntilBirthday
@@ -40,3 +78,38 @@ jobs:
4078
-destination 'platform=iOS Simulator,name=iPhone 11' \
4179
EMAIL_SECRET=$EMAIL_SECRET \
4280
PASSWORD_SECRET=$PASSWORD_SECRET
81+
82+
app-check-api-token-tests:
83+
runs-on: macOS-13
84+
# Don't run if triggered by a PR from a fork since our Secrets won't be provided to the runner.
85+
if: "!github.event.pull_request.head.repo.fork"
86+
defaults:
87+
run:
88+
working-directory: Samples/Swift/AppAttestExample
89+
steps:
90+
- name: Checkout
91+
uses: actions/checkout@v3
92+
- name: Use Xcode 15.0.1
93+
run: |
94+
sudo xcode-select -s /Applications/Xcode_15.0.1.app
95+
- name: Build test target for App Check Example
96+
run: |
97+
xcodebuild \
98+
-project AppAttestExample.xcodeproj \
99+
build-for-testing \
100+
-scheme AppAttestExample \
101+
-sdk iphonesimulator \
102+
-destination 'platform=iOS Simulator,name=iPhone 15'
103+
- name: Run test target for App Check Example
104+
env:
105+
AppCheckDebugToken : ${{ secrets.APP_CHECK_DEBUG_TOKEN }}
106+
APP_CHECK_WEB_API_KEY : ${{ secrets.APP_CHECK_WEB_API_KEY }}
107+
run: |
108+
xcodebuild \
109+
-project AppAttestExample.xcodeproj \
110+
test-without-building \
111+
-scheme AppAttestExample \
112+
-sdk iphonesimulator \
113+
-destination 'platform=iOS Simulator,name=iPhone 15' \
114+
AppCheckDebugToken=$AppCheckDebugToken \
115+
APP_CHECK_WEB_API_KEY=$APP_CHECK_WEB_API_KEY

.github/workflows/unit_tests.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,22 @@ jobs:
2020
"",
2121
"--use-static-frameworks"
2222
]
23-
include:
24-
- podspec: GoogleSignInSwiftSupport.podspec
25-
includePodspecFlag: "--include-podspecs='GoogleSignIn.podspec'"
23+
# See #400 (https://github.com/google/GoogleSignIn-iOS/issues/400)
24+
# include:
25+
# - podspec: GoogleSignInSwiftSupport.podspec
26+
# includePodspecFlag: "--include-podspecs='GoogleSignIn.podspec'"
2627
steps:
2728
- uses: actions/checkout@v3
2829
- name: Update Bundler
2930
run: bundle update --bundler
3031
- name: Install Ruby gems with Bundler
3132
run: bundle install
3233
- name: Lint podspec using local source
34+
# See #400 (https://github.com/google/GoogleSignIn-iOS/issues/400)
3335
run: |
3436
pod lib lint ${{ matrix.podspec }} --verbose \
35-
${{ matrix.includePodspecFlag }} ${{ matrix.flag }}
37+
--sources=https://cdn.cocoapods.org/ \
38+
${{ matrix.flag }}
3639
3740
spm-build-test:
3841
runs-on: ${{ matrix.os }}

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,6 @@ Credentials.xcconfig
1616
Pods/
1717
gen/
1818
Podfile.lock
19+
20+
# Firebase App Check Example
21+
**/GoogleService-Info.plist

CHANGELOG.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
# 7.1.0-fac-beta-1.1.0
2+
- Beta release supporting Firebase App Check tokens used
3+
to establish your application's integrity while signing in with Google
4+
- Adds privacy manifest support released in [v7.1.0](https://github.com/google/GoogleSignIn-iOS/releases/tag/7.1.0)
5+
- Internal
6+
- Check integration test for presubmit instruction ([#368](https://github.com/google/GoogleSignIn-iOS/pull/368))
7+
- Test skip integration key ([#374](https://github.com/google/GoogleSignIn-iOS/pull/374))
8+
- Add Privacy Manifest to App Check Release Branch ([#392](https://github.com/google/GoogleSignIn-iOS/pull/392))
9+
- [Add return type to init in GIDFakeFetcherService header](https://github.com/google/GoogleSignIn-iOS/commit/ebf681cac127497da55c932cb5bbf185971a29e7)
10+
111
# 7.1.0
212
- Update to Swift 5.0 in `GoogleSignInSwiftSupport` pod ([#317](https://github.com/google/GoogleSignIn-iOS/pull/317))
313
- Documentation updates ([#351](https://github.com/google/GoogleSignIn-iOS/pull/351), [#372](https://github.com/google/GoogleSignIn-iOS/pull/372))
@@ -10,6 +20,32 @@
1020
- Removes `macos-11` runner in GitHub workflows ([#302](https://github.com/google/GoogleSignIn-iOS/pull/302))
1121
- Updates button name reference so UI automation tests pass ([#308](https://github.com/google/GoogleSignIn-iOS/pull/308))
1222

23+
# 7.1.0-fac-beta-1.0.0
24+
- Beta release supporting Firebase App Check tokens used
25+
to establish your application's integrity while signing in with Google
26+
- Internal
27+
- Update SignInSample Podfile minimum iOS version ([#355](https://github.com/google/GoogleSignIn-iOS/pull/355))
28+
- Update AppCheckExample unit test target to pass during continuous integration ([#356](https://github.com/google/GoogleSignIn-iOS/pull/356))
29+
30+
# 7.1.0-fac-eap-1.0.0
31+
- Early Access Program (EAP) release supporting Firebase App Check tokens used
32+
to establish your application's integrity while signing in with Google
33+
- Use [`-[GIDSignIn configureWithCompletion:]`](https://github.com/google/GoogleSignIn-iOS/blob/7.1.0-fac-eap-1.0.0/GoogleSignIn/Sources/Public/GoogleSignIn/GIDSignIn.h#L79)
34+
to configure GSI to use Firebase App Check as early as possible in your app
35+
to minimize latency.
36+
- Use [`-[GIDSignIn configureDebugProviderWithAPIKey:completion:]`](https://github.com/google/GoogleSignIn-iOS/blob/7.1.0-fac-eap-1.0.0/GoogleSignIn/Sources/Public/GoogleSignIn/GIDSignIn.h#L91)
37+
in debug builds or continuous integration environments.
38+
- New [sample app](https://github.com/google/GoogleSignIn-iOS/tree/7.1.0-fac-eap-1.0.0/Samples/Swift/AppAttestExample)
39+
showing example of configuring GSI to use Firebase App Check.
40+
- Internal
41+
- Fix typo in `SFSafariViewController` ([#291](https://github.com/google/GoogleSignIn-iOS/pull/291))
42+
- Removes `macos-11` runner in GitHub workflows ([#302](https://github.com/google/GoogleSignIn-iOS/pull/302))
43+
- Updates button name reference so UI automation tests pass ([#308](https://github.com/google/GoogleSignIn-iOS/pull/308))
44+
- Ensure that `completion` is not nil before calling
45+
`-[GIDSignIn restorePreviousSignIn:]` ([#301](https://github.com/google/GoogleSignIn-iOS/pull/301))
46+
- Use new [delegate protocol](https://github.com/google/GTMAppAuth/pull/224)
47+
from GTMAppAuth 4.0.0 ([#299](https://github.com/google/GoogleSignIn-iOS/pull/299))
48+
1349
# 7.0.0
1450
- All configuration can now be provided via your `Info.plist` file. ([#228](https://github.com/google/GoogleSignIn-iOS/pull/228))
1551
- Use the following keys in `<key>KEY</key><string>VALUE</string>` pairs to configure the SDK:

GoogleSignIn.podspec

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ The Google Sign-In SDK allows users to sign in with their Google account from th
1313
:tag => s.version.to_s
1414
}
1515
s.swift_version = '4.0'
16-
ios_deployment_target = '10.0'
16+
ios_deployment_target = '11.0'
1717
osx_deployment_target = '10.15'
1818
s.ios.deployment_target = ios_deployment_target
1919
s.osx.deployment_target = osx_deployment_target
@@ -33,6 +33,7 @@ The Google Sign-In SDK allows users to sign in with their Google account from th
3333
]
3434
s.ios.framework = 'UIKit'
3535
s.osx.framework = 'AppKit'
36+
s.dependency 'AppCheckCore', '>= 10.19.1', '< 11.0'
3637
s.dependency 'AppAuth', '>= 1.7.3', '< 2.0'
3738
s.dependency 'GTMAppAuth', '>= 4.1.1', '< 5.0'
3839
s.dependency 'GTMSessionFetcher/Core', '~> 3.3'
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
// Copyright 2023 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+
#import <TargetConditionals.h>
16+
#import <Foundation/Foundation.h>
17+
18+
#if TARGET_OS_IOS && !TARGET_OS_MACCATALYST
19+
#import <AppCheckCore/GACAppCheckProvider.h>
20+
21+
@class GACAppCheckToken;
22+
23+
NS_ASSUME_NONNULL_BEGIN
24+
25+
extern NSUInteger const kGIDAppCheckProviderFakeError;
26+
27+
NS_CLASS_AVAILABLE_IOS(14)
28+
@interface GIDAppCheckProviderFake : NSObject <GACAppCheckProvider>
29+
30+
/// Creates an instance conforming to `GACAppCheckProvider` with the provided app check token and
31+
/// error.
32+
///
33+
/// @param token The `GACAppCheckToken` instance to pass into the completion called from
34+
/// `getTokenWithCompletion:`. Use `nil` if you would like a placeholder token from
35+
/// AppCheckCore.
36+
/// @param error The `NSError` to pass into the completion called from
37+
/// `getTokenWithCompletion:`.
38+
- (instancetype)initWithAppCheckToken:(nullable GACAppCheckToken *)token
39+
error:(nullable NSError *)error;
40+
41+
@end
42+
43+
NS_ASSUME_NONNULL_END
44+
45+
#endif // TARGET_OS_IOS && !TARGET_OS_MACCATALYST
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
// Copyright 2023 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+
#import "GoogleSignIn/Sources/GIDAppCheck/Implementations/Fake/GIDAppCheckProviderFake.h"
16+
17+
#if TARGET_OS_IOS && !TARGET_OS_MACCATALYST
18+
19+
#import <AppCheckCore/GACAppCheckToken.h>
20+
21+
NSUInteger const kGIDAppCheckProviderFakeError = 1;
22+
23+
@interface GIDAppCheckProviderFake ()
24+
25+
@property(nonatomic, strong, nullable) GACAppCheckToken *token;
26+
@property(nonatomic, strong, nullable) NSError *error;
27+
28+
@end
29+
30+
@implementation GIDAppCheckProviderFake
31+
32+
- (instancetype)initWithAppCheckToken:(nullable GACAppCheckToken *)token
33+
error:(nullable NSError *)error {
34+
if (self = [super init]) {
35+
_token = token;
36+
_error = error;
37+
}
38+
return self;
39+
}
40+
41+
- (void)getTokenWithCompletion:(void (^)(GACAppCheckToken *, NSError * _Nullable))handler {
42+
dispatch_async(dispatch_get_main_queue(), ^{
43+
handler(self.token, self.error);
44+
});
45+
}
46+
47+
- (void)getLimitedUseTokenWithCompletion:(void (^)(GACAppCheckToken *,
48+
NSError * _Nullable))handler {
49+
dispatch_async(dispatch_get_main_queue(), ^{
50+
handler(self.token, self.error);
51+
});
52+
}
53+
54+
@end
55+
56+
#endif // TARGET_OS_IOS && !TARGET_OS_MACCATALYST
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
/*
2+
* Copyright 2023 Google LLC
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
#import <TargetConditionals.h>
18+
19+
#if TARGET_OS_IOS && !TARGET_OS_MACCATALYST
20+
21+
#import <Foundation/Foundation.h>
22+
23+
NS_ASSUME_NONNULL_BEGIN
24+
25+
@protocol GACAppCheckProvider;
26+
@class GACAppCheckToken;
27+
28+
extern NSString *const kGIDAppCheckPreparedKey;
29+
30+
NS_CLASS_AVAILABLE_IOS(14)
31+
@interface GIDAppCheck : NSObject
32+
33+
- (instancetype)init NS_UNAVAILABLE;
34+
35+
/// Creates the instance of this App Check wrapper class using `GACAppCheckDebugProvider`.
36+
///
37+
/// @param APIKey The API Key to use when creating the debug App Check provider.
38+
///
39+
/// The instance is created using `+[NSUserDefaults standardUserDefaults]`.
40+
+ (instancetype)appCheckUsingDebugProviderWithAPIKey:(NSString *)APIKey;
41+
42+
/// Creates the instance of this App Check wrapper class using `GACAppAttestProvider`.
43+
///
44+
/// The instance is created using `+[NSUserDefaults standardUserDefaults]`.
45+
+ (instancetype)appCheckUsingAppAttestProvider;
46+
47+
/// Creates the instance of this App Check wrapper class.
48+
///
49+
/// @param appCheckProvider The instance performing the Firebase App Check token requests. If `nil`,
50+
/// then a default implementation will be used.
51+
/// @param userDefaults The instance of `NSUserDefaults` that `GIDAppCheck` will use to store its
52+
/// preparation status. If nil, `GIDAppCheck` will use `-[NSUserDefaults standardUserDefaults]`.
53+
- (instancetype)initWithAppCheckProvider:(id<GACAppCheckProvider>)appCheckProvider
54+
userDefaults:(NSUserDefaults *)userDefaults NS_DESIGNATED_INITIALIZER;
55+
56+
/// Prewarms the library for App Check by asking Firebase App Check to generate the App Attest key
57+
/// id and perform the initial attestation process (if needed).
58+
///
59+
/// @param completion A `nullable` callback with a `nullable` `NSError` if preparation fails.
60+
- (void)prepareForAppCheckWithCompletion:(nullable void (^)(NSError * _Nullable error))completion;
61+
62+
/// Fetches the limited use Firebase token.
63+
///
64+
/// @param completion A `nullable` callback with the `FIRAppCheckToken`, or an `NSError` otherwise.
65+
- (void)getLimitedUseTokenWithCompletion:
66+
(nullable void (^)(GACAppCheckToken *token, NSError * _Nullable error))completion;
67+
68+
/// Whether or not the App Attest key ID created and the attestation object has been fetched.
69+
- (BOOL)isPrepared;
70+
71+
@end
72+
73+
NS_ASSUME_NONNULL_END
74+
75+
#endif // TARGET_OS_IOS && !TARGET_OS_MACCATALYST

0 commit comments

Comments
 (0)