Commit a3ec58da authored by Michael Kozono's avatar Michael Kozono

Downcase normalized LDAP DNs and UIDs

parent 4ae32d95
......@@ -100,7 +100,7 @@ module Gitlab
private
def self.normalize_dn_part(part)
cleaned = part.strip
cleaned = part.strip.downcase
if cleaned.ends_with?('\\')
# If it ends with an escape character that is not followed by a
......
......@@ -68,10 +68,18 @@ describe Gitlab::LDAP::AuthHash do
describe '#uid' do
context 'when there is extraneous (but valid) whitespace' do
let(:given_uid) { 'uid =John Smith , ou = People, dc= example,dc =com' }
let(:given_uid) { 'uid =john smith , ou = people, dc= example,dc =com' }
it 'removes the extraneous whitespace' do
expect(auth_hash.uid).to eq('uid=John Smith,ou=People,dc=example,dc=com')
expect(auth_hash.uid).to eq('uid=john smith,ou=people,dc=example,dc=com')
end
end
context 'when there are upper case characters' do
let(:given_uid) { 'UID=John Smith,ou=People,dc=example,dc=com' }
it 'downcases' do
expect(auth_hash.uid).to eq('uid=john smith,ou=people,dc=example,dc=com')
end
end
end
......
This diff is collapsed.
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