You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
| RubyGems (the [GitHub org][rubygems-org], not the website) [suffered][draper-security] a [hostile takeover][ellen-takeover] in September 2025. |
4
-
| Ultimately [4 maintainers][simi-removed] were [hard removed][martin-removed] and a reason has been given for only 1 of those, while 2 others resigned in protest. |
5
4
| It is a [complicated story][draper-takeover] which is difficult to [parse quickly][draper-lies]. |
6
5
| I'm adding notes like this to gems because I [don't condone theft][draper-theft] of repositories or gems from their rightful owners. |
7
6
| If a similar theft happened with my repos/gems, I'd hope some would stand up for me. |
`if ci_badges.map(&:color).detect { it != "green"}` ☝️ [let me know][🖼️galtzo-discord], as I may have missed the [discord notification][🖼️galtzo-discord].
44
42
@@ -54,19 +52,17 @@ Use the LDAP strategy as a middleware in your application:
-`:uid` or `:filter` - Either `:uid` (the LDAP attribute for username, default: "sAMAccountName") or `:filter` (LDAP filter for searching user entries). If `:filter` is provided, `:uid` is not required.
177
+
178
+
### Optional Options
179
+
180
+
-`:title` - The title for the authentication form (default: "LDAP Authentication").
181
+
-`:bind_dn` - The DN to bind with for searching users (required if anonymous access is not allowed).
182
+
-`:password` - The password for the bind DN.
183
+
-`:name_proc` - A proc to process the username before using it in the search (default: identity proc that returns the username unchanged).
184
+
-`:try_sasl` - Whether to use SASL authentication (default: false).
185
+
-`:sasl_mechanisms` - Array of SASL mechanisms to use (e.g., ["DIGEST-MD5", "GSS-SPNEGO"]).
186
+
-`:allow_anonymous` - Whether to allow anonymous binding (default: false).
187
+
-`:logger` - A logger instance for debugging (optional, for internal use).
174
188
175
189
## 🔧 Basic Usage
176
190
177
-
Allowed values of `:method` are: `:plain`, `:ssl`, `:tls`.
191
+
The strategy exposes a simple Rack middleware and can be used in plain Rack apps, Sinatra, or Rails.
192
+
Direct users to `/auth/ldap` to start authentication and handle the callback at `/auth/ldap/callback`.
193
+
194
+
Below are several concrete examples to get you started.
195
+
196
+
### Minimal Rack setup
197
+
198
+
```ruby
199
+
# config.ru
200
+
require'rack'
201
+
require'omniauth-ldap'
202
+
203
+
use Rack::Session::Cookie, secret:'change_me'
204
+
use OmniAuth::Builderdo
205
+
provider :ldap,
206
+
host:'ldap.example.com',
207
+
port:389,
208
+
method::plain,
209
+
base:'dc=example,dc=com',
210
+
uid:'uid',
211
+
title:'Example LDAP'
212
+
end
213
+
214
+
run lambda { |env| [404, {'Content-Type' => 'text/plain'}, [env.key?('omniauth.auth').to_s]] }
215
+
```
216
+
217
+
Visit `GET /auth/ldap` to initiate authentication (the middleware will render a login form unless you POST to `/auth/ldap`).
Then link users to `/auth/ldap` in your app (for example, in a Devise sign-in page).
264
+
265
+
### Using a custom filter
186
266
187
-
`:uid` is the LDAP attribute name for the username in the login form.
188
-
typically AD would be 'sAMAccountName' or 'UserPrincipalName', while OpenLDAP is 'uid'.
267
+
If you need to restrict authentication to a group or use a more complex lookup, pass `:filter`. Use `%{username}` — it will be replaced with the processed username (after `:name_proc`).
189
268
190
-
`:filter` is the LDAP filter used to search the user entry. It can be used in place of :uid for more flexibility.
191
-
`%{username}` will be replaced by the username processed by `:name_proc`.
0 commit comments