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
+47-4Lines changed: 47 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -333,10 +333,53 @@ Then link users to `/auth/ldap` in your app (for example, in a Devise sign-in pa
333
333
334
334
This gem is compatible with JSON-encoded POST bodies as well as traditional form-encoded.
335
335
336
-
Set header `Content-Type` to `application/json`
336
+
- Set header `Content-Type` to `application/json`.
337
+
- Send a JSON object containing `username` and `password`.
338
+
- Rails automatically exposes parsed JSON params via `env["action_dispatch.request.request_parameters"]`, which this strategy reads first. In non-Rails Rack apps, ensure you use a JSON parser middleware if you post raw JSON.
337
339
338
-
Send your credentials similar to below to use this gem:
339
-
`{"username":"USERNAME","password":"PASSWORD"}`
340
+
Examples
341
+
342
+
- curl (JSON):
343
+
344
+
```bash
345
+
curl -i \
346
+
-X POST \
347
+
-H 'Content-Type: application/json' \
348
+
-d '{"username":"alice","password":"secret"}' \
349
+
http://localhost:3000/auth/ldap
350
+
```
351
+
352
+
The request phase will redirect to `/auth/ldap/callback` when both fields are present.
window.location=res.url; // typically /auth/ldap/callback
375
+
}
376
+
});
377
+
```
378
+
379
+
Notes
380
+
381
+
- You can still initiate authentication by visiting `GET /auth/ldap` to render the HTML form and then submitting it (form-encoded). JSON is an additional option, not a replacement.
382
+
- In the callback phase (`POST /auth/ldap/callback`), the strategy reads JSON credentials the same way; Rails exposes them via `action_dispatch.request.request_parameters` and non-Rails apps should use a JSON parser middleware.
340
383
341
384
### Using a custom filter
342
385
@@ -736,7 +779,7 @@ Please consider sponsoring me or the project.
736
779
737
780
To join the community or get help 👇️ Join the Discord.
738
781
739
-
[![Live Chat on Discord][✉️discord-invite-img-ftb]][✉️discord-invite]
782
+
[![Live Chat on Discord][✉️discord-invite-img-ftb]][✉️discord]
740
783
741
784
To say "thanks!" ☝️ Join the Discord or 👇️ send money.
0 commit comments