Mateusz
Mateusz

Reputation: 1197

migrate from devise passwords to java

I have system created in rails with devise. I need to rewrite it's authentication logic to java. Problem is, I don't know how is rails encrypted password generated. I need this knowledge to create similar method in java to authenticate against encrypted passwords already strored in database.

Thx for help.

Upvotes: 2

Views: 832

Answers (1)

Mateusz
Mateusz

Reputation: 1197

After couple hours of diging I found that it's enough to use following line:

BCrypt.checkpw(plainTextPassword, encryptedPassword)

You don't need to understand which part of database stored string is salt, stretches, etc. I still don't fully understand what are the parts of string: $2a$10$IAB6DfjYD4mbHiGWHB6YAOJqSwie1kLJNTl/bKQasb.ZJ.hj8VdTq which is devise stored version of 123456 password ;)

This post helped me to understand what I need to do.

Upvotes: 3

Related Questions