Add generation of limited-use tokens with a TTL of 5 mins#11
Add generation of limited-use tokens with a TTL of 5 mins#11andrewheard merged 10 commits intomainfrom
Conversation
| if (self.ongoingGetTokenOperation == nil) { | ||
| // Kick off a new handshake sequence only when there is not an ongoing | ||
| // handshake to avoid race conditions. | ||
| self.ongoingGetTokenOperation = | ||
| [self createGetTokenSequenceWithBackoffPromise] | ||
|
|
||
| // Release the ongoing operation promise on completion. | ||
| .then(^GACAppCheckToken *(GACAppCheckToken *token) { | ||
| self.ongoingGetTokenOperation = nil; | ||
| return token; | ||
| }) | ||
| .recover(^NSError *(NSError *error) { | ||
| self.ongoingGetTokenOperation = nil; |
There was a problem hiding this comment.
Previously, self.ongoingGetTokenOperation was read on the self.queue dispatch queue but mutated on the main thread in .then(...) and .recover(...) (the main thread is the default when a queue is not specified) -- this could potentially result in a synchronization issue.
70dede4 to
86321c3
Compare
paulb777
left a comment
There was a problem hiding this comment.
Wow! so much code for parameter propagation.
|
cc: @mdmathias Once this PR is merged I can push a new version of the |
Added support for generating App Check tokens with a TTL of 5 minutes when requesting limited-use tokens. This extends upon firebase/firebase-ios-sdk#11086, which added the ability to request limited-use tokens that aren't cached.
This is implemented by adding a
getLimitedUseTokenWithCompletion:method to theGACAppCheckProviderprotocol. When requesting a limited-use token through the public APIlimitedUseTokenWithCompletion:, the newGACAppCheckProvidermethodgetLimitedUseTokenWithCompletion:will be called instead of the existinggetTokenWithCompletion:method.TODOs:
getLimitedUseTokenWithCompletion:toGACAppCheckProvidergetLimitedUseTokenWithCompletion:fromGACAppCheckinlimitedUseTokenWithCompletion:getLimitedUseTokenWithCompletion:in providers:GACAppAttestProviderGACAppCheckDebugProviderGACDeviceCheckProviderlimitedUseasYES