I’m summarizing the details of a larger process that’s intended to be
secure from people listening on the line. So yes that would work but it
wouldn’t solve the problem in the manner in which I’m trying to address
it.
It’s unclear to me if these two controllers are running on the same
machine or not since you referenced DRb. If they are running on the
same machine how do you instantiate “AnApplicationController”? That is,
Rails instantiates the controller for each incoming request and from
your example that would appear to be “AuthController”.
Could you simply do
AnApplicationController.new.listenForAuthControllerData(some_data)? Of
course, this would require setup and tear down for each invocation.
Another alternative MIGHT be to instantiate it one time and store it in
a class variable. If you have multiple instances of the Ruby
interpreter running on your server though that might not work depending
on the requirements of your application.
No actually they would be on seperate machines.
The idea is that AnApplicationController is any old rails application.
The AuthController is the single sign-on for different
“AnApplicationController”'s. So in the AnApplicationController, we
handle redirecting to the AuthController when necessary.
The AuthController is expected to take care of authenticating the user
then sending out the permissions to the calling application (directly),
in an attempt to prevent Session hijacking and permission modifications.
Have you considered EventMachine? I have not worked with it yet myself
but it supports SSL and would allow you to setup a socket server in
Ruby to handle the authentication and send a response back to the
client. It’s available at Rubyforge. Do a google search on it. I saw
this snippet of code that got me interested in marking it as a tool
that I will likely use when the requirements call for it:
Create a daemon / server in 11 lines of Ruby
require ‘rubygems’
require ‘eventmachine’
module EchoServer
def receive_data(data)
send_data “>>> You sent: #{data}”
close_connection if data =~ /quit|exit/i
end
end