Quantcast
Channel: dBforums – Everything on Databases, Design, Developers and Administrators
Viewing all articles
Browse latest Browse all 13329

User Authentication

$
0
0
Hello,
In my company each user has an separate login role. I am trying to write an PostgreSQL function to verify entered username and password against login role username and password. I create a user by using the query below:

Code:

CREATE USER foo WITH PASSWORD 'password'
When I look at the properties of user 'foo', I can see its encrypted password is 'md52ded2b65ce11cfe94e88a881982a333e'. I can get this value by

Code:

select 'md5'|| md5('password' || 'foo')
this query.

But, when I try to verify username and password by

Code:

select usename, passwd from pg_user where usename='foo' and passwd = 'md5'||md5('password' || 'foo')
no results return. Can somebody tell me what I am during wrong? Thanks....

Viewing all articles
Browse latest Browse all 13329