AuthRequestConfiguration.swift 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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. 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. var heartbeatLogger: FIRHeartbeatLoggerProtocol?
  30. /// The appCheck is used to generate a token.
  31. var appCheck: AppCheckInterop?
  32. /// The HTTP method used in the request.
  33. var httpMethod: String
  34. /// Additional framework marker that will be added as part of the header of every request.
  35. var additionalFrameworkMarker: String?
  36. /// If set, the local emulator host and port to point to instead of the remote backend.
  37. var emulatorHostAndPort: String?
  38. init(apiKey: String,
  39. appID: String,
  40. auth: Auth? = nil,
  41. heartbeatLogger: FIRHeartbeatLoggerProtocol? = nil,
  42. appCheck: AppCheckInterop? = nil) {
  43. self.apiKey = apiKey
  44. self.appID = appID
  45. self.auth = auth
  46. self.heartbeatLogger = heartbeatLogger
  47. self.appCheck = appCheck
  48. httpMethod = "POST"
  49. }
  50. }