AuthRequestConfiguration.swift 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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. import FirebaseAppCheckInterop
  16. import FirebaseCoreExtension
  17. /** @class FIRAuthRequestConfiguration
  18. @brief Defines configurations to be added to a request to Firebase Auth's backend.
  19. */
  20. @available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *)
  21. class AuthRequestConfiguration: NSObject {
  22. /** @property APIKey
  23. @brief The Firebase Auth API key used in the request.
  24. */
  25. let apiKey: String
  26. /** @property LanguageCode
  27. @brief The language code used in the request.
  28. */
  29. var languageCode: String?
  30. /** @property appID
  31. @brief The Firebase appID used in the request.
  32. */
  33. let appID: String
  34. /** @property auth
  35. @brief The FIRAuth instance used in the request.
  36. */
  37. weak var auth: Auth?
  38. /// The heartbeat logger used to add heartbeats to the corresponding request's header.
  39. var heartbeatLogger: FIRHeartbeatLoggerProtocol?
  40. /** @property appCheck
  41. @brief The appCheck is used to generate a token.
  42. */
  43. var appCheck: AppCheckInterop?
  44. /** @property HTTPMethod
  45. @brief The HTTP method used in the request.
  46. */
  47. var httpMethod: String
  48. /** @property additionalFrameworkMarker
  49. @brief Additional framework marker that will be added as part of the header of every request.
  50. */
  51. var additionalFrameworkMarker: String?
  52. /** @property emulatorHostAndPort
  53. @brief If set, the local emulator host and port to point to instead of the remote backend.
  54. */
  55. var emulatorHostAndPort: String?
  56. init(apiKey: String,
  57. appID: String,
  58. auth: Auth? = nil,
  59. heartbeatLogger: FIRHeartbeatLoggerProtocol? = nil,
  60. appCheck: AppCheckInterop? = nil) {
  61. self.apiKey = apiKey
  62. self.appID = appID
  63. self.auth = auth
  64. self.heartbeatLogger = heartbeatLogger
  65. self.appCheck = appCheck
  66. httpMethod = "POST"
  67. }
  68. }