英文:
Golang duplicate rails Devise gem password encryption
问题
我必须在一个使用Beego
框架和Golang
的新应用中对用户进行身份验证,问题是数据库来自使用gem Devise
实现身份验证的Rails应用程序。
我已经查看了gem Bcrypt
的实现,但是不太明白如何复制encrypted_password
以验证用户...
你能帮我吗?
更新1
使用bcrypt
没有帮助
b_password := []byte(password)
hashedPassword, err := bcrypt.GenerateFromPassword(b_password, bcrypt.DefaultCost)
我得到了不同的密码。
英文:
I have to authenticate user in a new app which uses Beego
framework for Golang
, twist is that DB is from Rails application where authentication is implemented using gem Devise
.
I've looked at gem Bcrypt
implementation
https://github.com/codahale/bcrypt-ruby/blob/master/lib/bcrypt/password.rb
But can't quite grasp how to replicate encrypted_password
to validate user...
Can you please help me ?
UPDATE1
using bcrypt
didn't help
> b_password := []byte(password)
> hashedPassword, err := bcrypt.GenerateFromPassword(b_password, bcrypt.DefaultCost)
I get different passwords.
答案1
得分: 1
我找到了 https://github.com/consyse/go-devise-encryptor 这个项目,正好可以完成这个任务。
英文:
I found out https://github.com/consyse/go-devise-encryptor exactly for doing this task
答案2
得分: 0
这个设备加密器和golang中的bcrypt身份验证做着相同的事情,而且我没有看到Rails Devise哈希和go-devise-encryptor密码哈希相等。
英文:
This devise encryptor doing same thing as bcrypt auth in golang, also i dont see Rails Devise hash and go-devise-encryptor password hash equal.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论