Taking kerberos realm from intialiser
This commit is contained in:
parent
98aeddf61b
commit
9a2ed8c467
2 changed files with 8 additions and 1 deletions
|
@ -6,6 +6,12 @@ require 'devise_kerberos_authenticatable/model'
|
||||||
require 'devise_kerberos_authenticatable/strategy'
|
require 'devise_kerberos_authenticatable/strategy'
|
||||||
require 'devise_kerberos_authenticatable/kerberos_adapter'
|
require 'devise_kerberos_authenticatable/kerberos_adapter'
|
||||||
|
|
||||||
|
module Devise
|
||||||
|
#Kerberos realm to use
|
||||||
|
mattr_accessor :kerberos_realm
|
||||||
|
@@kerberos_realm = ""
|
||||||
|
end
|
||||||
|
|
||||||
Devise.add_module(
|
Devise.add_module(
|
||||||
:kerberos_authenticatable,
|
:kerberos_authenticatable,
|
||||||
:strategy => true,
|
:strategy => true,
|
||||||
|
|
|
@ -9,8 +9,9 @@ module Devise
|
||||||
end
|
end
|
||||||
|
|
||||||
krb5 = Krb5.new
|
krb5 = Krb5.new
|
||||||
|
username_with_realm = "#{username}@#{::Devise.kerberos_realm}"
|
||||||
begin
|
begin
|
||||||
krb5.get_init_creds_password(username, password)
|
krb5.get_init_creds_password(username_with_realm, password)
|
||||||
rescue Krb5Auth::Krb5::Exception
|
rescue Krb5Auth::Krb5::Exception
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue