# LDAP badge?

**URL:** https://meta.discourse.org/t/ldap-badge/382116
**Category:** SSO
**Tags:** badges, sso
**Created:** [September 9, 2025, 9:09pm UTC](https://meta.discourse.org/t/ldap-badge/382116 "2025-09-09T21:09:57Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![strk](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/strk/32/121193_2.png) [@strk](https://meta.discourse.org/u/strk)
#### Post date: [September 9, 2025, 9:09pm UTC](https://meta.discourse.org/t/ldap-badge/382116/1 "2025-09-09T21:09:57Z")

</div>

Hello, is it possible to assign a badge to those whose username matches the LDAP username and were authenticated via LDAP ? We currently allow rigistering local accounts too so someone could register someone else’s LDAP username as a local account and we’d like to be able to tell the difference…

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [September 9, 2025, 9:28pm UTC](https://meta.discourse.org/t/ldap-badge/382116/2 "2025-09-09T21:28:21Z")

</div>

I think what I’d do is get LDAP to assign people to some group and give that group Badge Flair. [Setting a primary group for users](https://meta.discourse.org/t/setting-a-primary-group-for-users/25857) might help?

---

<div class="post-metadata">

### Author: ![strk](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/strk/32/121193_2.png) [@strk](https://meta.discourse.org/u/strk)
#### Post date: [September 12, 2025, 8:03am UTC](https://meta.discourse.org/t/ldap-badge/382116/3 "2025-09-12T08:03:21Z")

</div>

Any idea how to get LDAP to assign people to some group ?  
Sounds like something that should be implemented by the LDAP plugin,  
but I don’t see any option to do that in the admin panel.

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [September 12, 2025, 11:40am UTC](https://meta.discourse.org/t/ldap-badge/382116/4 "2025-09-12T11:40:15Z")

</div>

Oh. Sorry. I thought I’d would’ve d be as simple as adding the groups to some ldap field, but it looks like you’ll need a plugin.

> [@What is this code add\_to\_serializer in all these plugins](https://meta.discourse.org/t/what-is-this-code-add-to-serializer-in-all-these-plugins/58913/19):
>
> I’m working on a plugin to automate discourse group syncing with ldap. I added a custom field to Group (ldap\_dn) to save the ldap group name in. I’m trying to retrieve the custom\_field value from an input field that i added in the membership plugin-outlet and save that to the db to later use it. To do so i added this to my plugin.rb file Group.register\_custom\_field\_type(‘ldap\_dn’, :text) Group.preload\_custom\_fields\<\< “ldap\_dn” if Group.respond\_to? :preloaded\_custom\_fields if SiteSetting.…

If you’re self hosted you can make one or ask in #Marketplace.

Your ldap users some all have the same email hostname, do they? If so, you can assign the group using that.
