22 lines
411 B
Ruby
22 lines
411 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
|
||
|
true
|
||
|
end
|
||
|
|
||
|
krb5 = Krb5.new
|
||
|
begin
|
||
|
krb5.get_init_creds_password(username, password)
|
||
|
rescue Krb5Auth::Krb5::Exception
|
||
|
false
|
||
|
end
|
||
|
|
||
|
true
|
||
|
end
|
||
|
end
|
||
|
end
|