|
| 1 | +# How to test SAML as a developer without a server |
| 2 | + |
| 3 | +https://capriza.github.io/samling/samling.html (https://github.com/capriza/samling) is a great |
| 4 | +resource for being able to tinker with the SAML options within Synapse without needing to |
| 5 | +deploy and configure a complicated software stack. |
| 6 | + |
| 7 | +To make Synapse (and therefore Riot) use it: |
| 8 | + |
| 9 | +1. Use the samling.html URL above or deploy your own and visit the IdP Metadata tab. |
| 10 | +2. Copy the XML to your clipboard. |
| 11 | +3. On your Synapse server, create a new file `samling.xml` next to your `homeserver.yaml` with |
| 12 | + the XML from step 2 as the contents. |
| 13 | +4. Edit your `homeserver.yaml` to include: |
| 14 | + ```yaml |
| 15 | + saml2_config: |
| 16 | + sp_config: |
| 17 | + allow_unknown_attributes: true # Works around a bug with AVA Hashes: https://github.com/IdentityPython/pysaml2/issues/388 |
| 18 | + metadata: |
| 19 | + local: ["samling.xml"] |
| 20 | + ``` |
| 21 | +5. Run `apt-get install xmlsec1` and `pip install --upgrade --force 'pysaml2>=4.5.0'` to ensure |
| 22 | + the dependencies are installed and ready to go. |
| 23 | +6. Restart Synapse. |
| 24 | + |
| 25 | +Then in Riot: |
| 26 | + |
| 27 | +1. Visit the login page with a Riot pointing at your homeserver. |
| 28 | +2. Click the Single Sign-On button. |
| 29 | +3. On the samling page, enter a Name Identifier and add a SAML Attribute for `uid=your_localpart`. |
| 30 | + The response must also be signed. |
| 31 | +4. Click "Next". |
| 32 | +5. Click "Post Response" (change nothing). |
| 33 | +6. You should be logged in. |
| 34 | + |
| 35 | +If you try and repeat this process, you may be automatically logged in using the information you |
| 36 | +gave previously. To fix this, open your developer console (`F12` or `Ctrl+Shift+I`) while on the |
| 37 | +samling page and clear the site data. In Chrome, this will be a button on the Application tab. |
0 commit comments