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.

99 lines
3.8 KiB

  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 <Foundation/Foundation.h>
  17. #import "FIRUser.h"
  18. #import "FIRAuthKeychainServices.h"
  19. #import "FIRAuthUserDefaults.h"
  20. NS_ASSUME_NONNULL_BEGIN
  21. @interface FIRAuthStoredUserManager : NSObject
  22. /** @property keychain
  23. @brief The mediator object to access to the system Keychain services.
  24. */
  25. @property (readonly, nonatomic, strong) FIRAuthKeychainServices *keychainServices;
  26. /** @property userDefaults
  27. @brief The mediator object to access to the system User Defaults services.
  28. */
  29. @property (readonly, nonatomic, strong) FIRAuthUserDefaults *userDefaults;
  30. /** @fn init
  31. @brief The default initializer is disabled.
  32. */
  33. - (instancetype)init NS_UNAVAILABLE;
  34. /** @fn initWithServiceName:
  35. @brief The designated initializer.
  36. @param serviceName The service name to initialize with.
  37. */
  38. - (instancetype)initWithServiceName:(NSString *)serviceName NS_DESIGNATED_INITIALIZER;
  39. /** @fn getStoredUserAccessGroupWithError:
  40. @brief Get the user access group stored locally.
  41. @param outError Return value for any error which occurs.
  42. */
  43. - (NSString *_Nullable)getStoredUserAccessGroupWithError:(NSError *_Nullable *_Nullable)outError;
  44. /** @fn setStoredUserAccessGroup:error:
  45. @brief The setter of the user access group stored locally.
  46. @param accessGroup The access group to be set.
  47. @param outError Return value for any error which occurs.
  48. */
  49. - (BOOL)setStoredUserAccessGroup:(NSString *_Nullable)accessGroup
  50. error:(NSError *_Nullable *_Nullable)outError;
  51. /** @fn getStoredUserForAccessGroup:projectID:error:
  52. @brief The getter of the user stored locally.
  53. @param accessGroup The access group to retrieve the user from.
  54. @param projectIdentifier An identifier of the project that the user associates with. Currently,
  55. we use API KEY.
  56. @param outError Return value for any error which occurs.
  57. */
  58. - (FIRUser *)getStoredUserForAccessGroup:(NSString *)accessGroup
  59. projectIdentifier:(NSString *)projectIdentifier
  60. error:(NSError *_Nullable *_Nullable)outError;
  61. /** @fn setStoredUser:forAccessGroup:projectID:error:
  62. @brief The setter of the user stored locally.
  63. @param user The user to be stored.
  64. @param accessGroup The access group to store the user in.
  65. @param projectIdentifier An identifier of the project that the user associates with. Currently,
  66. we use API KEY.
  67. @param outError Return value for any error which occurs.
  68. */
  69. - (BOOL)setStoredUser:(FIRUser *)user
  70. forAccessGroup:(NSString *)accessGroup
  71. projectIdentifier:(NSString *)projectIdentifier
  72. error:(NSError *_Nullable *_Nullable)outError;
  73. /** @fn removeStoredUserForAccessGroup:projectID:error:
  74. @brief Remove the user that stored locally.
  75. @param accessGroup The access group to remove the user from.
  76. @param projectIdentifier An identifier of the project that the user associates with. Currently,
  77. we use API KEY.
  78. @param outError Return value for any error which occurs.
  79. */
  80. - (BOOL)removeStoredUserForAccessGroup:(NSString *)accessGroup
  81. projectIdentifier:(NSString *)projectIdentifier
  82. error:(NSError *_Nullable *_Nullable)outError;
  83. @end
  84. NS_ASSUME_NONNULL_END