Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(POOLER-113) Add support for multiple LDAP search bases #267

Merged
merged 3 commits into from
Jun 27, 2018

Conversation

mattkirby
Copy link
Contributor

This commit updates vmpooler to support setting an array of search bases
in addition to a single base provided as a string. Without this change
it is not possible to specify multiple search bases to use with the LDAP
authentication provider. Additionally, test coverage is added to
the authentication helper method.

This commit updates vmpooler to support setting an array of search bases
in addition to a single base provided as a string. Without this change
it is not possible to specify multiple search bases to use with the LDAP
authentication provider. Additionally, test coverage is added to
the authentication helper method.
@sbeaulie
Copy link
Contributor

The new LDAP tests did not pass in travis

@mattkirby
Copy link
Contributor Author

Interesting. Those tests work if I test the file they're in alone. However, I get the same failures when running the full suite. I'll investigate and update this.

This commit removes a additional authenticate method that is defined in the token_spec tests. Instead, authenticate is used from api/helpers. To support this change the config provided is updated to specify a dummy provider. Without this change authenticate cannot be tested along with token_spec because token_spec redefines authenticate.
@mattkirby
Copy link
Contributor Author

It looks like tests were failing because authenticate was redefined in 'token_spec.rb'. I've updated this to remove the duplicate definition of authenticate and updated 'token_spec.rb' to use the dummy auth provider.

@@ -54,35 +54,63 @@ def authorized?
return false
end

def authenticate_ldap(port, host, user_object, base, username_str, password_str)
require 'rubygems'
require 'net/ldap'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mattkirby Just curious why you are putting the require statement inside the authenticate_ldap method instead of at the top of the file. Is there a reason to limit the scope?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only because it's what was already being done. It probably should be at the top of the file.

This commit moves net/ldap require from authenticate_ldap in api/helpers to vmpooler.rb. Without this change net/ldap and rubygems are required again every time authenticate_ldap is run.
@mchllweeks mchllweeks merged commit 8be5784 into puppetlabs:master Jun 27, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants