Password Encryption Algorithm in Glassfish 4

筅森魡賤 提交于 2019-12-05 06:51:09

I've tested a simple use case with Glassfish 4.1 and a JDBC Realm configured for MySQL.

You can set up a simple user table:

  • name: stores the username
  • password: stores the SHA-256 hash of the user's password (without salting)
  • group: stores the user group (i.e. admin, user)

I.e.

INSERT INTO users (name, password, group) VALUES ("admin", SHA2("password", 256), "admins"); 

In the admin console, go to Configurations > Security > Realms and edit your realm.

In the "Password Encryption Algorithm" field enter "AES".

In the "Digest Algorithm" field enter "SHA-256".

In the "Charset" field enter "UTF-8".

For future reference for those who get to this question looking for how Glassfish uses configuration "Password Encryption Algorithm" in JDBCRealm. I took a look in the code and it seems to not be used at all: Link, Permalink.

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