Skip to content
Snippets Groups Projects
Commit 987a81f7 authored by Dmitriy Dzema's avatar Dmitriy Dzema
Browse files

Do not allow to sign in using blank username or blank password

AD allows bind with with correct username and empty password
so application will think user successfully authenticated which
is a serious mistake
parent df7a8d04
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -37,7 +37,7 @@ module OmniAuth
def callback_phase
@adaptor = OmniAuth::LDAP::Adaptor.new @options
 
return fail!(:missing_credentials) if request['username'].nil? || request['password'].nil?
return fail!(:missing_credentials) if missing_credentials?
begin
@ldap_user_info = @adaptor.bind_as(:filter => Net::LDAP::Filter.eq(@adaptor.uid, @options[:name_proc].call(request['username'])),:size => 1, :password => request['password'])
return fail!(:invalid_credentials) if !@ldap_user_info
Loading
Loading
@@ -80,6 +80,12 @@ module OmniAuth
end
user
end
protected
def missing_credentials?
request['username'].nil? or request['username'].empty? or request['password'].nil? or request['password'].empty?
end # missing_credentials?
end
end
end
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment