AuthRequestConfiguration.swift 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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. /// The regionalized GCIP tenant configuration, if provided.
  37. /// This property contains tenant ID and location for regionalized GCIP services
  38. /// It's non-`nil` only when the `Auth` instance is initialized with `TenantConfig`.
  39. let tenantConfig: Auth.TenantConfig?
  40. init(apiKey: String,
  41. appID: String,
  42. auth: Auth? = nil,
  43. heartbeatLogger: FIRHeartbeatLoggerProtocol? = nil,
  44. appCheck: AppCheckInterop? = nil,
  45. tenantConfig: Auth.TenantConfig? = nil) {
  46. self.apiKey = apiKey
  47. self.appID = appID
  48. self.auth = auth
  49. self.heartbeatLogger = heartbeatLogger
  50. self.appCheck = appCheck
  51. self.tenantConfig = tenantConfig
  52. }
  53. }