Closed markostojanovic087 closed 5 years ago
@markostojanovic087, are you open for doing a PR on this?
@smyrman Yes, I am open to do it!
@markostojanovic087 -- what is your field type for the password hash in SQL? Have you tried to see if you get a []byte
instead of string
from your SQL driver when using e.g. bit[SIZE]
or bytea
column type?
@markostojanovic087, from pg docs:
- the bytea type is returned as []byte
https://github.com/lib/pq/blob/9eb73efc1fcc404148b56765b0d3f61d9a5ef8ee/doc.go#L144
Using that field type, you can probably solve #247 and #248 without any code changes for your use-case.
I am going to close this issue.
I view this currently as a documentation issue on the (third-party) SQL Storer backend. Feel free to raise it again there. I believe it to be fixable by altering the SQL schema to use a byre-array for storing the password.
I tried implementing basic authentication by using example given in basic-authentication. As soon as I changed test mem handlers to sql handlers
sqlHandler, err := sqlStorage.NewHandler(DB_DRIVER, DB_SOURCE, DB_TABLE_USER)
I started getting "Please provide proper credentials" response.
After long investigation and debug I figured out that the method schema.VerifyPassword seems to be problematic one. As soon as I used the following method instead of VerifyPassword I had no issue.
The calling code remained exactly the same, just instead of schema.VerifyPassword I called MyVerifyPassword.