Skip to content

Commit 8aeb00f

Browse files
committed
πŸ”§ Set minimum Ruby to v2.0
- based on dependency "net-ldap", "~> 0.16"
1 parent 87660cf commit 8aeb00f

37 files changed

+148
-150
lines changed

β€Ž.rubocop_gradual.lockβ€Ž

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,24 @@
11
{
2-
"README.md:3434634895": [
3-
[68, 14, 2, "Lint/Syntax: unexpected token tASSOC\n(Using Ruby 2.0 parser; configure using `TargetRubyVersion` parameter, under `AllCops`)", 5859494],
4-
[69, 15, 2, "Lint/Syntax: unexpected token tASSOC\n(Using Ruby 2.0 parser; configure using `TargetRubyVersion` parameter, under `AllCops`)", 5859494]
5-
],
6-
"lib/omniauth-ldap/adaptor.rb:3734330877": [
2+
"lib/omniauth-ldap/adaptor.rb:4086676958": [
73
[36, 7, 413, "Style/ClassMethodsDefinitions: Use `class << self` to define a class method.", 105664470],
84
[86, 17, 3, "Style/AndOr: Use `&&` instead of `and`.", 193409806],
95
[86, 30, 3, "Style/AndOr: Use `&&` instead of `and`.", 193409806],
106
[86, 37, 1, "Lint/AssignmentInCondition: Wrap assignment in parentheses if intentional", 177560]
117
],
12-
"lib/omniauth/strategies/ldap.rb:3702989656": [
8+
"lib/omniauth/strategies/ldap.rb:3246704443": [
139
[48, 9, 53, "Lint/RescueException: Avoid rescuing the `Exception` class. Perhaps you meant to rescue `StandardError`?", 4018396070],
1410
[54, 27, 3, "Style/AndOr: Use `&&` instead of `and`.", 193409806],
1511
[71, 7, 970, "Style/ClassMethodsDefinitions: Use `class << self` to define a class method.", 3995669691]
1612
],
17-
"spec/omniauth-ldap/adaptor_spec.rb:3490841684": [
13+
"spec/omniauth-ldap/adaptor_spec.rb:3624298807": [
1814
[72, 7, 26, "RSpec/StubbedMock: Prefer `allow` over `expect` when configuring a response.", 1924417310],
1915
[73, 7, 26, "RSpec/StubbedMock: Prefer `allow` over `expect` when configuring a response.", 1924417310],
2016
[74, 7, 26, "RSpec/StubbedMock: Prefer `allow` over `expect` when configuring a response.", 1924417310],
2117
[80, 7, 26, "RSpec/StubbedMock: Prefer `allow` over `expect` when configuring a response.", 1924417310],
2218
[81, 7, 26, "RSpec/StubbedMock: Prefer `allow` over `expect` when configuring a response.", 1924417310],
2319
[82, 7, 26, "RSpec/StubbedMock: Prefer `allow` over `expect` when configuring a response.", 1924417310]
2420
],
25-
"spec/omniauth/strategies/ldap_spec.rb:2669791786": [
21+
"spec/omniauth/strategies/ldap_spec.rb:3760791626": [
2622
[13, 3, 54, "RSpec/LeakyConstantDeclaration: Stub class constant instead of declaring explicitly.", 2419068710],
2723
[76, 13, 9, "RSpec/ContextWording: Context description should match /^when\\b/, /^with\\b/, or /^without\\b/.", 1130140517],
2824
[101, 17, 28, "RSpec/ContextWording: Context description should match /^when\\b/, /^with\\b/, or /^without\\b/.", 3444838747],

β€Ž.yard_gfm_support.rbβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,5 @@ def initialize(source, options = {})
1818
# - https://github.com/lsegal/yard/blob/main/lib/yard/templates/helpers/markup_helper.rb
1919
YARD::Templates::Helpers::MarkupHelper::MARKUP_PROVIDERS[:markdown].insert(
2020
0,
21-
{:const => "KramdownGfmDocument"},
21+
{const: "KramdownGfmDocument"},
2222
)

β€ŽGemfile.lockβ€Ž

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -258,8 +258,8 @@ GEM
258258
parallel (~> 1.10)
259259
rainbow (>= 2.2.2, < 4.0)
260260
rubocop (~> 1.0)
261-
rubocop-lts (0.1.1)
262-
rubocop-ruby1_8 (>= 1.0.5, < 2)
261+
rubocop-lts (4.1.1)
262+
rubocop-ruby2_0 (>= 2.0.3, < 3)
263263
standard-rubocop-lts (>= 1.0.3, < 3)
264264
version_gem (>= 1.1.2, < 3)
265265
rubocop-md (1.2.4)
@@ -282,7 +282,7 @@ GEM
282282
rubocop-rspec (3.7.0)
283283
lint_roller (~> 1.1)
284284
rubocop (~> 1.72, >= 1.72.1)
285-
rubocop-ruby1_8 (1.0.7)
285+
rubocop-ruby2_0 (2.0.5)
286286
rubocop-gradual (~> 0.3, >= 0.3.1)
287287
rubocop-md (~> 1.2)
288288
rubocop-rake (~> 0.6)
@@ -399,11 +399,11 @@ DEPENDENCIES
399399
rdoc (~> 6.11)
400400
reek (~> 6.5)
401401
require_bench (~> 1.0, >= 1.0.4)
402-
rubocop-lts (~> 0.1)
402+
rubocop-lts (~> 4.0)
403403
rubocop-on-rbs (~> 1.8)
404404
rubocop-packaging (~> 0.6, >= 0.6.0)
405405
rubocop-rspec (~> 3.6)
406-
rubocop-ruby1_8
406+
rubocop-ruby2_0
407407
ruby-progressbar (~> 1.13)
408408
standard (>= 1.50)
409409
stone_checksums (~> 1.0, >= 1.0.2)

β€ŽGuardfileβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
guard "rspec", :version => 2 do
1+
guard "rspec", version: 2 do
22
watch(%r{^spec/.+_spec\.rb$})
33
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
44
watch("spec/spec_helper.rb") { "spec" }

β€ŽREADME.mdβ€Ž

Lines changed: 54 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -51,16 +51,16 @@
5151
Use the LDAP strategy as a middleware in your application:
5252

5353
```ruby
54-
use OmniAuth::Strategies::LDAP,
55-
:title => "My LDAP",
56-
:host => '10.101.10.1',
57-
:port => 389,
58-
:method => :plain,
59-
:base => 'dc=intridea,dc=com',
60-
:uid => 'sAMAccountName',
61-
:name_proc => Proc.new { |name| name.gsub(/@.*$/, '') },
62-
:bind_dn => 'default_bind_dn',
63-
:password => 'password'
54+
use OmniAuth::Strategies::LDAP,
55+
title: "My LDAP",
56+
host: "10.101.10.1",
57+
port: 389,
58+
method: :plain,
59+
base: "dc=intridea,dc=com",
60+
uid: "sAMAccountName",
61+
name_proc: proc { |name| name.gsub(/@.*$/, "") },
62+
bind_dn: "default_bind_dn",
63+
password: "password"
6464
# Or, alternatively:
6565
# use OmniAuth::Strategies::LDAP, filter: '(&(uid=%{username})(memberOf=cn=myapp-users,ou=groups,dc=example,dc=com))'
6666
```
@@ -86,11 +86,13 @@ All of the listed options are required, with the exception of `:title`, `:name_p
8686

8787
### Compatibility
8888

89-
Compatible with MRI Ruby 0+, and concordant releases of JRuby, and TruffleRuby.
89+
Compatible with MRI Ruby 2.0+, and concordant releases of JRuby, and TruffleRuby.
9090

91+
| 🚚 _Amazing_ test matrix was brought to you by | πŸ”Ž appraisal2 πŸ”Ž and the color πŸ’š green πŸ’š |
9192
|------------------------------------------------|--------------------------------------------------------|
9293
| πŸ‘Ÿ Check it out! | ✨ [github.com/appraisal-rb/appraisal2][πŸ’Žappraisal2] ✨ |
9394

95+
9496
### Enterprise Support [![Tidelift](https://tidelift.com/badges/package/rubygems/omniauth-ldap)](https://tidelift.com/subscription/pkg/rubygems-omniauth-ldap?utm_source=rubygems-omniauth-ldap&utm_medium=referral&utm_campaign=readme)
9597

9698
Available as part of the Tidelift Subscription.
@@ -197,48 +199,48 @@ Below are several concrete examples to get you started.
197199

198200
```ruby
199201
# config.ru
200-
require 'rack'
201-
require 'omniauth-ldap'
202+
require "rack"
203+
require "omniauth-ldap"
202204

203-
use Rack::Session::Cookie, secret: 'change_me'
205+
use Rack::Session::Cookie, secret: "change_me"
204206
use OmniAuth::Builder do
205207
provider :ldap,
206-
host: 'ldap.example.com',
208+
host: "ldap.example.com",
207209
port: 389,
208210
method: :plain,
209-
base: 'dc=example,dc=com',
210-
uid: 'uid',
211-
title: 'Example LDAP'
211+
base: "dc=example,dc=com",
212+
uid: "uid",
213+
title: "Example LDAP"
212214
end
213215

214-
run lambda { |env| [404, {'Content-Type' => 'text/plain'}, [env.key?('omniauth.auth').to_s]] }
216+
run lambda { |env| [404, {"Content-Type" => "text/plain"}, [env.key?("omniauth.auth").to_s]] }
215217
```
216218

217219
Visit `GET /auth/ldap` to initiate authentication (the middleware will render a login form unless you POST to `/auth/ldap`).
218220

219221
### Sinatra example
220222

221223
```ruby
222-
require 'sinatra'
223-
require 'omniauth-ldap'
224+
require "sinatra"
225+
require "omniauth-ldap"
224226

225-
use Rack::Session::Cookie, secret: 'change_me'
227+
use Rack::Session::Cookie, secret: "change_me"
226228
use OmniAuth::Builder do
227229
provider :ldap,
228-
title: 'Company LDAP',
229-
host: 'ldap.company.internal',
230-
base: 'dc=company,dc=local',
231-
uid: 'sAMAccountName',
232-
name_proc: proc { |username| username.gsub(/@.*$/, '') }
230+
title: "Company LDAP",
231+
host: "ldap.company.internal",
232+
base: "dc=company,dc=local",
233+
uid: "sAMAccountName",
234+
name_proc: proc { |username| username.gsub(/@.*$/, "") }
233235
end
234236

235-
get '/' do
237+
get "/" do
236238
'<a href="/auth/ldap">Sign in with LDAP</a>'
237239
end
238240

239-
get '/auth/ldap/callback' do
240-
auth = request.env['omniauth.auth']
241-
"Hello, #{auth.info['name']}"
241+
get "/auth/ldap/callback" do
242+
auth = request.env["omniauth.auth"]
243+
"Hello, #{auth.info["name"]}"
242244
end
243245
```
244246

@@ -247,16 +249,16 @@ end
247249
Create `config/initializers/omniauth.rb`:
248250

249251
```ruby
250-
Rails.application.config.middleware.use OmniAuth::Builder do
252+
Rails.application.config.middleware.use(OmniAuth::Builder) do
251253
provider :ldap,
252-
title: 'Acme LDAP',
253-
host: 'ldap.acme.internal',
254+
title: "Acme LDAP",
255+
host: "ldap.acme.internal",
254256
port: 389,
255-
base: 'dc=acme,dc=corp',
256-
uid: 'uid',
257-
bind_dn: 'cn=search,dc=acme,dc=corp',
258-
password: ENV['LDAP_SEARCH_PASSWORD'],
259-
name_proc: proc { |n| n.split('@').first }
257+
base: "dc=acme,dc=corp",
258+
uid: "uid",
259+
bind_dn: "cn=search,dc=acme,dc=corp",
260+
password: ENV["LDAP_SEARCH_PASSWORD"],
261+
name_proc: proc { |n| n.split("@").first }
260262
end
261263
```
262264

@@ -268,11 +270,11 @@ If you need to restrict authentication to a group or use a more complex lookup,
268270

269271
```ruby
270272
provider :ldap,
271-
host: 'ldap.example.com',
272-
base: 'dc=example,dc=com',
273-
filter: '(&(uid=%{username})(memberOf=cn=myapp-users,ou=groups,dc=example,dc=com))',
274-
bind_dn: 'cn=search,dc=example,dc=com',
275-
password: ENV['LDAP_SEARCH_PASSWORD']
273+
host: "ldap.example.com",
274+
base: "dc=example,dc=com",
275+
filter: "(&(uid=%{username})(memberOf=cn=myapp-users,ou=groups,dc=example,dc=com))",
276+
bind_dn: "cn=search,dc=example,dc=com",
277+
password: ENV["LDAP_SEARCH_PASSWORD"]
276278
```
277279

278280
### SASL (advanced)
@@ -281,11 +283,11 @@ SASL enables alternative bind mechanisms. Only enable if you understand the serv
281283

282284
```ruby
283285
provider :ldap,
284-
host: 'ldap.example.com',
285-
base: 'dc=example,dc=com',
286+
host: "ldap.example.com",
287+
base: "dc=example,dc=com",
286288
try_sasl: true,
287-
sasl_mechanisms: ['DIGEST-MD5'],
288-
uid: 'uid'
289+
sasl_mechanisms: ["DIGEST-MD5"],
290+
uid: "uid"
289291
```
290292

291293
Supported mechanisms include `"DIGEST-MD5"` and `"GSS-SPNEGO"` depending on your environment and gems.
@@ -296,10 +298,10 @@ If users log in with an email but LDAP expects a short username, use `:name_proc
296298

297299
```ruby
298300
provider :ldap,
299-
host: 'ldap.example.com',
300-
base: 'dc=example,dc=com',
301-
uid: 'sAMAccountName',
302-
name_proc: proc { |name| name.gsub(/@.*$/, '') }
301+
host: "ldap.example.com",
302+
base: "dc=example,dc=com",
303+
uid: "sAMAccountName",
304+
name_proc: proc { |name| name.gsub(/@.*$/, "") }
303305
```
304306

305307
This trims `[email protected]` to `alice` before searching.

β€Žgemfiles/audit.gemfileβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22

33
source "https://gem.coop"
44

5-
gemspec :path => "../"
5+
gemspec path: "../"
66

77
eval_gemfile("modular/x_std_libs.gemfile")

β€Žgemfiles/coverage.gemfileβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
source "https://gem.coop"
44

5-
gemspec :path => "../"
5+
gemspec path: "../"
66

77
eval_gemfile("modular/omniauth/r3/v2.1.gemfile")
88

β€Žgemfiles/current.gemfileβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
source "https://gem.coop"
44

5-
gemspec :path => "../"
5+
gemspec path: "../"
66

77
eval_gemfile("modular/omniauth/r3/v2.1.gemfile")
88

β€Žgemfiles/dep_heads.gemfileβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
source "https://gem.coop"
44

5-
gemspec :path => "../"
5+
gemspec path: "../"
66

77
eval_gemfile("modular/omniauth/vHEAD.gemfile")
88

β€Žgemfiles/head.gemfileβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ source "https://gem.coop"
44

55
gem "benchmark", "~> 0.4", ">= 0.4.1"
66

7-
gemspec :path => "../"
7+
gemspec path: "../"
88

99
eval_gemfile("modular/omniauth/vHEAD.gemfile")
1010

0 commit comments

Comments
Β (0)