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
+36-7Lines changed: 36 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,9 +1,15 @@
1
-
# Andrvotr: service delegation plugin for Shibboleth IdP
1
+
# Andrvotr
2
2
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.
4
4
5
5
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**.
6
6
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
+
7
13
## Deployment requirements (limitations)
8
14
9
15
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
30
36
31
37
## How it works
32
38
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
+
33
63
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.
34
64
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.
36
66
37
67
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.
38
68
39
69
The front service forwards this SAML response to the back service, receiving a session cookie and completing the sign in.
40
70
41
71
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.
42
72
43
-
<!-- TODO: Add a diagram. -->
44
-
45
73
## IdP setup
46
74
47
75
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
For more information about developing and testing the plugin with a local IdP, see https://github.com/fmfi-svt/saml-shibboleth-guide.
193
+
164
194
## Developing front services
165
195
166
196
Front services which want to use Andrvotr to connect to a back service must follow this procedure.
@@ -185,6 +215,7 @@ You will need:
185
215
```
186
216
- If the IdP does not send you the attribute, the process cannot continue.
187
217
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.
188
219
189
220
2. Initialize an empty cookie jar. It will be used for all HTTP requests you send.
190
221
@@ -222,5 +253,3 @@ It is not integrated with an SP -- you must extract the token and run demo.py ma
222
253
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
254
224
255
[Votr](https://github.com/fmfi-svt/votr/blob/master/fladgejt/login.py) contains another implementation of this procedure (also in Python).
0 commit comments