workingkills
workingkills

Reputation: 2716

Use "database users" to authenticate in Ruby on Rails

I have a PostgreSQL database that I access from various locations, and would like to add an interface with Ruby on Rails 3. For authentication I need to login users with the same credentials used to create them directly in the database; is there a way to make Rails connect to the database each time with different username/password, based on the current user? Thanks for any hints!

Upvotes: 5

Views: 493

Answers (1)

Nicolas Modrzyk
Nicolas Modrzyk

Reputation: 14197

Yes. Use a custom authentication on devise that makes a query to the underlying postgresql database.

See:

Custom authentication strategy for devise

I would certainly add some kind of filter to reduce the list of users that can authenticate this way.

Upvotes: 1

Related Questions