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
Copy file name to clipboardExpand all lines: README.md
+23-1Lines changed: 23 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -191,6 +191,25 @@ The following options are available for configuring the OmniAuth LDAP strategy:
191
191
-`:sasl_mechanisms` - Array of SASL mechanisms to use (e.g., ["DIGEST-MD5", "GSS-SPNEGO"]).
192
192
-`:allow_anonymous` - Whether to allow anonymous binding (default: false).
193
193
-`:logger` - A logger instance for debugging (optional, for internal use).
194
+
-`:password_policy` - When true, the strategy will request the LDAP Password Policy response control (OID `1.3.6.1.4.1.42.2.27.8.5.1`) during the user bind. If the server supports it, the adaptor exposes:
195
+
-`adaptor.last_operation_result` — the last Net::LDAP operation result object.
196
+
-`adaptor.last_password_policy_response` — the matching password policy response control (implementation-specific object). This can indicate conditions such as password expired, account locked, reset required, or grace logins remaining (per the draft RFC).
197
+
198
+
Example enabling password policy:
199
+
200
+
```ruby
201
+
use OmniAuth::Builderdo
202
+
provider :ldap,
203
+
host:"ldap.example.com",
204
+
base:"dc=example,dc=com",
205
+
uid:"uid",
206
+
bind_dn:"cn=search,dc=example,dc=com",
207
+
password:ENV["LDAP_SEARCH_PASSWORD"],
208
+
password_policy:true
209
+
end
210
+
```
211
+
212
+
Note: This is best-effort and compatible with a range of net-ldap versions. If your server supports the control, you can inspect the response via the `adaptor` instance during/after authentication (for example in a failure handler) to tailor error messages.
194
213
195
214
### Auth Hash UID vs LDAP :uid (search attribute)
196
215
@@ -453,7 +472,10 @@ Rails.application.config.middleware.use(OmniAuth::Builder) do
0 commit comments