Skip to content

Commit f6d8f13

Browse files
committed
docs: add longer introduction and a diagram
1 parent a588a0d commit f6d8f13

File tree

1 file changed

+36
-7
lines changed

1 file changed

+36
-7
lines changed

README.md

Lines changed: 36 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
1-
# Andrvotr: service delegation plugin for Shibboleth IdP
1+
# Andrvotr
22

3-
Andrvotr allows one service to sign in to another service on behalf of the user.
3+
Andrvotr is a service delegation plugin for Shibboleth IdP (Identity Provider). It allows one service to sign in to another service on behalf of the user.
44

55
The IdP administrator can define pairs of "front services" and "back services". When any *user* **U** signs in to a given *front service* **F**, the server of **F** can ask the IdP to sign in to its *back service* **B** on behalf of **U**, and send authenticated HTTP requests to the server of **B** in the name of **U**.
66

7+
Andrvotr is similar to OAuth in that both allow one service to authenticate on behalf of a user to another service. The IdP is analogous to the OAuth authorization server, the front service is like the OAuth client, and the back service acts as the OAuth resource server.
8+
9+
The defining feature of Andrvotr is that the back service can be a normal SAML SP (Service Provider), and does not need to be aware of the protocol. This is useful if the back service only supports basic SAML and cannot be modified. But in circumstances where it's possible to replace the sign in system, it is recommended to use OAuth instead of Andrvotr and SAML.
10+
11+
Andrvotr is used in production at [Comenius University](https://uniba.sk/en/) to power [Votr](https://github.com/fmfi-svt/votr), [Anketa](https://github.com/fmfi-svt/anketa) and [ePrihlaska](https://github.com/fmfi-svt/eprihlaska).
12+
713
## Deployment requirements (limitations)
814

915
This is a list of facts that Andrvotr requires from its environment. They must be satisfied in order to successfully deploy and use Andrvotr.
@@ -30,18 +36,40 @@ This is a list of design requirements that Andrvotr meets. In contrast to the li
3036

3137
## How it works
3238

39+
```mermaid
40+
sequenceDiagram
41+
participant U as User+Browser
42+
participant IdP
43+
participant F as Front service
44+
participant B as Back service
45+
note over U, F: Normal SAML SSO flow:
46+
U->>F: POST /ClickLoginButton
47+
F->>U: 303 to https://IdP/.../SSO<br>with SAML request
48+
U->>IdP: ;
49+
U<<->>IdP: user enters credentials<br>or reuses older IdP session
50+
IdP->>U: 200 OK with POST to https://F/.../ACS<br>with SAML response to F's request<br>with Andrvotr Authority Token
51+
U->>F: ;
52+
F->>U: 200 OK with a session cookie
53+
note over IdP, B: Andrvotr SSO flow:
54+
F->>B: POST /ClickLoginButton
55+
B->>F: 303 to https://IdP/.../SSO<br>with SAML request
56+
F->>IdP: POST /.../andrvotr/fabricate<br>with original SSO url,<br>Andrvotr Authority Token,<br>front SP ID, API key
57+
IdP->>IdP: GET /.../SSO<br>(internal nested request)
58+
IdP->>F: 200 OK with POST to https://B/.../ACS<br>with SAML response to B's request
59+
F->>B: ;
60+
B->>F: 200 OK with a session cookie
61+
```
62+
3363
The front service receives an "Andrvotr Authority Token" from the IdP as a SAML attribute inside its SAML assertion. The token is essentially an encrypted tuple of (front service entity ID, user's IdP session cookies, expiration timestamp). It identifies a specific user accessing a specific front service at a specific point in time. It can be used to exchange SAML requests for SAML responses.
3464

35-
The front service then sends a login request to the back service, thus starting a normal SP-initiated SAML web flow. It follows redirects and maintains a cookie jar like real browsers. The back service responds with a HTTP redirect containing an encoded SAML request. This redirect would normally lead to the IdP's sign in form page.
65+
The front service then sends a login request to the back service, thus starting a SP-initiated SAML web flow. It follows redirects and maintains a cookie jar like real browsers. The back service responds with a HTTP redirect containing an encoded SAML request. This redirect would normally lead to the IdP's sign in form page.
3666

3767
Instead of following this redirect, the front service sends a special request to the IdP, asking Andrvotr to generate an artificial SAML response for this SAML request and Andrvotr Authority Token. If the request is valid and this front to back service connection is allowed, Andrvotr returns a SAML response. This is implemented with a nested request from the IdP to itself. The SAML response is just like what it would be if this user would sign into the back service directly.
3868

3969
The front service forwards this SAML response to the back service, receiving a session cookie and completing the sign in.
4070

4171
The key benefit of this design is that it requires zero changes to the back service, which just sees normal SAML flow. The cost is a moderate amount of front service complexity. If this is not a requirement you have, Andrvotr might not be the right solution for you.
4272

43-
<!-- TODO: Add a diagram. -->
44-
4573
## IdP setup
4674

4775
1. Look up the latest plugin version on the [Releases page](https://github.com/fmfi-svt/andrvotr/releases).
@@ -161,6 +189,8 @@ The key benefit of this design is that it requires zero changes to the back serv
161189
sudo -u {USER} /opt/shibboleth-idp/bin/plugin.sh -i $PWD/andrvotr-dist/target/idp-plugin-andrvotr-*-SNAPSHOT.tar.gz --noCheck
162190
```
163191

192+
For more information about developing and testing the plugin with a local IdP, see https://github.com/fmfi-svt/saml-shibboleth-guide.
193+
164194
## Developing front services
165195

166196
Front services which want to use Andrvotr to connect to a back service must follow this procedure.
@@ -185,6 +215,7 @@ You will need:
185215
```
186216
- If the IdP does not send you the attribute, the process cannot continue.
187217
This is most likely because the IdP is not configured correctly (andrvotr.allowedConnections, andrvotr.apiKeys).
218+
Or it can happen if the IdP is configured to ask for attribute consent, and the user did not give it.
188219

189220
2. Initialize an empty cookie jar. It will be used for all HTTP requests you send.
190221

@@ -222,5 +253,3 @@ It is not integrated with an SP -- you must extract the token and run demo.py ma
222253
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`.
223254

224255
[Votr](https://github.com/fmfi-svt/votr/blob/master/fladgejt/login.py) contains another implementation of this procedure (also in Python).
225-
226-
<!-- TODO: ## Similar projects -->

0 commit comments

Comments
 (0)