SUSE / velum

Dashboard for CaaS Platform clusters (v1, v2 and v3)
https://www.suse.com/
Apache License 2.0
54 stars 30 forks source link

Backport of LDAP external auth feature #657

Closed nanoscopic closed 5 years ago

nanoscopic commented 5 years ago

Combination of the 14 inter-related commits from HEAD that make the LDAP external auth feature work. This combines initial implementation and related tweaks and fixes.

Also included in this change are modification of certificate handling generally in the system to use file upload instead of copy and paste textareas.

The individual commit messages and their cherry-picked source reference following from here.

Add dex connector ldap table, models, and pillar output

Added a new table "dex_connectors_ldap" and migration file to the db schema and migrate files. Altered pillar controller to output this new data. Added a basic/empty app model for the new table so that the data can be fetched through it. Updated pillar rspec to test newly output connectors as well as to allow the empty connectors in the other pillar tests.

(cherry picked from commit 9a9393cc00b47c6054d7747d8db379c8961fdf96)

rename migration file

it needs to match the schema revision

feature#external-ldap

Signed-off-by: Maximilian Meister mmeister@suse.de (cherry picked from commit 52e869d927a16cad0e2066b5dafcd4db1d4d5afe)

Add ability to add, modify, delete and list LDAP connections in the ui

(cherry picked from commit 971c7920d9d20e9607705d842374f09014144562)

Setup RSpec fixture path.

(cherry picked from commit 09c5822cc9912d43d872fab2dbc54bb76751d1c4)

Fix bsc1097753: Allow the user to upload a certificate via file.

(cherry picked from commit 0ab1f88decd07ef4af331c30d8adb0f77dfd370e)

Ensure that certificates are always associated with the new holder.

Otherwise a reused certificate will not be associated with a new service.

(cherry picked from commit 084788176dc02a322c267aa143ca56a82c2bf51e)

Make dex connector for LDAP use the file-based certificate upload.

(cherry picked from commit b38fb1f99571d8844b60007d6b45fba62ae1d48a)

Added LDAP Connector validation button and logic Added new controller "ldap_test_controller". Updated _form.html.slim to add test button and message. Added ldap-conn-test.js to javascripts/settings. ldap-conn-test.js adds jquery logic to test button in place and modify message. Updated routes.rb for new controller. Added RSpec tests.

Fixed Code Climate warnings. Added logic in ldap_test_controller_spec.rb to turn on/off based on LDAP server presence. Addressed comments from David Helkowski. Addressed comments from Vítor Avelino (x2). Updated "Save" button ID in dex_connector_ldap_feature_spec.rb. Added ldap_mock.rb, ldap_mock.yml, updated settings.scss

(cherry picked from commit 3f08d4e051bb4f13c617790ea3a58d2d3faf5d9c)

Updates to prevent auto complete from filling out LDAP fields

A extra text field was added to break up the form flow to keep firefox from auto filling in the user name and password. this extra field was then hidden by css. if hidden in the HTML firefox would know and still auto fill.

(cherry picked from commit 0d201e75413b68ae18ca0c13e3cb3b48fe568328)

Updated tool tips and removed default data

updates to the rspec tests too account for missing feilds due to the lack of defaults

removed not required element ids

removed not required element ids and corrected accidental removal of @certificate_holder.port

Removal of not needed fill_ins

Under a previous assumption of the workings of the save button I had filled in stuff that is not needed for the test.

Updated slim html to use Certificate

Also updated unit tests to pass.

Removal of extra line

Corrected spelling and fixed spacing

Corrected spelling and updated spacing to be consistent in the examples.

update to tests to fix a bug

There are some issues with these test causing random failures, Currently the best fix to this is locking down the run order.

fixed rubocop complaints

updated to fix rubocop complaints.

(cherry picked from commit b445cac57002bf4fc1215dfe63bd14c7f5ceb10e)

specs: fixed TempFile usage for file fixtures

In some randomized seeds a temp file was being removed and no content was being uploaded, since the file didn't exist, and the file content wasn't being displayed on the screen as expected.

Since there's no way of controlling when GC is going to remove the temp files, the only way is trying to keep the reference on hold to be usable. The solution for this was to simply return the TempFile instance from to_file_fixture instead of the path or base name.

Signed-off-by: Vítor Avelino contact@vitoravelino.me (cherry picked from commit 1c3873f856c8050878e7bb38e3e47e4daedb5fac)

Fix test connection button for ldap external auth

Corrected fetching of password for ldap external auth

Corrected grabbing of certificate content for validating ldap external auth

(cherry picked from commit 98b8e10d9c6237aa2122ccdd2e2fda15618eb6d9)

Prevent changed external ldap values from skipping checks

Alter external ldap auth form to redisable save and rerequire 'check connection' when values are changed.

(cherry picked from commit 967df9b8b2d9fb4bad91149d3d9d7843b6f14ee6)

ldap (specs): minor improvements using capybara convetions

Signed-off-by: Vítor Avelino vavelino@suse.com (cherry picked from commit 88c5ba3df01da78a9ad57df0a3833f0a9b244257)