No Description

FIRAuth_Internal.h 4.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. /*
  2. * Copyright 2017 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 <Foundation/Foundation.h>
  17. #import "FIRAuth.h"
  18. #import <FirebaseAuthInterop/FIRAuthInterop.h>
  19. @class FIRAuthRequestConfiguration;
  20. @class FIRAuthURLPresenter;
  21. #if TARGET_OS_IOS
  22. @class FIRAuthAPNSTokenManager;
  23. @class FIRAuthAppCredentialManager;
  24. @class FIRAuthNotificationManager;
  25. #endif
  26. NS_ASSUME_NONNULL_BEGIN
  27. @interface FIRAuth () <FIRAuthInterop>
  28. /** @property requestConfiguration
  29. @brief The configuration object comprising of paramters needed to make a request to Firebase
  30. Auth's backend.
  31. */
  32. @property(nonatomic, copy, readonly) FIRAuthRequestConfiguration *requestConfiguration;
  33. #if TARGET_OS_IOS
  34. /** @property tokenManager
  35. @brief The manager for APNs tokens used by phone number auth.
  36. */
  37. @property(nonatomic, strong, readonly) FIRAuthAPNSTokenManager *tokenManager;
  38. /** @property appCredentailManager
  39. @brief The manager for app credentials used by phone number auth.
  40. */
  41. @property(nonatomic, strong, readonly) FIRAuthAppCredentialManager *appCredentialManager;
  42. /** @property notificationManager
  43. @brief The manager for remote notifications used by phone number auth.
  44. */
  45. @property(nonatomic, strong, readonly) FIRAuthNotificationManager *notificationManager;
  46. #endif // TARGET_OS_IOS
  47. /** @property authURLPresenter
  48. @brief An object that takes care of presenting URLs via the auth instance.
  49. */
  50. @property(nonatomic, strong, readonly) FIRAuthURLPresenter *authURLPresenter;
  51. /** @fn initWithAPIKey:appName:
  52. @brief Designated initializer.
  53. @param APIKey The Google Developers Console API key for making requests from your app.
  54. @param appName The name property of the previously created @c FIRApp instance.
  55. */
  56. - (nullable instancetype)initWithAPIKey:(NSString *)APIKey
  57. appName:(NSString *)appName NS_DESIGNATED_INITIALIZER;
  58. /** @fn getUserID
  59. @brief Gets the identifier of the current user, if any.
  60. @return The identifier of the current user, or nil if there is no current user.
  61. */
  62. - (nullable NSString *)getUserID;
  63. /** @fn updateKeychainWithUser:error:
  64. @brief Updates the keychain for the given user.
  65. @param user The user to be updated.
  66. @param error The error caused the method to fail if the method returns NO.
  67. @return Whether updating keychain has succeeded or not.
  68. @remarks Called by @c FIRUser when user info or token changes occur.
  69. */
  70. - (BOOL)updateKeychainWithUser:(FIRUser *)user error:(NSError *_Nullable *_Nullable)error;
  71. /** @fn internalSignInWithCredential:callback:
  72. @brief Convenience method for @c internalSignInAndRetrieveDataWithCredential:callback:
  73. This method doesn't return additional identity provider data.
  74. */
  75. - (void)internalSignInWithCredential:(FIRAuthCredential *)credential
  76. callback:(FIRAuthResultCallback)callback;
  77. /** @fn internalSignInAndRetrieveDataWithCredential:callback:
  78. @brief Asynchronously signs in Firebase with the given 3rd party credentials (e.g. a Facebook
  79. login Access Token, a Google ID Token/Access Token pair, etc.) and returns additional
  80. identity provider data.
  81. @param credential The credential supplied by the IdP.
  82. @param isReauthentication Indicates whether or not the current invocation originated from an
  83. attempt to reauthenticate.
  84. @param callback A block which is invoked when the sign in finishes (or is cancelled.) Invoked
  85. asynchronously on the auth global work queue in the future.
  86. @remarks This is the internal counterpart of this method, which uses a callback that does not
  87. update the current user.
  88. */
  89. - (void)internalSignInAndRetrieveDataWithCredential:(FIRAuthCredential *)credential
  90. isReauthentication:(BOOL)isReauthentication
  91. callback:(nullable FIRAuthDataResultCallback)callback;
  92. /** @fn signOutByForceWithUserID:error:
  93. @brief Signs out the current user.
  94. @param userID The ID of the user to force sign out.
  95. @param error An optional out parameter for error results.
  96. @return @YES when the sign out request was successful. @NO otherwise.
  97. */
  98. - (BOOL)signOutByForceWithUserID:(NSString *)userID error:(NSError *_Nullable *_Nullable)error;
  99. @end
  100. NS_ASSUME_NONNULL_END