Campus Authentication with Shibboleth

Examples of integrating with Shibboleth and CAS

Authenticate against Shibboleth

There are probably many ways of doing this.

Data Curation Experts has a repeatable way for accomplishing it, documented here.

Authenticate against CAS

Again, there are probably several ways to do this. This method uses a gem called https://github.com/nbudin/devise_cas_authenticatable.

Ā Instructions

Add the devise_cas_authenticatable gem

Add this line to your Gemfile:

gem 'devise_cas_authenticatable'

Then run the command bundle install.

Modify the user model

Go to the file app/models/user.rb. Find this line:

attr_accessible :email, :password, :password_confirmation #default line from the basic hyrax installation

Replace it with:

attr_accessible :email

Next, find these lines:

Replace them with:

Finally, add a function that takes extra attributes from your CAS server and maps them to fields in the Hyrax contributor profile. In this example, we will get the department name and email address.

Modify the devise initializer

Go to config/initializers/devise.rb and add the following lines, adding your specific CAS URL. There are https://github.com/nbudin/devise_cas_authenticatable#setup that you can add to this initializer.

Add a username field to your database

Create a migration like this:

Run rails db:migrate