Skip to content

Don't require caller to know the authentication type of the database when connecting #54

@kkieffer

Description

@kkieffer

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions