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
- How to read attributes depends on your SP software. In most cases it should be trivial.
182
+
- If you use mod_shib (Shibboleth SP), it is not trivial because it discards any unknown attributes. Edit `/etc/shibboleth/attribute-map.xml` and add this:
- If the IdP does not send you the attribute, the process cannot continue.
187
+
This is most likely because the IdP is not configured correctly (andrvotr.allowedConnections, andrvotr.apiKeys).
188
+
189
+
2. Initialize an empty cookie jar. It will be used for all HTTP requests you send.
190
+
191
+
3. Send an HTTP request to the back service URL which initiates the login process.
192
+
Disable automatic HTTP redirect processing in your client library.
193
+
(If the URL is not known, use e.g. browser dev tools to see what happens when you click the login button.)
194
+
195
+
4. Process the response to decide what request should be sent next:
196
+
- If it is a HTTP 3xx redirect, the *next request* will be a GET of that Location header.
197
+
- If it is a pseudo-redirect (an invisible form which is immediately submitted by JavaScript), parse the HTML page.
198
+
The *next request* will be a POST to that form's action with the form's hidden inputs.
199
+
Detecting this case might need some finetuning, but searching forthe string "`document.forms[0].submit()`" works wellin practice.
200
+
- If it is a success page (back service specific), return success.
201
+
- Otherwise, return failure.
202
+
203
+
5. If the *next request* is `GET https://$your_idp/...`, instead set*next request* to `POST https://$your_idp/idp/profile/andrvotr/fabricate` with POST body parameters:
204
+
- `front_entity_id` = the SAML SP entity ID of the front service
205
+
- `api_key` = your Andrvotr API key (must match andrvotr.apiKeys)
206
+
- `andrvotr_authority_token` = token from the SAML attribute
207
+
- `target_url` = the original *next request* URL
208
+
209
+
6. Send the *next request*.
210
+
211
+
7. Go to step 4 to process the response.
212
+
213
+
### Example implementations
214
+
215
+
[demo/demo.py](/demo/demo.py) implements an Andrvotr client in 50 lines of Python.
216
+
It is not integrated with an SP -- you must extract the token and run demo.py manually from the command line.
The demo requires some Python libraries. Either [install "uv"](https://docs.astral.sh/uv/getting-started/installation/) which will take care of it. Or `apt install python3-bs4 python3-requests` and run with `python3 demo.py ...`. Or create a venv with `beautifulsoup4` and `requests`.
223
+
224
+
[Votr](https://github.com/fmfi-svt/votr/blob/master/fladgejt/login.py) contains another implementation of this procedure (also in Python).
0 commit comments