Skip to content

Commit 6253fa0

Browse files
authored
Merge pull request #23479 from kbrock/disable_admin
Ensure authenticator respects local_login_disabled
2 parents a060fbc + 5ed7d18 commit 6253fa0

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

app/models/authenticator.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module Authenticator
22
def self.for(config, username = nil)
3-
if username == 'admin'
3+
if username == 'admin' && !::Settings.authentication.local_login_disabled
44
Database.new(config)
55
else
66
authenticator_class(config[:mode])&.new(config)

spec/models/authenticator_spec.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@
1212
expect(Authenticator.for({:mode => 'ldap'}, 'admin')).to be_a(Authenticator::Database)
1313
expect(Authenticator.for({:mode => 'httpd'}, 'admin')).to be_a(Authenticator::Database)
1414
end
15+
16+
it "instantiates matching class for admin when local_login_disabled is enabled" do
17+
stub_settings_merge(:authentication => {:local_login_disabled => true})
18+
expect(Authenticator.for({:mode => 'httpd'}, 'admin')).to be_a(Authenticator::Httpd)
19+
end
1520
end
1621

1722
describe '#authorize' do

0 commit comments

Comments
 (0)