Skip to content

Commit

Permalink
Allow to configure LDAP kerberos through the module (#269)
Browse files Browse the repository at this point in the history
  • Loading branch information
PopiBrossard authored Dec 19, 2022
1 parent febd192 commit 1efcc5d
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 0 deletions.
18 changes: 18 additions & 0 deletions REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -2680,6 +2680,12 @@ keycloak_ldap_user_provider { 'LDAP on test':

The following properties are available in the `keycloak_ldap_user_provider` type.

##### `allow_kerberos_authentication`

Valid values: ``true``, ``false``

allowKerberosAuthentication

##### `auth_type`

Valid values: `none`, `simple`
Expand Down Expand Up @@ -2758,6 +2764,14 @@ importEnabled

Default value: `true`

##### `kerberos_realm`

kerberosRealm

##### `key_tab`

keyTab

##### `priority`

priority
Expand All @@ -2776,6 +2790,10 @@ Valid values: `one`, `one_level`, `subtree`, `1`, `2`, `1`, `2`

searchScope

##### `server_principal`

serverPrincipal

##### `sync_registrations`

Valid values: ``true``, ``false``
Expand Down
17 changes: 17 additions & 0 deletions lib/puppet/type/keycloak_ldap_user_provider.rb
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,23 @@ def should_to_s(_newvalue)
newvalues(:true, :false)
end

newproperty(:allow_kerberos_authentication, boolean: true) do
desc 'allowKerberosAuthentication'
newvalues(:true, :false)
end

newproperty(:kerberos_realm) do
desc 'kerberosRealm'
end

newproperty(:key_tab) do
desc 'keyTab'
end

newproperty(:server_principal) do
desc 'serverPrincipal'
end

newproperty(:user_object_classes, array_matching: :all, parent: PuppetX::Keycloak::ArrayProperty) do
desc 'userObjectClasses'
defaultto ['inetOrgPerson', 'organizationalPerson']
Expand Down
12 changes: 12 additions & 0 deletions spec/unit/puppet/type/keycloak_ldap_user_provider_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,18 @@
expect(resource[:use_kerberos_for_password_authentication]).to eq(:true)
end

it 'allows kerberos configuration' do
config[:auth_type] = 'simple'
config[:allow_kerberos_authentication] = true
config[:kerberos_realm] = 'BAR.COM'
config[:key_tab] = '/etc/krb5.keytab'
config[:server_principal] = 'host/[email protected]'
expect(resource[:allow_kerberos_authentication]).to eq(:true)
expect(resource[:kerberos_realm]).to eq('BAR.COM')
expect(resource[:key_tab]).to eq('/etc/krb5.keytab')
expect(resource[:server_principal]).to eq('host/[email protected]')
end

it 'does not allow invalid bind_credential' do
config[:auth_type] = 'simple'
config[:use_kerberos_for_password_authentication] = 'foo'
Expand Down

0 comments on commit 1efcc5d

Please sign in to comment.