Sha256: 14d4137fa4731862e0c804ab4f6f010e2b1a26d5dbc54ad8b201b4f8b2fb8ec7
Contents?: true
Size: 1.05 KB
Versions: 2
Compression:
Stored size: 1.05 KB
Contents
require 'casserver/authenticators/base' begin require 'active_record' rescue LoadError require 'rubygems' require 'active_record' end class CASServer::Authenticators::SQL < CASServer::Authenticators::Base def validate(credentials) read_standard_credentials(credentials) raise "Cannot validate credentials because the authenticator hasn't yet been configured" unless @options raise "Invalid authenticator configuration!" unless @options[:database] CASUser.establish_connection @options[:database] CASUser.set_table_name @options[:user_table] || "users" username_column = @options[:username_column] || 'username' password_column = @options[:password_column] || 'password' results = CASUser.find(:all, :conditions => ["#{username_column} = ? AND #{password_column} = ?", @username, @password]) if results.size > 0 $LOG.warn("Multiple matches found for user '#{@username}'") if results.size > 1 return true else return false end end class CASUser < ActiveRecord::Base end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rubycas-server-0.1.0 | lib/casserver/authenticators/sql.rb |
rubycas-server-0.2.0 | lib/casserver/authenticators/sql.rb |