-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
OIDC authenticator does use the user id sent by the provider if it contains uppercases #9315
Comments
Matrix IDs must be all lower-case. Are you using a custom mapping provider? v1.26.0 includes a feature to prompt people to enter their username (instead of automatically using the one from SSO), which I think it is enabled by default. I see you provided a config in #9316: oidc_providers:
- idp_id: adm
idp_name: "My Provider"
issuer: "https://myhost/oidc/"
client_id: "matrix"
client_secret: "dontcare"
scopes: ["openid", "profile", "email"] Take a look at the oidc_providers:
- idp_id: adm
idp_name: "My Provider"
issuer: "https://myhost/oidc/"
client_id: "matrix"
client_secret: "dontcare"
scopes: ["openid", "profile", "email"]
mapping_provider:
config:
localpart_template: "{{ user.login }}" |
No I don't actually configure anything for the mapping, just using the default behavior.
OK that's the part I missed and which was indeed clearly indicated in the documentation.
So my only solution is to find a way on provider side to send a subject compatible with Matrix id constraints, right ? |
No, the default mapping provider should convert whatever is used as the |
OK sounds great ! One last thing: it's not clear so me what "login" is since the documentation indicate that " |
What exactly is available on the |
Yes I know about |
So I tried with:
(with the "preferred_username" claim containing "ThomasMortagne") But it keeps asking me for the id. The log does not really give much hint on why (but at least it seem it did use the userinfo endpoint thanks to
|
this should be |
incidentally, you'll need to transform preferred_username into a valid matrix id localpart. Maybe something like:
the template is jinja2, so https://jinja.palletsprojects.com/en/2.11.x/templates/ has documentation on the possibilities here. |
This happens automatically due to synapse/synapse/handlers/oidc_handler.py Lines 1219 to 1220 in ce66986
Sorry about the typo! 👍 I agree with reading the sample config. If there's parts that are unclear it would be good if we can improve them!
Because I chose a random example claim. I don't know what your IdP offers. |
Indeed, thanks, I should have double-checked.
I did that actually, but I'm not using any of those providers, and I was expecting that it would use standard OIDC metadata by default. So I was not really expecting to have to configure the mapping and did not checked this part much. All good now for the id and the display name. Thanks a lot for the help @clokep and @richvdh ! There is just one last strange things for which I don't find any reference in the OIDC mapping documentation: it seems my email is not synchronized ("Email addresses" is empty in my profile) but the email is definitely sent back by the provider (I print the json on provider log side). Is that expected ? Here is how the userinfo looks like:
|
Injecting emails isn't supported until the unreleased v1.27.0 see #9245. I'm going to close this since it seems you got it working. |
OK thanks for the info.
Definitely, thanks again and sorry for the issue that should have been questions on the chat in the end. |
Synapse version: 1.26.0
Client: https://app.element.io
When the OIDC provider return "ThomasMortagne" as subject I'm asked to provide the user id after the auth ("
Please pick your username:
"). When I try to enter "ThomasMortagne" in this form I get "Invalid username. Only the following characters are allowed: lowercase letters, digits, ., _, -, /, =
" so I guess that's why it did not use it. But then I would have expected it to try to clean up the subject automatically for simple case like upper vs lower case. At the very least It should explain why it's asking for the id.This sounds like quite a constraint, but I don't see any reference to it in the documentation, so it's possible I'm completely wrong.
The text was updated successfully, but these errors were encountered: