AuthRequestConfiguration.swift 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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. /// Defines configurations to be added to a request to Firebase Auth's backend.
  18. @available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *)
  19. final class AuthRequestConfiguration {
  20. /// The Firebase Auth API key used in the request.
  21. let apiKey: String
  22. /// The language code used in the request.
  23. var languageCode: String?
  24. /// The Firebase appID used in the request.
  25. let appID: String
  26. /// The `Auth` instance used in the request.
  27. weak var auth: Auth?
  28. /// The heartbeat logger used to add heartbeats to the corresponding request's header.
  29. let heartbeatLogger: FIRHeartbeatLoggerProtocol?
  30. /// The appCheck is used to generate a token.
  31. var appCheck: AppCheckInterop?
  32. /// Additional framework marker that will be added as part of the header of every request.
  33. let additionalFrameworkMarker: String = "FirebaseCore-iOS"
  34. /// If set, the local emulator host and port to point to instead of the remote backend.
  35. var emulatorHostAndPort: String?
  36. init(apiKey: String,
  37. appID: String,
  38. auth: Auth? = nil,
  39. heartbeatLogger: FIRHeartbeatLoggerProtocol? = nil,
  40. appCheck: AppCheckInterop? = nil) {
  41. self.apiKey = apiKey
  42. self.appID = appID
  43. self.auth = auth
  44. self.heartbeatLogger = heartbeatLogger
  45. self.appCheck = appCheck
  46. }
  47. }