Authenticable

public protocol Authenticable

Represents an Authenticable that is associated with Configurable. configuration.authentication by default.

Create custom Authenticable

protocol HTTPBinAuthenticable: Authenticable { }

extension HTTPBinAuthenticable {

  var configuration: Configuration {
    var authentication = Authentication()
    authentication.credential = URLCredential(user: "user", password: "password", persistence: .forSession)
    return authentication
  }

}

Using the above Authenticable

class HTTPBinStringGETService: Requestable, HTTPBinAuthenticable {

  let path: String = "get"
  let encoding: ParameterEncoding = URLEncoding.default
  var parameters: Any?

  init(parameters: Any?) {
    self.parameters = parameters
  }

}
  • authentication Default implementation

    The authentication.

    Default Implementation

    configuration.authentication

    Declaration

    Swift

    var authentication: Authentication