Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

Commit 16e1a9d

Browse files
peterscheu-aceartDavid Robertson
and
David Robertson
authored
Correct documentation for map_user_attributes of OpenID Mapping Providers (#13836)
Co-authored-by: David Robertson <davidr@element.io>
1 parent e0804ef commit 16e1a9d

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

changelog.d/13836.doc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix a mistake in sso_mapping_providers.md: `map_user_attributes` is expected to return `display_name` not `displayname`.

docs/sso_mapping_providers.md

+9-3
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ A custom mapping provider must specify the following methods:
7373
* `async def map_user_attributes(self, userinfo, token, failures)`
7474
- This method must be async.
7575
- Arguments:
76-
- `userinfo` - A `authlib.oidc.core.claims.UserInfo` object to extract user
77-
information from.
76+
- `userinfo` - An [`authlib.oidc.core.claims.UserInfo`](https://docs.authlib.org/en/latest/specs/oidc.html#authlib.oidc.core.UserInfo)
77+
object to extract user information from.
7878
- `token` - A dictionary which includes information necessary to make
7979
further requests to the OpenID provider.
8080
- `failures` - An `int` that represents the amount of times the returned
@@ -91,7 +91,13 @@ A custom mapping provider must specify the following methods:
9191
`None`, the user is prompted to pick their own username. This is only used
9292
during a user's first login. Once a localpart has been associated with a
9393
remote user ID (see `get_remote_user_id`) it cannot be updated.
94-
- `displayname`: An optional string, the display name for the user.
94+
- `confirm_localpart`: A boolean. If set to `True`, when a `localpart`
95+
string is returned from this method, Synapse will prompt the user to
96+
either accept this localpart or pick their own username. Otherwise this
97+
option has no effect. If omitted, defaults to `False`.
98+
- `display_name`: An optional string, the display name for the user.
99+
- `emails`: A list of strings, the email address(es) to associate with
100+
this user. If omitted, defaults to an empty list.
95101
* `async def get_extra_attributes(self, userinfo, token)`
96102
- This method must be async.
97103
- Arguments:

synapse/handlers/sso.py

+3
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,9 @@ async def handle_redirect_request(
128128

129129
@attr.s(auto_attribs=True)
130130
class UserAttributes:
131+
# NB: This struct is documented in docs/sso_mapping_providers.md so that users can
132+
# populate it with data from their own mapping providers.
133+
131134
# the localpart of the mxid that the mapper has assigned to the user.
132135
# if `None`, the mapper has not picked a userid, and the user should be prompted to
133136
# enter one.

0 commit comments

Comments
 (0)