-
Notifications
You must be signed in to change notification settings - Fork 228
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OIDC login creates @=22username=22:somedomain.tld
instead of @username:somedomain.tld
#17011
Comments
@=22username=22:somedomain.tld
instead of @username:somedomain.tld
In this case I think your issue is that your template has quotation marks in it: replace display_name_template: '"{{ user.name }}"'
localpart_template: '"{{ user.preferred_username }}"' with display_name_template: '{{ user.name }}'
localpart_template: '{{ user.preferred_username }}' You will possibly need to recreate your user, as I think the username is generated on first login and will remain associated afterwards — I think the identity provider usually supplies a stable internal ID for identifying users without using their name. |
thank you for your really fast response! 🙏 I will try that in just a bit and report back! |
That was it! Sorry, this got confusing because I'm deploying synapse through Argo CD ApplicationSet -> Argo CD App -> Helm -> Docker container in pod on k8s, and so the escaping of things can get a little weird and produce some weird results. For anyone using the above helm chart via Argo CD or anything else that needs you to escape this templating, this is what you'd put into your values to escape a layer of gotemplating: # previously I had '{{`"{{ user.preferred_username }}"`}}' which broke things
localpart_template: "{{`{{ user.preferred_username }}`}}"
display_name_template: "{{`{{ user.name }}`}}" example Argo CD ApplicationSet to deploy matrix---
apiVersion: argoproj.io/v1alpha1
kind: ApplicationSet
metadata:
name: matrix-web-app-set
namespace: argocd
spec:
goTemplate: true
# generator allows us to source specific values from an external k8s secret
generators:
- plugin:
configMapRef:
name: secret-var-plugin-generator
input:
parameters:
secret_vars:
- matrix_hostname
template:
metadata:
name: matrix-web-app
annotations:
argocd.argoproj.io/sync-wave: "3"
spec:
project: matrix
destination:
server: https://kubernetes.default.svc
namespace: matrix
syncPolicy:
syncOptions:
- ApplyOutOfSyncOnly=true
automated:
prune: true
selfHeal: true
source:
repoURL: 'https://small-hack.github.io/matrix-chart'
targetRevision: 7.0.2
chart: matrix
helm:
valuesObject:
# Runtime configuration for Synapse and settings related to the Matrix protocol
matrix:
oidc:
enabled: true
existingSecret: "synapse-oidc"
secretKeys:
issuer: "issuer"
client_id: "client_id"
client_secret: "client_secret"
providers:
- idp_id: zitadel
idp_name: zitadel
scopes:
- "openid"
- "profile"
user_mapping_provider:
config:
localpart_template: "{{`{{ user.preferred_username }}`}}"
display_name_template: "{{`{{ user.name }}`}}" Thanks, @reivilibre ! 👋 |
Description
Using Zitadel (it's like a modern version of keycloak) as an OIDC provider for matrix and element works, but creates a weird username with
=22
in it, like@=22username=22:somedomain.tld
. I had followed the docs, and previously, maybe 6 months ago when I setup my last server, it wasn't a problem. Not sure if there's anything I can specify to strip out those weird characters.Steps to reproduce
setup a zitadel instance (which uses the same oidc config block as keycloak)
Setup matrix and element via docker using the following in your homeserver.yaml as per docs:
try to login to element via zitadel
it lets you login but, the username comes back as
@=22myusername=22:domain.tld
and there's no way to reset it.I also tried to use python to strip the weird characters, but it didn't work. Example of what I tried:
Homeserver
personally hosted homeserver using matrixdotorg/synapse:v1.102.0
Synapse Version
{"server_version":"1.102.0"}
Installation Method
Docker (matrixdotorg/synapse)
Database
one fresh v14.x postgresql server and it has not been restored from a backup
Workers
Single process
Platform
I'm using a helm chart to deploy this stack which includes synapse (matrixdotorg/synapse:v1.102.0) and element (vectorim/element-web:v1.11.61). Zitadel is running in the same cluster and it does technically work, but the username is always really weird. It's more of an inconvenience than it is a breaking change.
Configuration
Relevant log output
Anything else that would be useful to know?
I cross posted this to the zitadel github repo: zitadel/zitadel#7596 Thanks for any guidance you can provide. Happy to provide additional logs from element if you need them. Above logs are from synapse container in matrix pod.
The text was updated successfully, but these errors were encountered: