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
+44Lines changed: 44 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -81,6 +81,50 @@ use OmniAuth::Strategies::LDAP,
81
81
82
82
All of the listed options are required, with the exception of `:title`, `:name_proc`, `:bind_dn`, and `:password`.
83
83
84
+
## TLS certificate verification
85
+
86
+
This gem enables TLS certificate verification by default when you use `encryption: "ssl"` (LDAPS / simple TLS) or `encryption: "tls"` (STARTTLS). We always pass `tls_options` to Net::LDAP based on `OpenSSL::SSL::SSLContext::DEFAULT_PARAMS`, which includes `verify_mode: OpenSSL::SSL::VERIFY_PEER` and sane defaults.
87
+
88
+
- Secure by default: you do not need to set anything extra to verify the LDAP server certificate.
89
+
- To customize trust or ciphers, supply your own `tls_options`, which are merged over the safe defaults.
90
+
- If you truly need to skip verification (not recommended), set `disable_verify_certificates: true`.
91
+
92
+
Examples:
93
+
94
+
```ruby
95
+
# Verify server certs (default behavior)
96
+
use OmniAuth::Strategies::LDAP,
97
+
host:ENV["LDAP_HOST"],
98
+
port:636,
99
+
encryption:"ssl", # or "tls"
100
+
base:"dc=example,dc=com",
101
+
uid:"uid"
102
+
103
+
# Use a private CA bundle and restrict protocol/ciphers
# Opt out of verification (NOT recommended – use only in trusted test/dev scenarios)
117
+
use OmniAuth::Strategies::LDAP,
118
+
host:ENV["LDAP_HOST"],
119
+
port:636,
120
+
encryption:"ssl",
121
+
base:"dc=example,dc=com",
122
+
uid:"uid",
123
+
disable_verify_certificates:true
124
+
```
125
+
126
+
Note: Net::LDAP historically defaulted to no certificate validation when `tls_options` were not provided. This library mitigates that by always providing secure `tls_options` unless you explicitly disable verification.
127
+
84
128
## 💡 Info you can shake a stick at
85
129
86
130
| Tokens to Remember |[![Gem name][⛳️name-img]][⛳️gem-name][![Gem namespace][⛳️namespace-img]][⛳️gem-namespace]|
0 commit comments