# Gebruikersnaam herschrijven met SAML/OpenIDC Logins

**URL:** <https://meta.discourse.org/t/rewrite-username-with-saml-openidc-logins/220999>\
**Category:** Self-hosting\
**Tags:** hosting\
**Created:** [15 maart 2022 om 13:41 UTC](https://meta.discourse.org/t/rewrite-username-with-saml-openidc-logins/220999 "2022-03-15T13:41:50Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![holtgrewe](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/holtgrewe/32/253122_2.png) [@holtgrewe](https://meta.discourse.org/u/holtgrewe)\
**Post date:** [15 maart 2022 om 13:41 UTC](https://meta.discourse.org/t/rewrite-username-with-saml-openidc-logins/220999/1 "2022-03-15T13:41:50Z")

</div>

First of all, thank you for providing such great software as open source.

I have successfully setup discourse on our server with OpenIDC integration to our local keycloak server. However, keycloak delivers user names as domain1\user and domain2\user etc. Users turn up as domain1\_user and domain2\_user. I would like to transmogrify the user names, potentially based on regular expresions. I would like to have user names to be user\_domain1 and user\_domain2.

As far as I can see, this is not properly supported in either the SAML or the OpenIDC connector. I tried modifying the source code of the connectors but the mapping probably needs to be done in a lot of places and I did not succeed.

Has anyone succeeded with such a setup yet?

I looked into configuring this into Keycloak, but Keycloak does not allow regular expressions in client mappings or from upstream federation servers on login…

---

_[View the full topic](https://meta.discourse.org/t/rewrite-username-with-saml-openidc-logins/220999)._
