From 93bd7354c2fdb819bbf5a4c22b3e0ee0787fa8b8 Mon Sep 17 00:00:00 2001 From: Max Dor Date: Fri, 1 Mar 2019 12:42:09 +0100 Subject: [PATCH] Improve Authentication doc --- docs/features/authentication.md | 50 ++++++++++++++++++++++++++++++++- 1 file changed, 49 insertions(+), 1 deletion(-) diff --git a/docs/features/authentication.md b/docs/features/authentication.md index abce66a3..f3d7998b 100644 --- a/docs/features/authentication.md +++ b/docs/features/authentication.md @@ -21,7 +21,7 @@ It allows to use Identity stores configured in mxisd to authenticate users on yo Authentication is divided into two parts: - [Basic](#basic): authenticate with a regular username. -- [Advanced](#advanced): same as basic with extra ability to authenticate using a 3PID. +- [Advanced](#advanced): same as basic with extra abilities like authenticate using a 3PID or do username rewrite. ## Basic Authentication by username is possible by linking synapse and mxisd together using a specific module for synapse, also @@ -145,7 +145,49 @@ Your VirtualHost should now look similar to: ``` +##### nginx + +The specific configuration to add under the relevant `server`: + +```nginx +location /_matrix/client/r0/login { + proxy_pass http://localhost:8090; + proxy_set_header Host $host; + proxy_set_header X-Forwarded-For $remote_addr; +} +``` + +Your `server` section should now look similar to: + +```nginx +server { + listen 443 ssl; + server_name matrix.example.org; + + # ... + + location /_matrix/client/r0/login { + proxy_pass http://localhost:8090; + proxy_set_header Host $host; + proxy_set_header X-Forwarded-For $remote_addr; + } + + location /_matrix/identity { + proxy_pass http://localhost:8090/_matrix/identity; + proxy_set_header Host $host; + proxy_set_header X-Forwarded-For $remote_addr; + } + + location /_matrix { + proxy_pass http://localhost:8008/_matrix; + proxy_set_header Host $host; + proxy_set_header X-Forwarded-For $remote_addr; + } +} +``` + #### DNS Overwrite + Just like you need to configure a reverse proxy to send client requests to mxisd, you also need to configure mxisd with the internal IP of the Homeserver so it can talk to it directly to integrate its directory search. @@ -165,6 +207,12 @@ In case the hostname is the same as your Matrix domain and `server.name` is not `value` is the base internal URL of the Homeserver, without any `/_matrix/..` or trailing `/`. +### Optional features + +The following features are available after you have a working Advanced setup: + +- Username rewrite: Allows you to rewrite the username of a regular login/pass authentication to a 3PID, that then gets resolved using the regular lookup process. Most common use case is to allow login with numerical usernames on synapse, which is not possible out of the box. + #### Username rewrite In mxisd config: ```yaml