Skip to content

Commit 86a18bc

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

38 files changed

+164
-153
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: 67 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,26 @@ 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+
### Ruby 3.4
96+
97+
nkf/kconv has been part of Ruby since long ago.
98+
Eventually it became a standard gem, but was changed to a bundled gem in Ruby 3.4.
99+
In general, kconv and iconv have been superseded since Ruby 1.9 by the built-in
100+
encoding support provided by String#encode, String#force_encoding, and similar methods.
101+
But this gem has not yet been updated to remove its dependency on nkf/kconv.
102+
103+
As a result of all this you should add `nkf` to your Gemfile if you are using Ruby 3.4 or later.
104+
105+
```ruby
106+
gem "nkf", "~> 0.1"
107+
```
108+
94109
### 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)
95110

96111
Available as part of the Tidelift Subscription.
@@ -197,48 +212,48 @@ Below are several concrete examples to get you started.
197212

198213
```ruby
199214
# config.ru
200-
require 'rack'
201-
require 'omniauth-ldap'
215+
require "rack"
216+
require "omniauth-ldap"
202217

203-
use Rack::Session::Cookie, secret: 'change_me'
218+
use Rack::Session::Cookie, secret: "change_me"
204219
use OmniAuth::Builder do
205220
provider :ldap,
206-
host: 'ldap.example.com',
221+
host: "ldap.example.com",
207222
port: 389,
208223
method: :plain,
209-
base: 'dc=example,dc=com',
210-
uid: 'uid',
211-
title: 'Example LDAP'
224+
base: "dc=example,dc=com",
225+
uid: "uid",
226+
title: "Example LDAP"
212227
end
213228

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

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

219234
### Sinatra example
220235

221236
```ruby
222-
require 'sinatra'
223-
require 'omniauth-ldap'
237+
require "sinatra"
238+
require "omniauth-ldap"
224239

225-
use Rack::Session::Cookie, secret: 'change_me'
240+
use Rack::Session::Cookie, secret: "change_me"
226241
use OmniAuth::Builder do
227242
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(/@.*$/, '') }
243+
title: "Company LDAP",
244+
host: "ldap.company.internal",
245+
base: "dc=company,dc=local",
246+
uid: "sAMAccountName",
247+
name_proc: proc { |username| username.gsub(/@.*$/, "") }
233248
end
234249

235-
get '/' do
250+
get "/" do
236251
'<a href="/auth/ldap">Sign in with LDAP</a>'
237252
end
238253

239-
get '/auth/ldap/callback' do
240-
auth = request.env['omniauth.auth']
241-
"Hello, #{auth.info['name']}"
254+
get "/auth/ldap/callback" do
255+
auth = request.env["omniauth.auth"]
256+
"Hello, #{auth.info["name"]}"
242257
end
243258
```
244259

@@ -247,16 +262,16 @@ end
247262
Create `config/initializers/omniauth.rb`:
248263

249264
```ruby
250-
Rails.application.config.middleware.use OmniAuth::Builder do
265+
Rails.application.config.middleware.use(OmniAuth::Builder) do
251266
provider :ldap,
252-
title: 'Acme LDAP',
253-
host: 'ldap.acme.internal',
267+
title: "Acme LDAP",
268+
host: "ldap.acme.internal",
254269
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 }
270+
base: "dc=acme,dc=corp",
271+
uid: "uid",
272+
bind_dn: "cn=search,dc=acme,dc=corp",
273+
password: ENV["LDAP_SEARCH_PASSWORD"],
274+
name_proc: proc { |n| n.split("@").first }
260275
end
261276
```
262277

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

269284
```ruby
270285
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']
286+
host: "ldap.example.com",
287+
base: "dc=example,dc=com",
288+
filter: "(&(uid=%{username})(memberOf=cn=myapp-users,ou=groups,dc=example,dc=com))",
289+
bind_dn: "cn=search,dc=example,dc=com",
290+
password: ENV["LDAP_SEARCH_PASSWORD"]
276291
```
277292

278293
### SASL (advanced)
@@ -281,11 +296,11 @@ SASL enables alternative bind mechanisms. Only enable if you understand the serv
281296

282297
```ruby
283298
provider :ldap,
284-
host: 'ldap.example.com',
285-
base: 'dc=example,dc=com',
299+
host: "ldap.example.com",
300+
base: "dc=example,dc=com",
286301
try_sasl: true,
287-
sasl_mechanisms: ['DIGEST-MD5'],
288-
uid: 'uid'
302+
sasl_mechanisms: ["DIGEST-MD5"],
303+
uid: "uid"
289304
```
290305

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

297312
```ruby
298313
provider :ldap,
299-
host: 'ldap.example.com',
300-
base: 'dc=example,dc=com',
301-
uid: 'sAMAccountName',
302-
name_proc: proc { |name| name.gsub(/@.*$/, '') }
314+
host: "ldap.example.com",
315+
base: "dc=example,dc=com",
316+
uid: "sAMAccountName",
317+
name_proc: proc { |name| name.gsub(/@.*$/, "") }
303318
```
304319

305320
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)