暫無描述

FIROAuthProvider.h 5.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  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 "FIRFederatedAuthProvider.h"
  18. @class FIRAuth;
  19. @class FIROAuthCredential;
  20. NS_ASSUME_NONNULL_BEGIN
  21. /**
  22. @brief A string constant identifying the Microsoft identity provider.
  23. */
  24. extern NSString *const FIRMicrosoftAuthProviderID NS_SWIFT_NAME(MicrosoftAuthProviderID)
  25. DEPRECATED_MSG_ATTRIBUTE("Please use \"microsoft.com\" instead.");
  26. /**
  27. @brief A string constant identifying the Yahoo identity provider.
  28. */
  29. extern NSString *const FIRYahooAuthProviderID NS_SWIFT_NAME(YahooAuthProviderID)
  30. DEPRECATED_MSG_ATTRIBUTE("Please use \"yahoo.com\" instead.");
  31. /** @class FIROAuthProvider
  32. @brief A concrete implementation of `FIRAuthProvider` for generic OAuth Providers.
  33. */
  34. NS_SWIFT_NAME(OAuthProvider)
  35. @interface FIROAuthProvider : NSObject<FIRFederatedAuthProvider>
  36. /** @property scopes
  37. @brief Array used to configure the OAuth scopes.
  38. */
  39. @property(nonatomic, copy, nullable) NSArray<NSString *> *scopes;
  40. /** @property customParameters
  41. @brief Dictionary used to configure the OAuth custom parameters.
  42. */
  43. @property(nonatomic, copy, nullable) NSDictionary<NSString *, NSString*> *customParameters;
  44. /** @property providerID
  45. @brief The provider ID indicating the specific OAuth provider this OAuthProvider instance
  46. represents.
  47. */
  48. @property(nonatomic, copy, readonly) NSString *providerID;
  49. /** @fn providerWithProviderID:
  50. @param providerID The provider ID of the IDP for which this auth provider instance will be
  51. configured.
  52. @return An instance of FIROAuthProvider corresponding to the specified provider ID.
  53. */
  54. + (FIROAuthProvider *)providerWithProviderID:(NSString *)providerID;
  55. /** @fn providerWithProviderID:auth:
  56. @param providerID The provider ID of the IDP for which this auth provider instance will be
  57. configured.
  58. @param auth The auth instance to be associated with the FIROAuthProvider instance.
  59. @return An instance of FIROAuthProvider corresponding to the specified provider ID.
  60. */
  61. + (FIROAuthProvider *)providerWithProviderID:(NSString *)providerID auth:(FIRAuth *)auth;
  62. /** @fn credentialWithProviderID:IDToken:accessToken:
  63. @brief Creates an `FIRAuthCredential` for that OAuth 2 provider identified by providerID, ID
  64. token and access token.
  65. @param providerID The provider ID associated with the Auth credential being created.
  66. @param IDToken The IDToken associated with the Auth credential being created.
  67. @param accessToken The accessstoken associated with the Auth credential be created, if
  68. available.
  69. @param pendingToken The pending token used when completing the headful-lite flow.
  70. @return A FIRAuthCredential for the specified provider ID, ID token and access token.
  71. */
  72. + (FIROAuthCredential *)credentialWithProviderID:(NSString *)providerID
  73. IDToken:(NSString *)IDToken
  74. accessToken:(nullable NSString *)accessToken
  75. pendingToken:(nullable NSString *)pendingToken;
  76. /** @fn credentialWithProviderID:IDToken:accessToken:
  77. @brief Creates an `FIRAuthCredential` for that OAuth 2 provider identified by providerID, ID
  78. token and access token.
  79. @param providerID The provider ID associated with the Auth credential being created.
  80. @param IDToken The IDToken associated with the Auth credential being created.
  81. @param accessToken The accessstoken associated with the Auth credential be created, if
  82. available.
  83. @return A FIRAuthCredential for the specified provider ID, ID token and access token.
  84. */
  85. + (FIROAuthCredential *)credentialWithProviderID:(NSString *)providerID
  86. IDToken:(NSString *)IDToken
  87. accessToken:(nullable NSString *)accessToken;
  88. /** @fn credentialWithProviderID:accessToken:
  89. @brief Creates an `FIRAuthCredential` for that OAuth 2 provider identified by providerID using
  90. an ID token.
  91. @param providerID The provider ID associated with the Auth credential being created.
  92. @param accessToken The accessstoken associated with the Auth credential be created
  93. @return A FIRAuthCredential.
  94. */
  95. + (FIROAuthCredential *)credentialWithProviderID:(NSString *)providerID
  96. accessToken:(NSString *)accessToken;
  97. /** @fn init
  98. @brief This class is not meant to be initialized.
  99. */
  100. - (instancetype)init NS_UNAVAILABLE;
  101. @end
  102. NS_ASSUME_NONNULL_END