Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Authentication and authorization solution for Padrino

Tags:

padrino

I have been programming with both Sinatra and Padrino for quite some time now. However, I am still not able to find the right authentication and authorization solution for Padrino. Let me explain my expectation and what I have already tried out.

With Sinatra, I successfully use the sinatra-authentication gem along with the role_model gem. I generally use the Mongoid ORM for talking to MongoDB. These two gems together let me take care of authetication, protecting routes, checking for roles of the logged in user for applying access control.

sinatra-authentication doesn't work with Padrino - it is very specific to Sinatra. I tried it out multiple times. I have already tried out both omniauth and warden with the corresponding Padrino modules but for one reason or another I am not able to get them to work as simply as the wonderful sinatra-autentication gem.

So - before I can attempt implementing a solution of my own (or porting sinatra-authentication to Padrino) - can anyone suggest any other authentication and authorization solutions? At the moment I don't need anythign fancy - simple database-based authentication will just work perfectly.

like image 897
Abhas Abhinav Avatar asked Sep 07 '11 11:09

Abhas Abhinav


2 Answers

I know that the question is two years old. But I recently still had the same trouble that padrino-warden ist badly documented and I faced a lot of problems. So I documented my findings on workaround.org. May it help the less fortunate.

I consider padrino-admin a nice scaffold to learn from. But the user model is rather inflexible. And the authorization concept is strangely doing what the authors of Padrino don't like: putting configuration paths in a central place instead of moving configuration into the controllers. (The padrino-admin has further problems like missing pagination and missing support for foreign keys. So it's not remotely comparable to what Django provides.)

like image 185
Christoph Haas Avatar answered Dec 14 '22 18:12

Christoph Haas


A standalone authentication solution for Padrino has been discussed, but has not been resolved yet. In the mean time, one popular suggestion is to use padrino-warden.

Disclaimer: I'm in a similar situation as OP and have no experience in running personal-warden in production, yet.

like image 28
pithyless Avatar answered Dec 14 '22 19:12

pithyless