Skip to content

Instantly share code, notes, and snippets.

@JohnColvin
Created October 16, 2012 14:31
Show Gist options
  • Select an option

  • Save JohnColvin/3899616 to your computer and use it in GitHub Desktop.

Select an option

Save JohnColvin/3899616 to your computer and use it in GitHub Desktop.
Integrate shibboleth into a rails app

How to integrate shibboleth into a rails application

This assumes that shibboleth is installed on the server running the rails application. It should be possible to use SAML to authenticate by shibboleth without installing it on the server.

add to Gemfile

gem 'omniauth-shibboleth' and then bundle

create 'config/initializers/omniauth.rb'

In this example, the user id field is the employee number provided by shibboleth

Rails.application.config.middleware.use OmniAuth::Builder do
  provider :shibboleth, :uid_field => :employeeNumber
end
Point the shibboleth callback route (/auth/shibboleth/callback) to an action.

The user's information is available in request.env["omniauth.auth"]. Use this information to login or create a user in your system.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment