pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Scott Mead <scott.lists@enterprisedb.com>
To: Antoine POPINEAU <apognu@akegroup.org>
Cc: pgsql-admin@postgresql.org
Subject: Re: Store database users in custom table
Date: Mon, 22 Mar 2010 14:09:20 -0400
Message-ID: <d3ab2ec81003221109i10591e69x31db24de79ebcc39@mail.gmail.com> (raw)
In-Reply-To: <4BA4066E.4060205@akegroup.org>
References: <4BA4066E.4060205@akegroup.org>

2010/3/19 Antoine POPINEAU <apognu@akegroup.org>

> Hi,
>
> I am developping a Java application, and using a PostgreSQL backend
> database. Theorically, there might be lots of users, each with potentially
> different permissions over the different tables.
>
> I could add those user to the database with a classic CREATE USER, but that
> doesn't seem efficient to me, since I've already got a custom table with
> users data and, amongst others, password.
>
> So my question is simple (the answer might not be, though): is there a
> possibility to tell Postgres to fetch user logins and passwords in a custom
> table (perhaps respecting a certain schema) instead of the default location?
>

There isn't, but the question to ask yourself is:

 Do you want application level users to be able to login to the database
directly???

 If the answer is yes, then you may want to use a centralized authentication
mechanism like LDAP. (postgres can use LDAP authentication).


  If the answer is no, then build your own auth scheme in the application
and have the application login to the database as a specific user ... i.e.

user bob.foo logins to web interface
provides password: login123

  java app says:  Connect to database,
 user: app_read
 pass: %32sd$s2

   Java app says, select user_id, password from users where user_name =
'bob.foo'
    java app runs:
 if result.password = user_entered_password
    then
        login allowed
    else
         denied
    end if

  Obviously, you'd want to use a hash of the password to avoid sending it
over the wire, but I think you get the idea.


--Scott M



 --Scott M

>
> Thank you.
>
> Antoine POPINEAU.
>

view thread (2+ messages)

Message-ID: <d3ab2ec81003221109i10591e69x31db24de79ebcc39@mail.gmail.com>
Permalink:  ../d3ab2ec81003221109i10591e69x31db24de79ebcc39@mail.gmail.com/
Also on:    postgresql.org/message-id/d3ab2ec81003221109i10591e69x31db24de79ebcc39@mail.gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-admin@postgresql.org
  Cc: scott.lists@enterprisedb.com, apognu@akegroup.org
  Subject: Re: Store database users in custom table
  In-Reply-To: <d3ab2ec81003221109i10591e69x31db24de79ebcc39@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox