Skip to content

Commit c132b89

Browse files
committed
🚨 Linting
1 parent c7c944d commit c132b89

File tree

4 files changed

+13
-13
lines changed

4 files changed

+13
-13
lines changed

.rubocop_gradual.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
[47, 7, 38, "RSpec/AnyInstance: Avoid stubbing using `allow_any_instance_of`.", 3627954156],
2424
[84, 7, 48, "RSpec/AnyInstance: Avoid stubbing using `allow_any_instance_of`.", 2759780562]
2525
],
26-
"spec/omniauth/strategies/ldap_spec.rb:1834231975": [
26+
"spec/omniauth/strategies/ldap_spec.rb:4166458344": [
2727
[126, 13, 9, "RSpec/ContextWording: Context description should match /^when\\b/, /^with\\b/, or /^without\\b/.", 1130140517],
2828
[181, 17, 28, "RSpec/ContextWording: Context description should match /^when\\b/, /^with\\b/, or /^without\\b/.", 3444838747],
2929
[190, 17, 23, "RSpec/ContextWording: Context description should match /^when\\b/, /^with\\b/, or /^without\\b/.", 1584148894],

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,9 @@ use OmniAuth::Strategies::LDAP,
7171
ciphers: ["AES-128-CBC", "AES-128-CBC-HMAC-SHA1", "AES-128-CBC-HMAC-SHA256"],
7272
},
7373
mapping: {
74-
'name' => 'cn;lang-en',
75-
'email' => ['preferredEmail', 'mail'],
76-
'nickname' => ['uid', 'userid', 'sAMAccountName']
74+
"name" => "cn;lang-en",
75+
"email" => ["preferredEmail", "mail"],
76+
"nickname" => ["uid", "userid", "sAMAccountName"],
7777
}
7878
# Or, alternatively:
7979
# use OmniAuth::Strategies::LDAP, filter: '(&(uid=%{username})(memberOf=cn=myapp-users,ou=groups,dc=example,dc=com))'

lib/omniauth/strategies/ldap.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ def directory_lookup(adaptor, username)
205205
search_filter = filter(adaptor, username)
206206
adaptor.connection.open do |conn|
207207
rs = conn.search(filter: search_filter, size: 1)
208-
entry = rs&.first
208+
entry = rs && rs.first
209209
end
210210
entry
211211
end

spec/omniauth/strategies/ldap_spec.rb

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -433,19 +433,19 @@ def make_env(path = "/auth/ldap", props = {})
433433
expect(info.description).to eq "omniauth-ldap"
434434
end
435435

436-
context 'and mapping is set' do
436+
context "when mapping is set" do
437437
let(:app) do
438438
Rack::Builder.new {
439439
use OmniAuth::Test::PhonySession
440-
use MyLdapProvider, :name => 'ldap', :host => '192.168.1.145', :base => 'dc=score, dc=local', :mapping => { 'phone' => 'mobile' }
441-
run lambda { |env| [404, {'Content-Type' => 'text/plain'}, [env.key?('omniauth.auth').to_s]] }
440+
use MyLdapProvider, name: "ldap", host: "192.168.1.145", base: "dc=score, dc=local", mapping: {"phone" => "mobile"}
441+
run lambda { |env| [404, {"Content-Type" => "text/plain"}, [env.key?("omniauth.auth").to_s]] }
442442
}.to_app
443443
end
444444

445-
it 'should map user info according to customized mapping' do
446-
post('/auth/ldap/callback', {:username => 'ping', :password => 'password'})
447-
expect(auth_hash.info.phone).to eq '444-444-4444'
448-
expect(auth_hash.info.mobile).to eq '444-444-4444'
445+
it "maps user info according to customized mapping" do
446+
post("/auth/ldap/callback", {username: "ping", password: "password"})
447+
expect(auth_hash.info.phone).to eq "444-444-4444"
448+
expect(auth_hash.info.mobile).to eq "444-444-4444"
449449
end
450450
end
451451
end
@@ -646,7 +646,7 @@ def connection_returning(entry)
646646
header_auth: true,
647647
header_name: "REMOTE_USER",
648648
name_proc: proc { |n| n },
649-
mapping: { "phone" => "mobile" }
649+
mapping: {"phone" => "mobile"}
650650
run lambda { |env| [404, {"Content-Type" => "text/plain"}, [env.key?("omniauth.auth").to_s]] }
651651
end.to_app
652652
end

0 commit comments

Comments
 (0)