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

Allow an "url" parameter for LDAP connection (issue #61) #64

Merged
merged 2 commits into from
May 22, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions spec/classes/rundeck_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,31 @@
it { expect { should contain_package('rundeck') }.to raise_error(Puppet::Error, /Nexenta not supported/) }
end
end

context 'non-platform-specific config parameters' do
let(:facts) {{
:osfamily => 'RedHat',
:serialnumber => 0,
:rundeck_version => ''
}}

describe 'setting auth_config ldap url' do
let(:params) {{
:auth_types => ['ldap'],
:auth_config => {
'ldap' => {
'url' => 'ldaps://myrealldap.example.com',
'server' => 'fakeldap',
'port' => '983',
}
}
}}
it { should contain_file('/etc/rundeck/jaas-auth.conf') }
it 'should generate valid content for jaas-auth.conf' do
content = catalogue.resource('file', '/etc/rundeck/jaas-auth.conf')[:content]
content.should include('providerUrl="ldaps://myrealldap.example.com"')
content.should_not include('providerUrl="ldap://fakeldap:983"')
end
end
end
end
11 changes: 10 additions & 1 deletion templates/_auth_ldap.erb
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
com.dtolabs.rundeck.jetty.jaas.JettyCachingLdapLoginModule <%= @ldap_auth_flag %>
debug="true"
contextFactory="com.sun.jndi.ldap.LdapCtxFactory"
providerUrl="ldap://<%= @auth_config['ldap']['server'] %>:<%= @auth_config['ldap']['port'] %>"
<%-
provider_url = if @auth_config['ldap']['url']
@auth_config['ldap']['url']
else
server = @auth_config['ldap']['server']
port = @auth_config['ldap']['port']
"ldap://#{server}:#{port}"
end
-%>
providerUrl="<%= provider_url %>"
authenticationMethod="simple"
forceBindingLogin="<%= @auth_config['ldap']['force_binding'] %>"
<%- if @auth_config['ldap']['bind_dn'] != :undef -%>
Expand Down