Skip to content

jpshackelford/devise_crowd_authenticatable

 
 

Repository files navigation

Devise Crowd Authenticatable

Please Note THIS IS A RECENT FORK OF LDAP AUTHENTICATABLE AND IS NOT READY FOR USE!

Devise Crowd Authenticatable is a Crowd based authentication strategy for the Devise authentication framework.

If you are building applications for use within your organization which require authentication and you want to use Crowd, this plugin is for you.

Please Note

This Rails plug-in supports ONLY Rails 3.x.

Requirements

  • An Crowd server
  • Rails 3.x

These gems are dependencies of the gem:

  • Devise 1.1.2

Installation

In the Gemfile for your application:

gem "devise", "1.1.2"
gem "devise_crowd_authenticatable"

To get the latest version, pull directly from github instead of the gem:

gem "devise_crowd_authenticatable", :git => "git://github.com/jpshackelford/devise_crowd_authenticatable.git"

Setup

Run the rails generators for devise (please check the devise documents for further instructions)

rails generate devise:install
rails generate devise MODEL_NAME

Run the rails generator for devise_crowd_authenticatable

rails generate devise_crowd_authenticatable:install [options]

This will install the sample.yml, update the devise.rb initializer, and update your user model. There are some options you can pass to it:

Options:

[--user-model=USER_MODEL]  # Model to update
                           # Default: user
[--update-model]           # Update model to change from database_authenticatable to crowd_authenticatable
                           # Default: true
[--add-rescue]             # Update Application Controller with resuce_from for DeviseLdapAuthenticatable::LdapException
                           # Default: true
[--advanced]               # Add advanced config options to the devise initializer

Usage

Devise Crowd Authenticatable works in replacement of Database Authenticatable

Please Note

This devise plugin has not been tested with DatabaseAuthenticatable enabled at the same time. This is meant as a drop in replacement for DatabaseAuthenticatable allowing for a semi single sign on approach.

The field that is used for logins is the first key that's configured in the config/devise.rb file under config.authentication_keys, which by default is email.

Configuration

In initializer config/initializers/devise.rb :

  • crowd_logger (default: true)

    • If set to true, will log Crowd queries to the Rails logger.
  • crowd_create_user (default: false)

    • If set to true, all valid Crowd users will be allowed to login and an appropriate user record will be created. If set to false, you will have to create the user record before they will be allowed to login.
  • crowd_config (default: #{Rails.root}/config/crowd.yml)

    • Where to find the Crowd config file. Commented out to use the default, change if needed.
  • crowd_update_password (default: true)

    • When doing password resets, if true will update the Crowd server. Requires admin password in the crowd.yml
  • crowd_check_group_membership (default: false)

    • When set to true, the user trying to login will be checked to make sure they are in all of groups specified in the crowd.yml file.
  • crowd_check_attributes (default: false)

    • When set to true, the user trying to login will be checked to make sure they have all of the attributes in the crowd.yml file.
  • crowd_use_admin_to_bind (default: false)

    • When set to true, the admin user will be used to bind to the Crowd server during authentication.

Advanced Configuration

These parameters will be added to config/initializers/devise.rb when you pass the --advanced switch to the generator:

  • crowd_auth_username_builder (default: Proc.new() {|attribute, login, crowd| "#{attribute}=#{login},#{crowd.base}" })
    • You can pass a proc to the username option to explicitly specify the format that you search for a users' DN on your Crowd server.

Testing

This has been tested using the following setup:

  • Mac OSX 10.6
  • OpenCrowd 2.4.11
  • REE 1.8.7 (2010.02)

All unit and functional tests are part of a sample rails application under test/rails_app and requires a working Crowd sever.

Build / Start Instructions for Test Crowd Server

Make sure that directories test/crowd/opencrowd-data and test/crowd/opencrowd-data/run exist.

  1. To start the server, run ./run_server.sh
  2. Add the basic structure: crowdadd -x -h localhost -p 3389 -x -D "cn=admin,dc=test,dc=com" -w secret -f base.ldif * this creates the users / passwords:
  3. You should now be able to run the tests in test/rails_app by running: rake

For a Crowd server running SSL

  1. To start the server, run: ./run_server.sh --ssl
  2. Add the basic structure: crowdadd -x -H crowds://localhost:3389 -x -D "cn=admin,dc=test,dc=com" -w secret -f base.ldif * this creates the users / passwords:
  3. You should now be able to run the tests in test/rails_app by running: Crowd_SSL=true rake

Please Note

In your system Crowd config file (on OSX it's /etc/opencrowd/crowd.conf) make sure you have the following setting:

TLS_REQCERT	never

This will allow requests to go to the test Crowd server without being signed by a trusted root (it uses a self-signed cert)

References

TODO

Released under the MIT license

Copyright (c) 2010 Curtis Schiewek, Daniel McNevin, John-Mason P. Shackelford

This is largely ripped-off of Curis Schiewek's Devise LDAP Authenticatable.

About

Devise Module for LDAP

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Ruby 93.9%
  • JavaScript 5.8%
  • Shell 0.3%