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.

95 lines
3.6 KiB

6 years ago
6 years ago
6 years ago
6 years ago
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 "FIRFederatedAuthProvider.h"
  18. @class FIRAuth;
  19. @class FIROAuthCredential;
  20. NS_ASSUME_NONNULL_BEGIN
  21. /** @class FIROAuthProvider
  22. @brief A concrete implementation of `FIRAuthProvider` for generic OAuth Providers.
  23. */
  24. NS_SWIFT_NAME(OAuthProvider)
  25. @interface FIROAuthProvider : NSObject<FIRFederatedAuthProvider>
  26. /** @property scopes
  27. @brief Array used to configure the OAuth scopes.
  28. */
  29. @property(nonatomic, copy, nullable) NSArray<NSString *> *scopes;
  30. /** @property customParameters
  31. @brief Dictionary used to configure the OAuth custom parameters.
  32. */
  33. @property(nonatomic, copy, nullable) NSDictionary<NSString *, NSString*> *customParameters;
  34. /** @property providerID
  35. @brief The provider ID indicating the specific OAuth provider this OAuthProvider instance
  36. represents.
  37. */
  38. @property(nonatomic, copy, readonly) NSString *providerID;
  39. /** @fn providerWithProviderID:
  40. @param providerID The provider ID of the IDP for which this auth provider instance will be
  41. configured.
  42. @return An instance of FIROAuthProvider corresponding to the specified provider ID.
  43. */
  44. + (FIROAuthProvider *)providerWithProviderID:(NSString *)providerID;
  45. /** @fn providerWithProviderID:auth:
  46. @param providerID The provider ID of the IDP for which this auth provider instance will be
  47. configured.
  48. @param auth The auth instance to be associated with the FIROAuthProvider instance.
  49. @return An instance of FIROAuthProvider corresponding to the specified provider ID.
  50. */
  51. + (FIROAuthProvider *)providerWithProviderID:(NSString *)providerID auth:(FIRAuth *)auth;
  52. /** @fn credentialWithProviderID:IDToken:accessToken:
  53. @brief Creates an `FIRAuthCredential` for that OAuth 2 provider identified by providerID, ID
  54. token and access token.
  55. @param providerID The provider ID associated with the Auth credential being created.
  56. @param IDToken The IDToken associated with the Auth credential being created.
  57. @param accessToken The accessstoken associated with the Auth credential be created, if
  58. available.
  59. @return A FIRAuthCredential for the specified provider ID, ID token and access token.
  60. */
  61. + (FIROAuthCredential *)credentialWithProviderID:(NSString *)providerID
  62. IDToken:(NSString *)IDToken
  63. accessToken:(nullable NSString *)accessToken;
  64. /** @fn credentialWithProviderID:accessToken:
  65. @brief Creates an `FIRAuthCredential` for that OAuth 2 provider identified by providerID using
  66. an ID token.
  67. @param providerID The provider ID associated with the Auth credential being created.
  68. @param accessToken The accessstoken associated with the Auth credential be created
  69. @return A FIRAuthCredential.
  70. */
  71. + (FIROAuthCredential *)credentialWithProviderID:(NSString *)providerID
  72. accessToken:(NSString *)accessToken;
  73. /** @fn init
  74. @brief This class is not meant to be initialized.
  75. */
  76. - (instancetype)init NS_UNAVAILABLE;
  77. @end
  78. NS_ASSUME_NONNULL_END