AuthenticationProvider
public struct AuthenticationProvider
A type that can add authentication fields to a Header
.
AuthenticationProvider
is simply a wrapper around a function that modifies a header so it is authenticated.
-
Updates a header with the authentication details of the provider.
Declaration
Swift
public func update(_ header: inout Header)
Parameters
header
The header to update.
-
An authentication provider that makes no changes to the header passed to it.
Declaration
Swift
public static let none: AuthenticationProvider
-
An authentication provider that sets the provided token as a bearer token in the header.
Declaration
Swift
public static let bearerToken: (String) -> AuthenticationProvider
-
Adds a basic
Authorization
header field to the header using the provided username and password.Declaration
Swift
public static func basicAuth(username: String, password: String) -> AuthenticationProvider