ServiceAuthentication.swift 759 B

123456789101112131415161718192021222324252627
  1. //
  2. // ServiceAuthentication.swift
  3. // Loop
  4. //
  5. // Created by Nate Racklyeft on 7/2/16.
  6. // Copyright © 2016 Nathan Racklyeft. All rights reserved.
  7. //
  8. // Defines the authentication for a service
  9. protocol ServiceAuthentication {
  10. // The title of the service
  11. var title: String { get }
  12. // The credentials (e.g. username, password) used to authenticate
  13. var credentials: [ServiceCredential] { get set }
  14. // Whether the current credential values are valid authorization
  15. var isAuthorized: Bool { get }
  16. // Tests the credentials for valid authorization
  17. mutating func verify(_ completion: @escaping (_ success: Bool, _ error: Error?) -> Void)
  18. // Clears the credential values and authorization status
  19. mutating func reset()
  20. }