I'm using rubycas-server
GEM as my CAS server. This CAS server is checking user credentials from a user table of a different database. These users are created using Devise
gem. Devise saves every user's password in encrypted form in database table. So in the configuration file of this rubycas-server
contains a authenticator
section, It's code is given below:
authenticator:
class: CASServer::Authenticators::SQL
database:
adapter: postgresql
database: testdb
username: postgres
password: root
host: localhost
pool: 5
user_table: users
username_column: email
password_column: encrypted_password
encrypt_function: <encryption function>
As stated above in the last line of code that, encrypted_function
contains the algorithm to check credentials. Some samples given gelow in the URL
https://code.google.com/p/rubycas-server/wiki/UsingTheSQLEncryptedAuthenticator
But I can't find what will be suitable for devise
. Please help.
Finally I got solution for my question. Actually the
encrypt_function:
not needed in authenticator settings. As I'm using email and encrypted_password which is generated byDevise
to check a user's credentials, the final authenticator is:As Devise user
BCrypt
by default to encrypt the password, That's why I'm usingCASServer::Authenticators::SQLBcrypt
class. Butrubycas-server
gem don't setSQLBcrypt
configurations by default. So go tolib/casserver/authenticators/authlogic_crypto_providers
path and openbrypt.rb
file. In this file you can see these lines are commented, so un-comment them or if not present then add themThen run
gem install bcrypt-ruby
in your terminal or add this GEM torubycas-server
GEMFILE and restart the server. I think this should work.