-
-
Notifications
You must be signed in to change notification settings - Fork 158
🔧 Set minimum Ruby to v2.0 #97
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -51,16 +51,16 @@ | |
| Use the LDAP strategy as a middleware in your application: | ||
|
|
||
| ```ruby | ||
| use OmniAuth::Strategies::LDAP, | ||
| :title => "My LDAP", | ||
| :host => '10.101.10.1', | ||
| :port => 389, | ||
| :method => :plain, | ||
| :base => 'dc=intridea,dc=com', | ||
| :uid => 'sAMAccountName', | ||
| :name_proc => Proc.new { |name| name.gsub(/@.*$/, '') }, | ||
| :bind_dn => 'default_bind_dn', | ||
| :password => 'password' | ||
| use OmniAuth::Strategies::LDAP, | ||
| title: "My LDAP", | ||
| host: "10.101.10.1", | ||
| port: 389, | ||
| method: :plain, | ||
| base: "dc=intridea,dc=com", | ||
| uid: "sAMAccountName", | ||
| name_proc: proc { |name| name.gsub(/@.*$/, "") }, | ||
| bind_dn: "default_bind_dn", | ||
| password: "password" | ||
| # Or, alternatively: | ||
| # use OmniAuth::Strategies::LDAP, filter: '(&(uid=%{username})(memberOf=cn=myapp-users,ou=groups,dc=example,dc=com))' | ||
| ``` | ||
|
|
@@ -86,11 +86,26 @@ All of the listed options are required, with the exception of `:title`, `:name_p | |
|
|
||
| ### Compatibility | ||
|
|
||
| Compatible with MRI Ruby 0+, and concordant releases of JRuby, and TruffleRuby. | ||
| Compatible with MRI Ruby 2.0+, and concordant releases of JRuby, and TruffleRuby. | ||
|
|
||
| | 🚚 _Amazing_ test matrix was brought to you by | 🔎 appraisal2 🔎 and the color 💚 green 💚 | | ||
| |------------------------------------------------|--------------------------------------------------------| | ||
| | 👟 Check it out! | ✨ [github.com/appraisal-rb/appraisal2][💎appraisal2] ✨ | | ||
|
|
||
| ### Ruby 3.4 | ||
|
|
||
| nkf/kconv has been part of Ruby since long ago. | ||
| Eventually it became a standard gem, but was changed to a bundled gem in Ruby 3.4. | ||
| In general, kconv and iconv have been superseded since Ruby 1.9 by the built-in | ||
| encoding support provided by String#encode, String#force_encoding, and similar methods. | ||
| But this gem has not yet been updated to remove its dependency on nkf/kconv. | ||
|
|
||
| As a result of all this you should add `nkf` to your Gemfile if you are using Ruby 3.4 or later. | ||
|
|
||
| ```ruby | ||
| gem "nkf", "~> 0.1" | ||
| ``` | ||
|
|
||
| ### Enterprise Support [](https://tidelift.com/subscription/pkg/rubygems-omniauth-ldap?utm_source=rubygems-omniauth-ldap&utm_medium=referral&utm_campaign=readme) | ||
|
|
||
| Available as part of the Tidelift Subscription. | ||
|
|
@@ -197,48 +212,48 @@ Below are several concrete examples to get you started. | |
|
|
||
| ```ruby | ||
| # config.ru | ||
| require 'rack' | ||
| require 'omniauth-ldap' | ||
| require "rack" | ||
| require "omniauth-ldap" | ||
|
|
||
| use Rack::Session::Cookie, secret: 'change_me' | ||
| use Rack::Session::Cookie, secret: "change_me" | ||
| use OmniAuth::Builder do | ||
| provider :ldap, | ||
| host: 'ldap.example.com', | ||
| host: "ldap.example.com", | ||
| port: 389, | ||
| method: :plain, | ||
| base: 'dc=example,dc=com', | ||
| uid: 'uid', | ||
| title: 'Example LDAP' | ||
| base: "dc=example,dc=com", | ||
| uid: "uid", | ||
| title: "Example LDAP" | ||
| end | ||
|
|
||
| run lambda { |env| [404, {'Content-Type' => 'text/plain'}, [env.key?('omniauth.auth').to_s]] } | ||
| run lambda { |env| [404, {"Content-Type" => "text/plain"}, [env.key?("omniauth.auth").to_s]] } | ||
| ``` | ||
|
|
||
| Visit `GET /auth/ldap` to initiate authentication (the middleware will render a login form unless you POST to `/auth/ldap`). | ||
|
|
||
| ### Sinatra example | ||
|
|
||
| ```ruby | ||
| require 'sinatra' | ||
| require 'omniauth-ldap' | ||
| require "sinatra" | ||
| require "omniauth-ldap" | ||
|
|
||
| use Rack::Session::Cookie, secret: 'change_me' | ||
| use Rack::Session::Cookie, secret: "change_me" | ||
| use OmniAuth::Builder do | ||
| provider :ldap, | ||
| title: 'Company LDAP', | ||
| host: 'ldap.company.internal', | ||
| base: 'dc=company,dc=local', | ||
| uid: 'sAMAccountName', | ||
| name_proc: proc { |username| username.gsub(/@.*$/, '') } | ||
| title: "Company LDAP", | ||
| host: "ldap.company.internal", | ||
| base: "dc=company,dc=local", | ||
| uid: "sAMAccountName", | ||
| name_proc: proc { |username| username.gsub(/@.*$/, "") } | ||
| end | ||
|
|
||
| get '/' do | ||
| get "/" do | ||
| '<a href="/auth/ldap">Sign in with LDAP</a>' | ||
| end | ||
|
|
||
| get '/auth/ldap/callback' do | ||
| auth = request.env['omniauth.auth'] | ||
| "Hello, #{auth.info['name']}" | ||
| get "/auth/ldap/callback" do | ||
| auth = request.env["omniauth.auth"] | ||
| "Hello, #{auth.info["name"]}" | ||
| end | ||
| ``` | ||
|
|
||
|
|
@@ -247,16 +262,16 @@ end | |
| Create `config/initializers/omniauth.rb`: | ||
|
|
||
| ```ruby | ||
| Rails.application.config.middleware.use OmniAuth::Builder do | ||
| Rails.application.config.middleware.use(OmniAuth::Builder) do | ||
| provider :ldap, | ||
| title: 'Acme LDAP', | ||
| host: 'ldap.acme.internal', | ||
| title: "Acme LDAP", | ||
| host: "ldap.acme.internal", | ||
| port: 389, | ||
| base: 'dc=acme,dc=corp', | ||
| uid: 'uid', | ||
| bind_dn: 'cn=search,dc=acme,dc=corp', | ||
| password: ENV['LDAP_SEARCH_PASSWORD'], | ||
| name_proc: proc { |n| n.split('@').first } | ||
| base: "dc=acme,dc=corp", | ||
| uid: "uid", | ||
| bind_dn: "cn=search,dc=acme,dc=corp", | ||
| password: ENV["LDAP_SEARCH_PASSWORD"], | ||
| name_proc: proc { |n| n.split("@").first } | ||
| end | ||
| ``` | ||
|
|
||
|
|
@@ -268,11 +283,11 @@ If you need to restrict authentication to a group or use a more complex lookup, | |
|
|
||
| ```ruby | ||
| provider :ldap, | ||
| host: 'ldap.example.com', | ||
| base: 'dc=example,dc=com', | ||
| filter: '(&(uid=%{username})(memberOf=cn=myapp-users,ou=groups,dc=example,dc=com))', | ||
| bind_dn: 'cn=search,dc=example,dc=com', | ||
| password: ENV['LDAP_SEARCH_PASSWORD'] | ||
| host: "ldap.example.com", | ||
| base: "dc=example,dc=com", | ||
| filter: "(&(uid=%{username})(memberOf=cn=myapp-users,ou=groups,dc=example,dc=com))", | ||
| bind_dn: "cn=search,dc=example,dc=com", | ||
| password: ENV["LDAP_SEARCH_PASSWORD"] | ||
| ``` | ||
|
|
||
| ### SASL (advanced) | ||
|
|
@@ -281,11 +296,11 @@ SASL enables alternative bind mechanisms. Only enable if you understand the serv | |
|
|
||
| ```ruby | ||
| provider :ldap, | ||
| host: 'ldap.example.com', | ||
| base: 'dc=example,dc=com', | ||
| host: "ldap.example.com", | ||
| base: "dc=example,dc=com", | ||
| try_sasl: true, | ||
| sasl_mechanisms: ['DIGEST-MD5'], | ||
| uid: 'uid' | ||
| sasl_mechanisms: ["DIGEST-MD5"], | ||
| uid: "uid" | ||
| ``` | ||
|
|
||
| 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 | |
|
|
||
| ```ruby | ||
| provider :ldap, | ||
| host: 'ldap.example.com', | ||
| base: 'dc=example,dc=com', | ||
| uid: 'sAMAccountName', | ||
| name_proc: proc { |name| name.gsub(/@.*$/, '') } | ||
| host: "ldap.example.com", | ||
| base: "dc=example,dc=com", | ||
| uid: "sAMAccountName", | ||
| name_proc: proc { |name| name.gsub(/@.*$/, "") } | ||
| ``` | ||
|
|
||
| This trims `[email protected]` to `alice` before searching. | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,6 +2,6 @@ | |
|
|
||
| source "https://gem.coop" | ||
|
|
||
| gemspec :path => "../" | ||
| gemspec path: "../" | ||
|
|
||
| eval_gemfile("modular/x_std_libs.gemfile") | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,2 @@ | ||
| # Ruby >= 3.2 (dependency of kettle-dev) | ||
| gem "erb", :github => "ruby/erb", :branch => "master" | ||
| gem "erb", github: "ruby/erb", branch: "master" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,2 @@ | ||
| # Ruby >= 2.5 (dependency of omniauth) | ||
| gem "logger", :github => "ruby/logger", :branch => "master" | ||
| gem "logger", github: "ruby/logger", branch: "master" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,2 @@ | ||
| # Ruby >= 2.5 (dependency of omniauth) | ||
| gem "mutex_m", :github => "ruby/mutex_m", :branch => "master" | ||
| gem "mutex_m", github: "ruby/mutex_m", branch: "master" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| # frozen_string_literal: true | ||
|
|
||
| # Ruby >= 2.2 | ||
| gem "omniauth", :github => "omniauth/omniauth", :branch => "master" | ||
| gem "omniauth", github: "omniauth/omniauth", branch: "master" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| gem "rack", :github => "rack/rack", :branch => "main" | ||
| gem "rack", github: "rack/rack", branch: "main" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,2 @@ | ||
| # Ruby >= 2.5 (dependency of omniauth) | ||
| gem "stringio", :github => "ruby/stringio", :branch => "master" | ||
| gem "stringio", github: "ruby/stringio", branch: "master" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.