antek-drzewiecki / wine_bouncer

A Ruby gem that allows Oauth2 protection with Doorkeeper for Grape Api's
MIT License
112 stars 58 forks source link

New authorization dsl. #18

Closed antek-drzewiecki closed 9 years ago

antek-drzewiecki commented 9 years ago

I've been working to extract the authorization methods to an Grape DSL to make it more future compliant. At the moment the authorization methods rely on the API description to make it work. Grape really does not require to specify an description. So I'm thinking to introduce the authenticate method which accepts an hash. Maybe the method needs a different name, but im open for suggestions.

Below an example how the method will be used.

desc 'your api', { 
.... 
}
authenticate { ... } 
get '' do
   ..your api logic...
end 
sunnyrjuneja commented 9 years ago

I'm excited about this. It is annoying that you require a description for every endpoint if you want to decorate with wine_bouncer. This is part of the reason I added the protected strategy!

How do other gems that interact with Grape usually work?

antek-drzewiecki commented 9 years ago

Well some gems tend to implement an DSL. Others use helper methods. It all depends on the goal of the gem ;). Well the new DSL is released. You can now protect your endpoints with oauth2( scopes )