Skip to content

Commit e0f6d9d

Browse files
Merge pull request #377 from IdentityPython/msdocs
Documentation for recently added micro-services
2 parents ad1efcb + 104aa87 commit e0f6d9d

File tree

1 file changed

+70
-26
lines changed

1 file changed

+70
-26
lines changed

doc/README.md

Lines changed: 70 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -5,30 +5,33 @@ This document describes how to install and configure the SATOSA proxy.
55
# Installation
66

77
## <a name="docker" style="color:#000000">Docker</a>
8+
89
A pre-built Docker image is accessible at the [Docker Hub](https://hub.docker.com/r/satosa/), and is the
910
recommended ways of running the proxy.
1011

1112
## <a name="manual_installation" style="color:#000000">Manual installation</a>
1213

1314
### <a name="dependencies" style="color:#000000">Dependencies</a>
15+
1416
SATOSA requires Python 3.4 (or above), and the following packages on Ubuntu:
15-
```
17+
18+
```bash
1619
apt-get install libffi-dev libssl-dev xmlsec1
1720
````
1821

1922
### <a name="install_instructions" style="color:#000000">Instructions</a>
23+
2024
1. Download the SATOSA proxy project as a [compressed archive](https://github.com/IdentityPython/SATOSA/releases)
2125
and unpack it to `<satosa_path>`.
2226

23-
1. Install the application:
27+
2. Install the application:
2428

2529
```bash
2630
pip install <satosa_path>
2731
```
2832

2933
Alternatively the application can be installed directly from PyPI (`pip install satosa`), or the [Docker image](https://hub.docker.com/r/satosa/) can be used.
3034

31-
3235
### <a name="install_external" style="color:#000000">External micro-services</a>
3336

3437
Micro-services act like plugins and can be developed by anyone. Other people
@@ -53,8 +56,8 @@ The extentions include:
5356

5457
and more.
5558

56-
5759
# Configuration
60+
5861
SATOSA is configured using YAML.
5962

6063
All default configuration files, as well as an example WSGI application for the proxy, can be found
@@ -74,7 +77,7 @@ the value from the process environment variable of the same name. If the
7477
process environment has been set with `LDAP_BIND_PASSWORD=secret_password` then
7578
the configuration value for `bind_password` will be `secret_password`.
7679

77-
```
80+
```yaml
7881
bind_password: !ENV LDAP_BIND_PASSWORD
7982
```
8083

@@ -90,12 +93,12 @@ process environment has been set with
9093
`LDAP_BIND_PASSWORD_FILE=/etc/satosa/secrets/ldap.txt` then the configuration
9194
value for `bind_password` will be `secret_password`.
9295

93-
```
96+
```yaml
9497
bind_password: !ENVFILE LDAP_BIND_PASSWORD_FILE
9598
```
9699

97-
98100
## <a name="proxy_conf" style="color:#000000">SATOSA proxy configuration</a>: `proxy_conf.yaml.example`
101+
99102
| Parameter name | Data type | Example value | Description |
100103
| -------------- | --------- | ------------- | ----------- |
101104
| `BASE` | string | `https://proxy.example.com` | base url of the proxy |
@@ -109,10 +112,10 @@ bind_password: !ENVFILE LDAP_BIND_PASSWORD_FILE
109112
| `MICRO_SERVICES` | string[] | `[statistics_service.yaml]` | list of plugin configuration file paths, describing enabled microservices |
110113
| `LOGGING` | dict | see [Python logging.conf](https://docs.python.org/3/library/logging.config.html) | optional configuration of application logging |
111114

112-
113115
## <a name="attr_map" style="color:#000000">Attribute mapping configuration:</a> `internal_attributes.yaml`
114116

115117
### attributes
118+
116119
The values directly under the `attributes` key are the internal attribute names.
117120
Every internal attribute has a map of profiles, which in turn has a list of
118121
external attributes names which should be mapped to the internal attributes.
@@ -124,14 +127,15 @@ internal attribute.
124127
Sometimes the external attributes are nested/complex structures. One example is
125128
the [address claim in OpenID connect](http://openid.net/specs/openid-connect-core-1_0.html#AddressClaim)
126129
which consists of multiple sub-fields, e.g.:
130+
127131
```json
128132
"address": {
129133
"formatted": "100 Universal City Plaza, Hollywood CA 91608, USA",
130134
"street_address": "100 Universal City Plaza",
131135
"locality": "Hollywood",
132136
"region": "CA",
133137
"postal_code": "91608",
134-
"country": "USA",
138+
"country": "USA"
135139
}
136140
```
137141

@@ -166,28 +170,29 @@ attributes (in the proxy backend) <-> internal <-> returned attributes (from the
166170
* Any plugin using the `saml` profile will use the attribute value from `postaladdress`
167171
delivered from the target provider as the value for `address`.
168172

169-
170173
### user_id_from_attrs
174+
171175
The subject identifier generated by the backend module can be overridden by
172176
specifying a list of internal attribute names under the `user_id_from_attrs` key.
173177
The attribute values of the attributes specified in this list will be
174178
concatenated and used as the subject identifier.
175179

176-
177180
### user_id_to_attr
181+
178182
To store the subject identifier in a specific internal attribute, the internal
179183
attribute name can be specified in `user_id_to_attr`.
180184
When the [ALService](https://github.com/its-dirg/ALservice) is used for account
181185
linking, the `user_id_to_attr` configuration parameter should be set, since that
182186
service will overwrite the subject identifier generated by the proxy.
183187

184-
185188
## Plugins
189+
186190
The authentication protocol specific communication is handled by different plugins,
187191
divided into frontends (receiving requests from clients) and backends (sending requests
188192
to target providers).
189193

190194
### Common plugin configuration parameters
195+
191196
Both `name` and `module` must be specified in all plugin configurations (frontends, backends, and micro services).
192197
The `name` must be unique to ensure correct functionality, and the `module` must be the fully qualified name of an
193198
importable Python module.
@@ -230,7 +235,6 @@ For more detailed information on how you could customize the SAML entities,
230235
see the
231236
[documentation of the underlying library pysaml2](https://github.com/rohe/pysaml2/blob/master/docs/howto/config.rst).
232237

233-
234238
#### Providing `AuthnContextClassRef`
235239

236240
SAML2 frontends and backends can provide a custom (configurable) *Authentication Context Class Reference*.
@@ -252,12 +256,13 @@ provider will be preserved, and when using a OAuth or OpenID Connect backend, th
252256

253257
**Example**
254258

255-
config:
256-
[...]
257-
acr_mapping:
258-
"": default-LoA
259-
"https://accounts.google.com": LoA1
260-
259+
```yaml
260+
config:
261+
[...]
262+
acr_mapping:
263+
"": default-LoA
264+
"https://accounts.google.com": LoA1
265+
```
261266

262267
#### <a name="saml_frontend" style="color:#000000">Frontend</a>
263268

@@ -296,8 +301,8 @@ An example configuration can be found [here](../example/plugins/frontends/saml2_
296301
297302
`SP -> Virtual CO SAMLFrontend -> SAMLBackend -> optional discovery service -> target IdP`
298303
299-
300304
##### Custom attribute release
305+
301306
In addition to respecting for example entity categories from the SAML metadata, the SAML frontend can also further
302307
restrict the attribute release with the `custom_attribute_release` configuration parameter based on the SP entity id.
303308
@@ -349,13 +354,14 @@ Overrides per SP entityID is possible by using the entityID as a key instead of
349354
in the yaml structure. The most specific key takes presedence. If no policy overrides are provided
350355
the defaults above are used.
351356
352-
353357
#### <a name="saml_backend" style="color:#000000">Backend</a>
358+
354359
The SAML2 backend act as a SAML Service Provider (SP), making authentication
355360
requests to SAML Identity Providers (IdP). The default configuration file can be
356361
found [here](../example/plugins/backends/saml2_backend.yaml.example).
357362
358363
##### <a name="name_id" style="color:#000000">Name ID Format</a>
364+
359365
The SAML backend can indicate which *Name ID* format it wants by specifying the key
360366
`name_id_format` in the SP entity configuration in the backend plugin configuration:
361367
@@ -368,6 +374,7 @@ The SAML backend can indicate which *Name ID* format it wants by specifying the
368374
```
369375
370376
##### Use a discovery service
377+
371378
To allow the user to choose which target provider they want to authenticate with, the configuration
372379
parameter `disco_srv`, must be specified if the metadata given to the backend module contains more than one IdP:
373380
@@ -433,6 +440,7 @@ config:
433440
### <a name="openid_plugin" style="color:#000000">OpenID Connect plugins</a>
434441
435442
#### <a name="openid_backend" style="color:#000000">Backend</a>
443+
436444
The OpenID Connect backend acts as an OpenID Connect Relying Party (RP), making
437445
authentication requests to OpenID Connect Provider (OP). The default
438446
configuration file can be found [here](../example/plugins/backends/openid_backend.yaml.example).
@@ -444,8 +452,8 @@ When using an OP that only supports statically registered clients, see the
444452
and make sure to provide the redirect URI, constructed as described in the
445453
section about Google configuration below, in the static registration.
446454
447-
448455
#### <a name="openid_frontend" style="color:#000000">Frontend</a>
456+
449457
The OpenID Connect frontend acts as and OpenID Connect Provider (OP), accepting requests from OpenID
450458
Connect Relying Parties (RPs). The default configuration file can be found
451459
[here](../example/plugins/frontends/openid_connect_frontend.yaml.example).
@@ -477,10 +485,12 @@ The configuration parameters available:
477485
The other parameters should be left with their default values.
478486
479487
### <a name="social_plugins" style="color:#000000">Social login plugins</a>
488+
480489
The social login plugins can be used as backends for the proxy, allowing the
481490
proxy to act as a client to the social login services.
482491
483492
#### Google
493+
484494
The default configuration file can be
485495
found [here](../example/plugins/backends/google_backend.yaml.example).
486496
@@ -495,7 +505,7 @@ It should use the available variables, `<base_url>` and `<name>`, where:
495505
496506
1. `<base_url>` is the base url of the proxy as specified in the `BASE` configuration parameter
497507
in `proxy_conf.yaml`, e.g. "https://proxy.example.com".
498-
1. `<name>` is the plugin name specified in the `name` configuration parameter defined in the plugin configuration file.
508+
2. `<name>` is the plugin name specified in the `name` configuration parameter defined in the plugin configuration file.
499509
500510
The example config in `google_backend.yaml.example`:
501511
@@ -507,14 +517,15 @@ config:
507517
redirect_uris: [<base_url>/<name>]
508518
[...]
509519
```
520+
510521
together with `BASE: "https://proxy.example.com"` in `proxy_conf.yaml` would
511522
yield the redirect URI `https://proxy.example.com/google` to register with Google.
512523
513524
A list of all claims possibly released by Google can be found [here](https://developers.google.com/identity/protocols/OpenIDConnect#obtainuserinfo),
514525
which should be used when configuring the attribute mapping (see above).
515526
516-
517527
#### Facebook
528+
518529
The default configuration file can be
519530
found [here](../example/plugins/backends/facebook_backend.yaml.example).
520531
@@ -549,7 +560,7 @@ pre-configured (static) attributes, see the
549560
550561
The static attributes are described as key-value pairs in the YAML file, e.g:
551562
552-
```
563+
```yaml
553564
organisation: Example Org.
554565
country: Sweden
555566
```
@@ -574,15 +585,18 @@ The filters are applied such that all attribute values matched by the regular ex
574585
non-matching attribute values will be discarded.
575586
576587
##### Examples
588+
577589
Filter attributes from the target provider `https://provider.example.com`, to only preserve values starting with the
578590
string `"foo:bar"`:
591+
579592
```yaml
580593
"https://provider.example.com":
581594
"":
582595
"": "^foo:bar"
583596
```
584597
585598
Filter the attribute `attr1` to only preserve values ending with the string `"foo:bar"`:
599+
586600
```yaml
587601
"":
588602
"":
@@ -591,6 +605,7 @@ Filter the attribute `attr1` to only preserve values ending with the string `"fo
591605
592606
Filter the attribute `attr1` to the requester `https://provider.example.com`, to only preserver values containing
593607
the string `"foo:bar"`:
608+
594609
```yaml
595610
"":
596611
"https://client.example.com":
@@ -601,6 +616,7 @@ the string `"foo:bar"`:
601616
602617
Attributes delivered from the target provider can be filtered based on a list of allowed attributes per requester
603618
using the `AttributePolicy` class:
619+
604620
```yaml
605621
attribute_policy:
606622
<requester>:
@@ -610,11 +626,25 @@ attribute_policy:
610626
```
611627
612628
#### Route to a specific backend based on the requester
629+
613630
To choose which backend (essentially choosing target provider) to use based on the requester, use the
614631
`DecideBackendByRequester` class which implements that special routing behavior. See the
615632
[example configuration](../example/plugins/microservices/requester_based_routing.yaml.example).
616633
634+
#### Route to a specific backend based on the target entity id
635+
636+
Use the `DecideBackendByTargetIssuer` class which implements that special routing behavior. See the
637+
[example configuration](../example/plugins/microservices/target_based_routing.yaml.example).
638+
639+
#### Route to a specific backend based on the discovery service response
640+
641+
If a Discovery Service is in use and a target entity id is selected by users, you may want to use the
642+
`DiscoToTargetIssuer` class together with `DecideBackendByTargetIssuer` to be able to select a
643+
backend (essentially choosing target provider) based on the response from the discovery service.
644+
See the [example configuration](../example/plugins/microservices/disco_to_target_issuer.yaml.example).
645+
617646
#### Filter authentication requests to target SAML entities
647+
618648
If using the `SAMLMirrorFrontend` module and some of the target providers should support some additional SP's, the
619649
`DecideIfRequesterIsAllowed` micro service can be used. It provides a rules mechanism to describe which SP's are
620650
allowed to send requests to which IdP's. See the [example configuration](../example/plugins/microservices/allowed_requesters.yaml.example).
@@ -625,6 +655,7 @@ Metadata containing all SP's (any SP that might be allowed by a target IdP) must
625655
The rules are described using `allow` and `deny` directives under the `rules` configuration parameter.
626656
627657
In the following example, the target IdP `target_entity_id1` only allows requests from `requester1` and `requester2`.
658+
628659
```yaml
629660
rules:
630661
target_entity_id1:
@@ -635,6 +666,7 @@ SP's are by default denied if the IdP has any rules associated with it (i.e, the
635666
However, if the IdP does not have any rules associated with its entity id, all SP's are by default allowed.
636667
637668
Deny all but one SP:
669+
638670
```yaml
639671
rules:
640672
target_entity_id1:
@@ -643,6 +675,7 @@ rules:
643675
```
644676
645677
Allow all but one SP:
678+
646679
```yaml
647680
rules:
648681
target_entity_id1:
@@ -679,6 +712,16 @@ persistent NameID may also be obtained from attributes returned from the LDAP di
679712
LDAP microservice install the extra necessary dependencies with `pip install satosa[ldap]` and then see the
680713
[example config](../example/plugins/microservices/ldap_attribute_store.yaml.example).
681714
715+
#### Support for IdP Hinting
716+
717+
It's possible to hint an IdP to SaToSa using the `IdpHinting` micro-service.
718+
719+
With this feature an SP can send a hint about the IdP that should be used, in order to skip the discovery service.
720+
The hint as a parameter in the query string of the request.
721+
The hint query parameter value must be the entityID of the IdP.
722+
The hint query parameter name is specified in the micro-service configuation.
723+
See the [example configuration](../example/plugins/microservices/idp_hinting.yaml.example).
724+
682725
### Custom plugins
683726
684727
It's possible to write custom plugins which can be loaded by SATOSA. They have to be contained in a Python module,
@@ -716,9 +759,11 @@ full featured general purpose web server (in a reverse proxy architecture) such
716759
Apache HTTP Server to help buffer slow clients and enable more sophisticated error page rendering.
717760
718761
Start the proxy server with the following command:
762+
719763
```bash
720764
gunicorn -b<socket address> satosa.wsgi:app --keyfile=<https key> --certfile=<https cert>
721765
```
766+
722767
where
723768
* `socket address` is the socket address that `gunicorn` should bind to for incoming requests, e.g. `0.0.0.0:8080`
724769
* `https key` is the path to the private key to use for HTTPS, e.g. `pki/key.pem`
@@ -734,4 +779,3 @@ set SATOSA_CONFIG=/home/user/proxy_conf.yaml
734779
## Using Apache HTTP Server and mod\_wsgi
735780
736781
See the [auxiliary documentation for running using mod\_wsgi](mod_wsgi.md).
737-

0 commit comments

Comments
 (0)