BasicAuth
struct BasicAuthHTTP Basic authentication (RFC 7617).
Encodes username:password as base64 and sets the Authorization
header to Basic <encoded>.
Fields: username: The account username. password: The account password (transmitted in plaintext over TLS).
Example:
var auth = BasicAuth("alice", "s3cr3t")
var client = HttpClient(auth=auth)
Implements Auth, Copyable, Movable
- Fields
username: Stringpassword: String
__init__
def __init__(out self, username: String, password: String) Initialise BasicAuth with username and password.
- Args
username: The account username.password: The account password.
apply
def apply(self, mut headers: HeaderMap) Set Authorization: Basic <credentials> on headers.
The credential string username:password is UTF-8 encoded then
base64-encoded per RFC 7617.
- Args
headers: TheHeaderMapto modify in place.