I'm using play-framework 2.0 (java web-framework) with postgresql.
thanks
PostgreSQL database passwords are separate from operating system user passwords. The password for each database user is stored in the pg_authid system catalog. Passwords can be managed with the SQL commands CREATE ROLE and ALTER ROLE, e.g., CREATE ROLE foo WITH LOGIN PASSWORD 'secret' , or the psql command \password .
Login and Connect as Default User For most systems, the default Postgres user is postgres and a password is not required for authentication.
CREATE EXTENSION pgcrypto; INSERT INTO users (email, password) VALUES ( '[email protected]', crypt('johnspassword', gen_salt('bf')) ); SELECT id FROM users WHERE email = '[email protected]' AND password = crypt('johnspassword', password); We have seen how to solve the Encrypt Password Postgresql with various examples.
This module implements a data type chkpass that is designed for storing encrypted passwords. Each password is automatically converted to encrypted form upon entry, and is always stored encrypted.
You want to hash the password, not encrypt it (See this question for more details). The current recommended approach is to use an adaptive hashing algorithm, like bcrypt. jBcrypt is a solid Java implementation that you can use.
As for DB type, you can safely just treat it as a string.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With