|
|
@ -1,6 +1,5 @@ |
|
|
|
# frozen_string_literal: true |
|
|
|
# frozen_string_literal: true |
|
|
|
|
|
|
|
|
|
|
|
if ENV['LDAP_ENABLED'] == 'true' |
|
|
|
|
|
|
|
require 'net/ldap' |
|
|
|
require 'net/ldap' |
|
|
|
require 'devise/strategies/authenticatable' |
|
|
|
require 'devise/strategies/authenticatable' |
|
|
|
|
|
|
|
|
|
|
@ -15,7 +14,7 @@ if ENV['LDAP_ENABLED'] == 'true' |
|
|
|
base: Devise.ldap_base, |
|
|
|
base: Devise.ldap_base, |
|
|
|
encryption: { |
|
|
|
encryption: { |
|
|
|
method: Devise.ldap_method, |
|
|
|
method: Devise.ldap_method, |
|
|
|
tls_options: OpenSSL::SSL::SSLContext::DEFAULT_PARAMS, |
|
|
|
tls_options: tls_options, |
|
|
|
}, |
|
|
|
}, |
|
|
|
auth: { |
|
|
|
auth: { |
|
|
|
method: :simple, |
|
|
|
method: :simple, |
|
|
@ -41,9 +40,14 @@ if ENV['LDAP_ENABLED'] == 'true' |
|
|
|
def password |
|
|
|
def password |
|
|
|
params[:user][:password] |
|
|
|
params[:user][:password] |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def tls_options |
|
|
|
|
|
|
|
OpenSSL::SSL::SSLContext::DEFAULT_PARAMS.tap do |options| |
|
|
|
|
|
|
|
options[:verify_mode] = OpenSSL::SSL::VERIFY_NONE if Devise.ldap_tls_no_verify |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
Warden::Strategies.add(:ldap_authenticatable, Devise::Strategies::LdapAuthenticatable) |
|
|
|
Warden::Strategies.add(:ldap_authenticatable, Devise::Strategies::LdapAuthenticatable) |
|
|
|
end |
|
|
|
|
|
|
|