1
0
Fork 0
devise-kerberos-authenticat.../lib/devise_kerberos_authenticatable/kerberos_adapter.rb
2014-01-26 14:29:38 +00:00

21 lines
432 B
Ruby

require 'krb5_auth'
include Krb5Auth
module Devise
module KerberosAdapter
def self.valid_credentials?(username, password)
if Rails.env.test? && username == 'test' && password == 'test' then
return true
end
krb5 = Krb5.new
begin
krb5.get_init_creds_password(username, password)
rescue Krb5Auth::Krb5::Exception
return false
end
return true
end
end
end