Skip to content

Commit 15ae5ec

Browse files
Merge pull request #1992 from dmitry-sinina/drop_ldap
Remove LDAP Auth support
1 parent 423b2c1 commit 15ae5ec

19 files changed

Lines changed: 27 additions & 573 deletions

.github/workflows/tests.yml

Lines changed: 0 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -165,54 +165,6 @@ jobs:
165165
coverage
166166
167167
168-
rspec_ldap:
169-
name: Rspec tests for LDAP auth
170-
runs-on: ubuntu-latest
171-
container: ghcr.io/yeti-switch/yeti-web/build-image:trixie
172-
services:
173-
db:
174-
image: ghcr.io/yeti-switch/yeti-web/pgsql:18
175-
176-
needs: gems-caching
177-
strategy:
178-
fail-fast: false
179-
180-
steps:
181-
- uses: actions/checkout@v6
182-
- name: use cache
183-
uses: actions/cache@v5
184-
with:
185-
path: |
186-
vendor
187-
.bundle
188-
/opt/yeti-web/vendor/rbenv
189-
key: gems-deb13-${{runner.os}}-${{hashFiles('Gemfile.lock')}}-${{hashFiles('.ruby-version')}}
190-
191-
- name: Run rspec
192-
run: cp -v config/ldap.yml.distr config/ldap.yml && make rspec
193-
env:
194-
PARALLEL_TEST_PROCESSORS: 1
195-
TEST_GROUP: 0
196-
YETI_DB_HOST: db
197-
YETI_DB_PORT: 5432
198-
CDR_DB_HOST: db
199-
CDR_DB_PORT: 5432
200-
CI: true
201-
CI_RUN_LDAP: true
202-
203-
- name: Save artifacts
204-
if: always()
205-
uses: actions/upload-artifact@v6
206-
with:
207-
name: rspec-artifacts-ldap
208-
if-no-files-found: ignore
209-
include-hidden-files: true
210-
path: |
211-
tmp/capybara
212-
coverage
213-
214-
215-
216168
rspec_oidc:
217169
name: Rspec tests for OIDC auth
218170
runs-on: ubuntu-latest
@@ -268,7 +220,6 @@ jobs:
268220
needs:
269221
- gems-caching
270222
- rspec
271-
- rspec_ldap
272223
- rspec_oidc
273224
steps:
274225
- uses: actions/checkout@v6

Gemfile

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,9 @@ gem 'responders'
1515

1616
# Authentication
1717
gem 'activeadmin-oidc', github: 'activeadmin-plugins/activeadmin-oidc'
18-
gem 'activeldap'
1918
gem 'd3-rails', '3.5.2'
2019
gem 'devise', '>= 4.6.0'
21-
gem 'devise_ldap_authenticatable', github: 'cschiewek/devise_ldap_authenticatable', branch: 'default'
22-
gem 'net-ldap', '~> 0.19.0'
23-
gem 'ostruct', '~> 0.6.1' # need for net-ldap
20+
gem 'ostruct', '~> 0.6.1'
2421

2522
# Seamless JWT authentication for Rails API
2623
gem 'jwt'

Gemfile.lock

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,6 @@ GIT
2828
activeadmin
2929
rspec (~> 3.0)
3030

31-
GIT
32-
remote: https://github.com/cschiewek/devise_ldap_authenticatable.git
33-
revision: 6ef2131e79ff3421429f8d1b0645c6e113db4dc7
34-
branch: default
35-
specs:
36-
devise_ldap_authenticatable (0.8.7)
37-
devise (>= 3.4.1)
38-
net-ldap (>= 0.16.0)
39-
4031
GIT
4132
remote: https://github.com/didww/jrpc.git
4233
revision: f48c8e08bedbcc582a67538cc69bf8b7902fdc82
@@ -184,12 +175,6 @@ GEM
184175
activejob (7.2.3.1)
185176
activesupport (= 7.2.3.1)
186177
globalid (>= 0.3.6)
187-
activeldap (5.1.1)
188-
activemodel (> 4.0.0)
189-
builder
190-
gettext
191-
gettext_i18n_rails
192-
locale
193178
activemodel (7.2.3.1)
194179
activesupport (= 7.2.3.1)
195180
activemodel-serializers-xml (1.0.2)
@@ -407,7 +392,6 @@ GEM
407392
faraday (>= 1, < 3)
408393
faraday-net_http (3.4.2)
409394
net-http (~> 0.5)
410-
fast_gettext (1.6.0)
411395
ferrum (0.9)
412396
addressable (~> 2.5)
413397
cliver (~> 0.3)
@@ -424,11 +408,6 @@ GEM
424408
raabro (~> 1.4)
425409
get_process_mem (0.2.7)
426410
ffi (~> 1.0)
427-
gettext (3.2.9)
428-
locale (>= 2.0.5)
429-
text (>= 1.3.0)
430-
gettext_i18n_rails (1.8.0)
431-
fast_gettext (>= 0.9.0)
432411
globalid (1.3.0)
433412
activesupport (>= 6.1)
434413
google-protobuf (4.34.0)
@@ -499,7 +478,6 @@ GEM
499478
listen (3.5.1)
500479
rb-fsevent (~> 0.10, >= 0.10.3)
501480
rb-inotify (~> 0.9, >= 0.9.10)
502-
locale (2.1.2)
503481
logger (1.7.0)
504482
loofah (2.25.1)
505483
crass (~> 1.0.2)
@@ -526,7 +504,6 @@ GEM
526504
net-imap (0.6.3)
527505
date
528506
net-protocol
529-
net-ldap (0.19.0)
530507
net-pop (0.1.2)
531508
net-protocol
532509
net-protocol (0.2.2)
@@ -980,7 +957,6 @@ GEM
980957
faraday-follow_redirects
981958
syslog (0.2.0)
982959
syslog-logger (1.6.8)
983-
text (1.3.1)
984960
thor (1.5.0)
985961
tilt (2.7.0)
986962
timeliness (0.4.5)
@@ -1040,7 +1016,6 @@ DEPENDENCIES
10401016
active_record_extended
10411017
activeadmin
10421018
activeadmin-oidc!
1043-
activeldap
10441019
activemodel-serializers-xml
10451020
activerecord-import
10461021
annotate
@@ -1067,7 +1042,6 @@ DEPENDENCIES
10671042
database_consistency
10681043
delayed_job_active_record
10691044
devise (>= 4.6.0)
1070-
devise_ldap_authenticatable!
10711045
draper
10721046
dry-validation (~> 1.0)
10731047
elasticsearch
@@ -1086,7 +1060,6 @@ DEPENDENCIES
10861060
listen
10871061
matrix (~> 0.4.2)
10881062
mini_racer
1089-
net-ldap (~> 0.19.0)
10901063
net-smtp (~> 0.3.3)
10911064
novus-nvd3-rails!
10921065
odf-report!

