dialog auth
Description
This PR adds support for the dialog authentication plugin. I cut some corners by leaving the DialogFunc() implementation to the user instead of attempting to load a shared library, but I think this is a good enough start. If DialogFunc() is not implemented, we simply use whatever password is defined in the DSN.
Related to https://github.com/go-sql-driver/mysql/issues/803.
Checklist
- [x] Code compiles correctly
- [x] Created tests which fail without the change (if possible)
- [x] All tests passing
- [x] Extended the README / documentation, if necessary
- [x] Added myself / the copyright holder to the AUTHORS file
Extending the mysql.Config for any authentication use case should stop. In this package we should keep the core functionality.
If people want to use an alternate way to build the DSN, they can wrap the mysql.Driver and build their own driver.Driver. See github.com/dolmen-go/mylogin-driver as an example.
@dolmen What about this patch? Is there a plan to support PAM auth? @tpetr Are you interested into rebasing this patch?
@pierresouchay Each user who wants to implement his own authentication method can do it without polluting the go-sql-driver/mysql driver. One can create his own database/sql/driver which delegates DB connection to go-sql-driver/mysql by using NewConnector or OpenConnector. As a concrete example see the implementation of OpenConnector in github.com/dolmen-go/mylogin-driver.
Sorry for the slow response, folks. @dolmen’s approach sounds correct so I’ll close this ancient PR. Thanks everyone for the input!