GIDAuthorization_Private.h 3.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /*
  2. * Copyright 2025 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. #import <Foundation/Foundation.h>
  17. #import <TargetConditionals.h>
  18. #import "GoogleSignIn/Sources/Public/GoogleSignIn/GIDAuthorization.h"
  19. @class GIDConfiguration;
  20. @class GTMKeychainStore;
  21. @class GIDSignInInternalOptions;
  22. @class GIDAuthorizationFlow;
  23. @protocol GIDAuthorizationFlowCoordinator;
  24. NS_ASSUME_NONNULL_BEGIN
  25. @interface GIDAuthorization ()
  26. /// Private initializer taking a `GTMKeychainStore`.
  27. - (instancetype)initWithKeychainStore:(GTMKeychainStore *)keychainStore;
  28. /// Private initializer taking a `GTMKeychainStore` and a `GIDConfiguration`.
  29. ///
  30. /// If `keychainStore` or `configuration` are nil, then a default is generated.
  31. - (instancetype)initWithKeychainStore:(nullable GTMKeychainStore *)keychainStore
  32. configuration:(nullable GIDConfiguration *)configuration;
  33. /// Private initializer taking a `GTMKeychainStore`, `GIDConfiguration` and a `GIDAuthorizationFlowCoordinator`.
  34. ///
  35. /// If `keychainStore` or `configuration` are nil, then a default is generated. If a nil
  36. /// `GIDAuthorizationFlowCoordinator` conforming instance is provided, then one will be created during the authorization flow.
  37. - (instancetype)initWithKeychainStore:(nullable GTMKeychainStore *)keychainStore
  38. configuration:(nullable GIDConfiguration *)configuration
  39. authorizationFlowCoordinator:(nullable id<GIDAuthorizationFlowCoordinator>)authFlow;
  40. //#if TARGET_OS_IOS && !TARGET_OS_MACCATALYST
  41. // /// Private initializer taking a `GTMKeychainStore` and `GIDAppCheckProvider`.
  42. //- (instancetype)initWithKeychainStore:(GTMKeychainStore *)keychainStore
  43. // appCheck:(GIDAppCheck *)appCheck
  44. //API_AVAILABLE(ios(14));
  45. //#endif // TARGET_OS_IOS || !TARGET_OS_MACCATALYST
  46. /// Authenticates in with the provided options.
  47. - (void)signInWithOptions:(GIDSignInInternalOptions *)options;
  48. /// Asserts that the current `GIDConfiguration` contains a a client ID.
  49. ///
  50. /// Throws an exception if no client ID is found in the configuration.
  51. - (void)assertValidParameters;
  52. /// Asserts that the current `GIDSignInInternalOptions` has a valid presenting controller.
  53. ///
  54. /// Throws an exception if the current options do not contain a presenting controller.
  55. - (void)assertValidPresentingController;
  56. /// The current configuration used for authorization.
  57. @property(nonatomic, nullable) GIDConfiguration *currentConfiguration;
  58. /// Keychain manager for GTMAppAuth
  59. @property(nonatomic, readwrite) GTMKeychainStore *keychainStore;
  60. /// Options used when sign-in flows are resumed via the handling of a URL.
  61. ///
  62. /// Options are set when a sign-in flow is begun via `signInWithOptions:` when the options passed don't represent a sign in
  63. /// continuation.
  64. @property(nonatomic, nullable) GIDSignInInternalOptions *currentOptions;
  65. /// The `GIDAuthorizationFlowCoordinator` conforming type managing the authorization flow.
  66. @property(nonatomic, readwrite) id<GIDAuthorizationFlowCoordinator> authFlow;
  67. @end
  68. NS_ASSUME_NONNULL_END