How to programatically encrypt/decrypt plain text credentials in JSP?

前端 未结 2 1511
执念已碎
执念已碎 2021-02-11 04:22

As as part of my daily routine, I have the misfortune of administering an ancient, once \"just internal\" JSP web application that relies on the following authentication schema:

2条回答
  •  傲寒
    傲寒 (楼主)
    2021-02-11 05:02

    First of all you should move that logic from jsp to a separate class.

    Second, you shouldn't keep plain text password anywhere in the code. Use some kind of one way hash function (md5, sha1, ...) and keep only password hashes.

    When checking for user password, first hash it and then compare hashes.

提交回复
热议问题