Spring PasswordEncoder decoding in external application

橙三吉。 提交于 2019-12-12 04:19:26

问题


I need to decode a password that was encoded using the org.springframework.security.authentication.encoding.PasswordEncoder.encodePassword method. Basically, application "A" maintains the encoded/encrypted password in its database. Application "B" makes a RESTful call to application "A" to get the userid and password (passes password as encoded/encrypted) and then application "B" needs to view the clear text version of the password, how would it decode it?


回答1:


The mentioned class "org.springframework.security.authentication.encoding.PasswordEncoder.encodePassword" seems to use digest function to encode the password. Because all the digest function are mentioned to be one way only it is easy to make encoded password from the clear text but almost impossible to obtain unencrypted version from the digest.

If you want to authenticate user just encrypt the password and compare it to it's stored encrypted version.

Other option can be reseting the password (replacing value stored in application "A").

If you insist on unencrypted password in application "B" from the digest, you have to crack it, which can be time consuming operation...



来源:https://stackoverflow.com/questions/5559413/spring-passwordencoder-decoding-in-external-application

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!