-
Notifications
You must be signed in to change notification settings - Fork 1k
Add custom authentication #1062
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
server/auth.go
Outdated
} | ||
|
||
func (c *Conn) compareClearPasswordAuthData(clientAuthData []byte, credential Credential) error { | ||
clearText := bytes.Trim(clientAuthData, "\x00") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe this should be bytes.TrimRight()
? What if there are multiple \x00
, like in the middle of the clientAuthData
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah yes fixed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, I'm not sure about this option. Maybe it's not a server-side auth method, just to cooperate with other auth methods at client-side? https://dev.mysql.com/doc/refman/8.4/en/cleartext-pluggable-authentication.html
Can you provide some material about it?
The info for this authentication method is here: https://dev.mysql.com/doc/dev/mysql-server/latest/page_protocol_connection_phase_authentication_methods_clear_text_password.html So the |
This should:
This could be a basis and/or demonstration for something that can be extended to do external authentication. |
Test failures are due to a Docker outage: https://www.dockerstatus.com/ |
Would it be better if I created an interface/struct for handling custom authentication ? so if needed one could implement the I guess what I'm trying to write is that (I'm building a proxy) and I do need the password provided since I'm just going to relay it to a backend. Is there anyway that I can optain the password/clientAuthData without make a custom type ? |
|
making custom auth would also be the only way for a user of this library to get clientAuthData in raw form right ? |
Yes, that's probably correct. |
Oki I'll redo my patch to make a custom authentication then :) |
I haven't added any test to this yet since I wanted to check with you first if this is too invasive. But I have this running in my proxy using also test is failing even if I check out a fresh master |
62442f7
to
9f2612e
Compare
Oki hopefully last commit. I've added the authentication as an interface with a default one so behavior is the same as before but its possible to implement you own authentication and plugin validation |
is my latest patch better ? |
I found a lot of references to
mysql_clear_password
but the handling was missing