Без опису

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