When connecting to a database, the caller must know the type of authentication required and set that in the ConnectionConfiguration as the credential. In my fork, I added a "password" field to the ConnectionConfiguration. If that field is set, it overrides the credential field.
Example change in Connection.swift:
case let response as AuthenticationSASLResponse:
let credential = configuration.password != nil ? .scramSHA256(password: configuration.password!) : configuration.credential
guard case let .scramSHA256(password) = credential else {
log(.warning, "SCRAM-SHA-256 credential required to authenticate")
throw PostgresError.scramSHA256CredentialRequired
}
Similar modifications can be made for md5 and plaintext response cases