I’ve got a Rails app with a ApplicationController that looks like this:
class ApplicationController < ActionController::Base
before_filter :authorize, :except => :login
def authorize unless session[:user] flash[:notice] = "Please log in" session[:jumpto] = request.parameters redirect_to :controller => "login", :action => "login" end end
So, basically, redirect a user to the login screen if they haven’t
logged in. Pretty standard stuff.
But, if I want to setup a web service, how do I set session data from
client side through, say, an xmlrpc call using layered dispatching?
messing around with the block form of the web_service, and even tried
up a LoginApi and LoginService, but no luck.
I’d like to be able to do this:
rpc = XMLRPC::Client.new(‘localhost’, ‘http://localhost/webservice/api’,
rpc.call(‘login.login’, user, password) # Set session data here
rpc.call(‘foo.findFooById’, 2) # Go on my merry way
I googled around a bit and couldn’t quite find the answer I was looking
That, or I’m just not “getting it”.
What’s the best/proper way to handle this?