CreateAuthURIResponse.swift 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. // Copyright 2023 Google LLC
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. import Foundation
  15. /** @class FIRCreateAuthURIResponse
  16. @brief Represents the parameters for the createAuthUri endpoint.
  17. @see https://developers.google.com/identity/toolkit/web/reference/relyingparty/createAuthUri
  18. */
  19. public class CreateAuthURIResponse: AuthRPCResponse {
  20. /** @property authUri
  21. @brief The URI used by the IDP to authenticate the user.
  22. */
  23. public var authURI: String?
  24. /** @property registered
  25. @brief Whether the user is registered if the identifier is an email.
  26. */
  27. public var registered: Bool = false
  28. /** @property providerId
  29. @brief The provider ID of the auth URI.
  30. */
  31. public var providerID: String?
  32. /** @property forExistingProvider
  33. @brief True if the authUri is for user's existing provider.
  34. */
  35. public var forExistingProvider: Bool = false
  36. /** @property allProviders
  37. @brief A list of provider IDs the passed @c identifier could use to sign in with.
  38. */
  39. public var allProviders: [String]?
  40. /** @property signinMethods
  41. @brief A list of sign-in methods available for the passed @c identifier.
  42. */
  43. public var signinMethods: [String]?
  44. /// Bare initializer.
  45. public required init() {}
  46. public func setFields(dictionary: [String: AnyHashable]) throws {
  47. providerID = dictionary["providerId"] as? String
  48. authURI = dictionary["authUri"] as? String
  49. registered = dictionary["registered"] as? Bool ?? false
  50. forExistingProvider = dictionary["forExistingProvider"] as? Bool ?? false
  51. allProviders = dictionary["allProviders"] as? [String]
  52. signinMethods = dictionary["signinMethods"] as? [String]
  53. }
  54. }