Rob,

Turns out Shib is really easy to get working once you have shibd up
and kicking.

First, take a look at the restful_authentication plugin to see how
they handle authentication: Relevantly, there's a @current_user
instance variable with a setter that looks like this:

def current_user
  @current_user ||= user_from_database || user_from_session ||
user_from_login
end

As a before_filter, the system makes use of #logged_in? To determine
if a current user could be found. That code is a simple !!
current_user;

Now, shibboleth adds fields to the request headers of all incoming
traffic. Instead of doing the logged_in filter, we just set something
up to create or find a database record that corresponds to the user.
This looks like this (For the shib variable 'eppn'), assuming that
your User table has a field named eppn.

def current_user
  @current_user ||= User.find_or_create_by_eppn(request.env['eppn'])
end

That's it! Of course, you're going to need a way to ensure that
database record is meaningful in the context of your application - In
our situation, we test for the presence of contact information and
then prompt the user to add it if none exists, but it doesn't really
matter because the data in our IP to DNA lookup table is sorted by
their eppn anyway.

E-mail back if my sample code doesn't work!

-Alex

On Oct 13, 3:53 pm, Rob Lacey <[EMAIL PROTECTED]> wrote:
> Can anyone direct me to a really good tutorial on Shibboleth integration
> with Rails, or indeed some sample code? I've been tearing my hair out
> all day on this one.
>
> Thanks
>
> RobL
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to