简体   繁体   中英

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!

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM