FIRInstanceIDTokenOperation+Private.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /*
  2. * Copyright 2019 Google
  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. #import "Firebase/InstanceID/FIRInstanceIDTokenOperation.h"
  17. #import "Firebase/InstanceID/FIRInstanceIDUtilities.h"
  18. NS_ASSUME_NONNULL_BEGIN
  19. @interface FIRInstanceIDTokenOperation (Private)
  20. @property(atomic, strong) NSURLSessionDataTask *dataTask;
  21. @property(readonly, strong)
  22. NSMutableArray<FIRInstanceIDTokenOperationCompletion> *completionHandlers;
  23. // For testing only
  24. @property(nonatomic, readwrite, copy) FIRInstanceIDURLRequestTestBlock testBlock;
  25. + (NSURLSession *)sharedURLSession;
  26. #pragma mark - Initialization
  27. - (instancetype)initWithAction:(FIRInstanceIDTokenAction)action
  28. forAuthorizedEntity:(nullable NSString *)authorizedEntity
  29. scope:(NSString *)scope
  30. options:(nullable NSDictionary<NSString *, NSString *> *)options
  31. checkinPreferences:(FIRInstanceIDCheckinPreferences *)checkinPreferences
  32. instanceID:(NSString *)instanceID;
  33. #pragma mark - Request Construction
  34. + (NSMutableArray<NSURLQueryItem *> *)standardQueryItemsWithDeviceID:(NSString *)deviceID
  35. scope:(NSString *)scope;
  36. - (NSMutableURLRequest *)tokenRequest;
  37. #pragma mark - HTTP Headers
  38. /**
  39. * Given a valid checkin preferences object, it will return a string that can be used
  40. * in the "Authorization" HTTP header to authenticate this request.
  41. *
  42. * @param checkin The valid checkin preferences object, with a deviceID and secretToken.
  43. */
  44. + (NSString *)HTTPAuthHeaderFromCheckin:(FIRInstanceIDCheckinPreferences *)checkin;
  45. #pragma mark - Result
  46. - (void)finishWithResult:(FIRInstanceIDTokenOperationResult)result
  47. token:(nullable NSString *)token
  48. error:(nullable NSError *)error;
  49. #pragma mark - Methods to override
  50. - (void)performTokenOperation;
  51. @end
  52. NS_ASSUME_NONNULL_END