LDAP login with username either userPrincipalName or sAMAccountName?

Isd it possible to configure an LDAP (MS AD) directory that will allow a user to log in using either the LDAP directories' userPrincipalName or sAMAccountName attrribute value? I'd like to allow people to use either (the one is older and more familiar to my audience than the other). Or is it only possible to match on a single attribute for a login username?

Thanks.

-Alan

1 answer

You can setup multiple LDAP repositories in Confluence. In 3.4.x and earlier, just edit atlassian-user.xml and input to repositories with different usernameAttribute elements:

<ldap key="ad1" name="ad1" cache="true">
        <host>ad1</host>
        <port>389</port>
        <securityProtocol>plain</securityProtocol>
        <securityAuthentication>simple</securityAuthentication>
        <usernameAttribute>sAMAccountName</usernameAttribute>
        <userSearchFilter>(objectClass=user)</userSearchFilter>
        <firstnameAttribute>givenname</firstnameAttribute>
        <surnameAttribute>sn</surnameAttribute>
        <emailAttribute>mail</emailAttribute>
        <groupnameAttribute>cn</groupnameAttribute>
        <groupSearchFilter>(objectClass=group)</groupSearchFilter>
        <userSearchAllDepths>true</userSearchAllDepths>
        <groupSearchAllDepths>true</groupSearchAllDepths>
        <membershipAttribute>member</membershipAttribute>
</ldap>
<ldap key="ad2" name="ad2" cache="true">
        <host>ad2</host>
        <port>389</port>
        <securityProtocol>plain</securityProtocol>
        <securityAuthentication>simple</securityAuthentication>
        <usernameAttribute>userPrincipalName</usernameAttribute>
        <userSearchFilter>(objectClass=user)</userSearchFilter>
        <firstnameAttribute>givenname</firstnameAttribute>
        <surnameAttribute>sn</surnameAttribute>
        <emailAttribute>mail</emailAttribute>
        <groupnameAttribute>cn</groupnameAttribute>
        <groupSearchFilter>(objectClass=group)</groupSearchFilter>
        <userSearchAllDepths>true</userSearchAllDepths>
        <groupSearchAllDepths>true</groupSearchAllDepths>
        <membershipAttribute>member</membershipAttribute>
</ldap>

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Kesha Thillainayagam
Posted Apr 13, 2018 in Confluence

We want to hear how your non-technical teams are using Confluence!

Hi Community! Kesha (kay-sha) from the Confluence marketing team here! Can you share stories with us on how your non-technical (think Marketing, Sales, HR, legal, etc.) teams are using Confluen...

2,691 views 25 10
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you