Commit bec48afe authored by Robert Speicher's avatar Robert Speicher

Merge branch 'pl-fix-applogger-namespace-kerberos' into 'master'

Fix resolution of Gitlab::AppLogger in EE kerberos_spnego_helper

See merge request gitlab-org/gitlab!44822
parents 6f371065 bae19175
...@@ -82,7 +82,7 @@ module EE ...@@ -82,7 +82,7 @@ module EE
# Return user principal name if authentication succeeded # Return user principal name if authentication succeeded
gss.display_name gss.display_name
rescue GSSAPI::GssApiError => ex rescue GSSAPI::GssApiError => ex
Gitlab::AppLogger.error "#{self.class.name}: failed to process Negotiate/Kerberos authentication: #{ex.message}" ::Gitlab::AppLogger.error "#{self.class.name}: failed to process Negotiate/Kerberos authentication: #{ex.message}"
false false
end end
......
...@@ -10,6 +10,7 @@ RSpec.describe KerberosSpnegoHelper do ...@@ -10,6 +10,7 @@ RSpec.describe KerberosSpnegoHelper do
subject { Class.new { include KerberosSpnegoHelper }.new } subject { Class.new { include KerberosSpnegoHelper }.new }
context 'with successful remote call' do
before do before do
expect(GSSAPI::Simple).to receive(:new) expect(GSSAPI::Simple).to receive(:new)
.with(nil, nil, ::Gitlab.config.kerberos.keytab) .with(nil, nil, ::Gitlab.config.kerberos.keytab)
...@@ -60,4 +61,22 @@ RSpec.describe KerberosSpnegoHelper do ...@@ -60,4 +61,22 @@ RSpec.describe KerberosSpnegoHelper do
end end
end end
end end
context 'when the remote call fails' do
before do
allow(GSSAPI::Simple).to receive(:new)
.with(nil, nil, ::Gitlab.config.kerberos.keytab)
.and_raise(GSSAPI::GssApiError, 'a message')
allow(Gitlab::AppLogger).to receive(:error).and_call_original
end
it 'fails to authenticate and logs an error' do
expect(subject.spnego_credentials!('some token')).to eq(false)
expect(Gitlab::AppLogger).to have_received(:error)
.with(%r{failed to process Negotiate/Kerberos authentication: a message})
end
end
end
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment