Question

does somebody tested - will authlogic works with oauth-plugin (https://github.com/pelle/oauth-plugin) or not?

Was it helpful?

Solution

The short answer is no. I am currently integrating oauth-plugin's service providership with my own auth system (which predates authlogic, acts_as_authenticated and all the rest).

oauth-plugin service providership works by means of a code generator generating two controllers, which are then tied into some library files in the plugin. All of these files expect a login_required class method with the same semantics that acts_as_authenticated uses.

authlogic makes no assumptions about your controllers at all, so it won't work out of the box with oauth-plugin, however that design decision also means it will be fairly easy to structure your controllers in the expected way. Therefore it should be (maybe trivially) easy to build a shim to support oauth-plugin.

However in my case I've decided to run the generator then to extract what I need from the plugin and delete the plugin itself. The primary reason I am doing this is that I explicitly don't have the login_required method in my auth system, so I would have to monkey patch the lib to get it to work. Secondly, there's a lot of stuff in the plugin I just don't need. Thirdly, most of the stuff that is truly library-level has already been abstracted into the oauth gem proper, so the stuff living in the oauth-plugin lib directory is in this weird no mans land between the generated code and the actual library.

OTHER TIPS

I'm in the process of getting this to work right now. I just rolled my own using the authlogic methods to make it play nicely. (I'm trying to get a provider working, so the authlogic-oauth doesn't seem right for me)

I'll edit as I go

def logged_in?
  return true if current_user 
end 

def login_required 
  return true if logged_in? 
  store_location 
  redirect_to new_user_session_path and return false                                                                                                                                                                                                                      
end 

Authlogic has an add-on that was specifically developed for it, which can be found here.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top