-
Notifications
You must be signed in to change notification settings - Fork 1.7k
App Check: optimize auto-refresh #8232
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 45 commits
Commits
Show all changes
51 commits
Select commit
Hold shift + click to select a range
ff204f3
App Attest provider: attestation sequence (#7971)
maksymmalyhin 869f87c
Implement app attest key ID storage (#8014)
ncooke3 f2b77f0
Merge branch 'master' into appcheck-appattest-main
maksymmalyhin 39ae2d3
App Check App Attest workflow updates: initial handshake (#8032)
maksymmalyhin ccac49c
FIRAppAttestArtifactStorage implementation and tests (#8041)
maksymmalyhin c7558b5
Implement App Attest `getRandomChallenge` (#8033)
ncooke3 e7f1ff8
Merge branch 'master' into appcheck-appattest-main
maksymmalyhin ed07e4b
Define Exchange AppAttest Assertion for FAC token API (#8058)
ncooke3 67b5c3a
Merge branch 'master' into appcheck-appattest-main
maksymmalyhin 786f613
App Check App Attest: attestation request (#8059)
maksymmalyhin 6742e33
Merge branch 'master' into appcheck-appattest-main
maksymmalyhin a35d7bd
App Check App Attest initial handshake adjustments (#8067)
maksymmalyhin 2b16a5f
Merge remote-tracking branch 'origin/master' into appcheck-appattest-…
maksymmalyhin c2bb06b
Implement API for ExchangeAppAttestAssertionRequest endpoint (#8065)
ncooke3 cd53ea8
Merge remote-tracking branch 'origin/master' into appcheck-appattest-…
maksymmalyhin e04a789
Merge branch 'appcheck-appattest-main' of github.com:firebase/firebas…
maksymmalyhin ac17a23
App Check App Attest assertion flow (#8083)
maksymmalyhin b9d638e
Merge remote-tracking branch 'origin/master' into appcheck-appattest-…
maksymmalyhin cea2f68
App Check: store App Attest artifact per key ID (#8097)
maksymmalyhin 2b70bf0
App Check: prevent concurrent token requests (#8117)
maksymmalyhin f134778
Merge remote-tracking branch 'origin/master' into appcheck-appattest-…
maksymmalyhin 2102187
Changelog
maksymmalyhin c0650aa
Merge branch 'master' into appcheck-appattest-main
maksymmalyhin b8f80f3
App Check App Attest: handle attestation rejection (#8170)
maksymmalyhin 76486af
Add FIRAppAttestProvider.h the umbrella header
maksymmalyhin 67c6d91
Add receivedAtDate property to the FAC token
maksymmalyhin a7c4792
Update tests to check receivedAtDate field where important
maksymmalyhin 0317855
[WIP] Use FIRAppCheckTokenRefreshResult instead in the refresher API
maksymmalyhin e24afb9
Merge remote-tracking branch 'origin/master' into mm/appcheck-refresh
maksymmalyhin 8c40b6d
[WIP] Fix refgresher usage
maksymmalyhin e0e570c
Update tests with new API, keep old logic
maksymmalyhin e30ba15
Merge remote-tracking branch 'origin/master' into mm/appcheck-refresh
maksymmalyhin 6b846fc
Update tests with new logic
maksymmalyhin 847fb98
WIP
maksymmalyhin 813c671
WIP
maksymmalyhin 5987d2e
Initial refresh tests and fixes.
maksymmalyhin 8894e82
Add #import <TargetConditionals.h> where needed.
maksymmalyhin 4391ce9
Formatting
maksymmalyhin 93836e3
Cleanup and test updates
maksymmalyhin 5276c56
style
maksymmalyhin 40fc64b
Comments
maksymmalyhin 5c312bc
Merge remote-tracking branch 'origin/master' into mm/appcheck-refresh
maksymmalyhin f4a7c7f
Cleanup and comments
maksymmalyhin a9812ca
Fix catalyst
maksymmalyhin 4713d08
Changelog
maksymmalyhin 9825b6f
Changelog version fix
maksymmalyhin 3ec8edc
Typo
maksymmalyhin 26241c6
Cleanup
maksymmalyhin f9d140d
Typo
maksymmalyhin d62661c
Merge branch 'mm/appcheck-refresh' of github.com:firebase/firebase-io…
maksymmalyhin c6aa5ca
Imports order
maksymmalyhin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,5 @@ | ||
| # 8.1.0 -- M97 | ||
| # 8.1.0 -- M98 | ||
| - [added] Apple's App Attest attestation provider support. (#8133) | ||
| - [changed] Token auto-refresh optimizations. (#8232) | ||
| # v8.0.0 -- M95 | ||
| - [added] Firebase abuse reduction support SDK. (#7928, #7937, #7948) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| /* | ||
| * Copyright 2021 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. | ||
| */ | ||
|
|
||
| #import <Foundation/Foundation.h> | ||
|
|
||
| #import "FirebaseAppCheck/Sources/Public/FirebaseAppCheck/FIRAppCheckToken.h" | ||
|
|
||
| NS_ASSUME_NONNULL_BEGIN | ||
|
|
||
| @interface FIRAppCheckToken () | ||
ncooke3 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| /// A date when the Firebase App Check token was received in the device's local time. | ||
| @property(nonatomic) NSDate *receivedAtDate; | ||
|
|
||
| /// The designated initializer. | ||
| /// @param token A Firebase App Check token. | ||
| /// @param expirationDate A Firebase App Check token expiration date in the device local time. | ||
| /// @param receivedAtDate A date when the Firebase App Check token was received in the device's | ||
| /// local time. | ||
| - (instancetype)initWithToken:(NSString *)token | ||
| expirationDate:(NSDate *)expirationDate | ||
| receivedAtDate:(NSDate *)receivedAtDate NS_DESIGNATED_INITIALIZER; | ||
|
|
||
| @end | ||
|
|
||
| NS_ASSUME_NONNULL_END | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
FirebaseAppCheck/Sources/Core/TokenRefresh/FIRAppCheckTokenRefreshResult.h
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
| /* | ||
| * Copyright 2021 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. | ||
| */ | ||
|
|
||
| #import <Foundation/Foundation.h> | ||
|
|
||
| NS_ASSUME_NONNULL_BEGIN | ||
|
|
||
| /// Represents possible results of a Firebase App Check token refresh attempt that matter for | ||
| /// `FIRAppCheckTokenRefresher`. | ||
| typedef NS_ENUM(NSInteger, FIRAppCheckTokenRefreshStatus) { | ||
| // The token has not been refreshed. | ||
| FIRAppCheckTokenRefreshStatusNever, | ||
|
|
||
| // The token was successfully refreshed. | ||
| FIRAppCheckTokenRefreshStatusSuccess, | ||
|
|
||
| // The token refresh failed. | ||
| FIRAppCheckTokenRefreshStatusFailure | ||
| }; | ||
|
|
||
| /// An object to pass the possible results of a Firebase App Check token refresh attempt and | ||
| /// supplementary data. | ||
| @interface FIRAppCheckTokenRefreshResult : NSObject | ||
|
|
||
| /// Status of the refresh. | ||
| @property(nonatomic, readonly) FIRAppCheckTokenRefreshStatus status; | ||
|
|
||
| /// A date when the new Firebase App Check token is expiring. | ||
| @property(nonatomic, readonly, nullable) NSDate *tokenExpirationDate; | ||
|
|
||
| /// A date when the new Firebase App Check token was received from the server. | ||
| @property(nonatomic, readonly, nullable) NSDate *tokenReceivedAtDate; | ||
|
|
||
| - (instancetype)init NS_UNAVAILABLE; | ||
|
|
||
| /// Initializes the instance with `FIRAppCheckTokenRefreshStatusNever`. | ||
| - (instancetype)initWithStatusNever; | ||
|
|
||
| /// Initializes the instance with `FIRAppCheckTokenRefreshStatusFailure`. | ||
| - (instancetype)initWithStatusFailure; | ||
|
|
||
| /// Initializes the instance with `FIRAppCheckTokenRefreshStatusFailure`. | ||
maksymmalyhin marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| /// @param tokenExpirationDate See `tokenExpirationDate` property. | ||
| /// @param tokenReceivedAtDate See `tokenReceivedAtDate` property. | ||
| - (instancetype)initWithStatusSuccessAndExpirationDate:(NSDate *)tokenExpirationDate | ||
| receivedAtDate:(NSDate *)tokenReceivedAtDate; | ||
|
|
||
| @end | ||
|
|
||
| NS_ASSUME_NONNULL_END | ||
64 changes: 64 additions & 0 deletions
64
FirebaseAppCheck/Sources/Core/TokenRefresh/FIRAppCheckTokenRefreshResult.m
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| /* | ||
| * Copyright 2021 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. | ||
| */ | ||
|
|
||
| #import "FirebaseAppCheck/Sources/Core/TokenRefresh/FIRAppCheckTokenRefreshResult.h" | ||
|
|
||
| NS_ASSUME_NONNULL_BEGIN | ||
|
|
||
| @interface FIRAppCheckTokenRefreshResult () | ||
|
|
||
| - (instancetype)initWithStatus:(FIRAppCheckTokenRefreshStatus)status | ||
| expirationDate:(nullable NSDate *)tokenExpirationDate | ||
| receivedAtDate:(nullable NSDate *)tokenReceivedAtDate NS_DESIGNATED_INITIALIZER; | ||
|
|
||
| @end | ||
|
|
||
| @implementation FIRAppCheckTokenRefreshResult | ||
|
|
||
| - (instancetype)initWithStatus:(FIRAppCheckTokenRefreshStatus)status | ||
| expirationDate:(nullable NSDate *)tokenExpirationDate | ||
| receivedAtDate:(nullable NSDate *)tokenReceivedAtDate { | ||
| self = [super init]; | ||
| if (self) { | ||
| _status = status; | ||
| _tokenExpirationDate = tokenExpirationDate; | ||
| _tokenReceivedAtDate = tokenReceivedAtDate; | ||
| } | ||
| return self; | ||
| } | ||
|
|
||
| - (instancetype)initWithStatusNever { | ||
| return [self initWithStatus:FIRAppCheckTokenRefreshStatusNever | ||
| expirationDate:nil | ||
| receivedAtDate:nil]; | ||
| } | ||
|
|
||
| - (instancetype)initWithStatusFailure { | ||
| return [self initWithStatus:FIRAppCheckTokenRefreshStatusFailure | ||
| expirationDate:nil | ||
| receivedAtDate:nil]; | ||
| } | ||
|
|
||
| - (instancetype)initWithStatusSuccessAndExpirationDate:(NSDate *)tokenExpirationDate | ||
| receivedAtDate:(NSDate *)tokenReceivedAtDate { | ||
| return [self initWithStatus:FIRAppCheckTokenRefreshStatusSuccess | ||
| expirationDate:tokenExpirationDate | ||
| receivedAtDate:tokenReceivedAtDate]; | ||
| } | ||
|
|
||
| @end | ||
|
|
||
| NS_ASSUME_NONNULL_END |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.