You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

120 lines
4.7 KiB

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