Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
adding user lookup before the first, and use the DN from
the lookup result in the final binding.
- Loading branch information
Ping Yu
committed
Jan 2, 2011
1 parent
61eb507
commit 0ed8037
Showing
3 changed files
with
83 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,15 +52,16 @@ def get_credentials | |
|
||
def perform | ||
begin | ||
bind_dn = "#{@adaptor.uid}=#{request.POST['username']}" | ||
bind_dn << ",#{@adaptor.base}" unless @adaptor.base == '' | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
pyu10055
Contributor
|
||
@ldap_user_info = {} | ||
(@adaptor.bind unless @adaptor.bound?) rescue puts "failed to bind with the default credentials" | ||
@ldap_user_info = @adaptor.search(:filter => Net::LDAP::Filter.eq(@adaptor.uid, @name_proc.call(request.POST['username'])),:limit => 1) if @adaptor.bound? | ||
bind_dn = request.POST['username'] | ||
bind_dn = @ldap_user_info[:dn].to_a.first if @ldap_user_info[:dn] | ||
@adaptor.bind(:bind_dn => bind_dn, :password => request.POST['password']) | ||
@ldap_user_info = @adaptor.search(:filter => Net::LDAP::Filter.eq(@adaptor.uid, @name_proc.call(request.POST['username'])),:limit => 1) if @ldap_user_info.empty? | ||
@user_info = self.class.map_user(@@config, @ldap_user_info) | ||
|
||
@adaptor.bind(:bind_dn => bind_dn, :password => request.POST['password']) | ||
@ldap_user_info = @adaptor.search(:filter => Net::LDAP::Filter.eq(@adaptor.uid, @name_proc.call(request.POST['username'])),:limit => 1) | ||
@user_info = self.class.map_user(@@config, @ldap_user_info) | ||
|
||
@env['omniauth.auth'] = auth_hash | ||
#@env['REQUEST_METHOD'] = 'GET' | ||
@env['omniauth.auth'] = auth_hash | ||
@env['PATH_INFO'] = "#{OmniAuth.config.path_prefix}/#{name}/callback" | ||
|
||
call_app! | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Doesn't this break binding against the
:base
parameter?