app/models/admin_user.rb

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -68,18 +68,6 @@ def self.from_token_request(request)
6868
name.present? ? find_by(username: name) : nil
6969
end
7070

71-
def self.ldap?
72-
AdminUser.devise_modules.include?(:ldap_authenticatable)
73-
end
74-
75-
def self.ldap_config
76-
Rails.root.join 'config/ldap.yml'
77-
end
78-
79-
def self.ldap_config_exists?
80-
File.exist?(ldap_config)
81-
end
82-
8371
def self.oidc?
8472
respond_to?(:omniauth_providers) && omniauth_providers.include?(:oidc)
8573
end
@@ -93,7 +81,7 @@ def self.oidc_config_exists?
9381
end
9482

9583
def self.external_auth?
96-
ldap? || oidc?
84+
oidc?
9785
end
9886

9987
def self.available_roles
@@ -104,8 +92,6 @@ def self.available_roles
10492

10593
if oidc_config_exists?
10694
include AdminUserOidcHandler
107-
elsif ldap_config_exists?
108-
include AdminUserLdapHandler
10995
else
11096
include AdminUserDatabaseHandler
11197
end
@@ -129,12 +115,7 @@ def customized_update(params)
129115
if params[:password].present? || params[:password_confirmation].present?
130116
update_with_password params
131117
else
132-
attrs = params.except(:password, :password_confirmation)
133-
if respond_to?(:update_without_password)
134-
update_without_password attrs # db auth
135-
else
136-
update(attrs) # ldap
137-
end
118+
update_without_password params.except(:password, :password_confirmation)
138119
end
139120
end
140121

app/models/concerns/admin_user_ldap_handler.rb

Lines changed: 0 additions & 54 deletions
This file was deleted.

config/initializers/config.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,6 @@ def self.setting_files(config_root, _env)
105105
optional(:auto_approve).value(:bool)
106106
optional(:pdf_converter).maybe(:string)
107107
end
108-
optional(:default_ldap_roles).array(:string)
109-
110108
optional(:admin_ui).schema do
111109
optional(:session_lifetime).maybe(:int?)
112110
end

config/initializers/devise.rb

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -237,15 +237,6 @@
237237
# When using omniauth, Devise cannot automatically set Omniauth path,
238238
# so you need to do it manually. For the users scope, it would be:
239239
# config.omniauth_path_prefix = "/my_engine/users/auth"
240-
config.secret_key = '649ebc96aad6b55506254450d9ec26e08075cd2fffffffd09e3ed554b790c4b6cbff44f5b67cc'
241-
242-
if File.exist?(Rails.root.join('config/ldap.yml'))
243-
config.ldap_logger = false
244-
config.ldap_create_user = true
245-
config.ldap_use_admin_to_bind = false
246-
config.ldap_check_group_membership = true
247-
config.ldap_check_group_membership_without_admin = true
248-
end
249240
config.authentication_keys = [:username]
250241
config.case_insensitive_keys = []
251242
config.strip_whitespace_keys = []

config/ldap.yml.distr

Lines changed: 0 additions & 56 deletions
This file was deleted.

config/oidc.yml.distr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# cp -v config/oidc.yml.distr config/oidc.yml
55
#
66
# Drop config/oidc.yml (and restart) to disable OIDC mode and fall back to
7-
# database auth. Precedence: oidc.yml > ldap.yml > database.
7+
# database auth.
88
#
99
# Note: the on_login lambda in config/initializers/activeadmin_oidc.rb
1010
# captures the values below at boot time. When you edit this file in

config/yeti_web.yml.ci

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,6 @@ invoice:
6262
auto_approve: false
6363
pdf_converter: ""
6464

65-
default_ldap_roles:
66-
- root
67-
6865
api_log_enabled: true
6966
logs:
7067
tags:

0 commit comments

Comments
 (0)