Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Note

This is the documentation for plugin version 1.1 and greater. Documentation for version prior to 1.1 is located on separate page. Instructions for migration can be found here.

The Sonar LDAP Plugin enables the delegation of Sonar authentication and authorization to an external system. The plugin currently supports LDAP and Microsoft Active Directory.

...

About the delegation of authorization, there is only one pre-requisite: the relationships between users and groups are only synchronized with groups which are already defined in the Sonar. So groups and related permissions must be first defined in Sonar.

Usage & Installation

  1. Download Install the LDAP plugin from the Update Center and restart the Sonar server. If you do not have access to the Internet, manually download the JAR file into $SONARthrough the Update Center or download it into the SONAR_HOME/extensions/plugins and restart directory
  2. Restart the Sonar server.
  3. Make sure that at least one user with global administration role exists in Sonar as well as in the external system
  4. Configure the LDAP plugin by editing the conf/sonar.properties file (see below)

  5. Restart the Sonar server and check the log file for:

    INFO org.sonar.INFO Security realm: LDAP
    ...

    INFO o.s.p.l.LdapContextFactory Test LDAP connection: OK

  6. Log into Sonar

Anchor
Configuration
General Configuration

PropertyDescriptionDefault valueMandatoryExample
sonar.security.realm

This property must be defined to ask the Sonar server to use first the LDAP plugin when trying to authenticate a user. (available since Sonar 2.14)

 

Yes

LDAP (no other value can be used)
sonar.security.savePasswordThis optional property can be used to ask Sonar to save the user password in the Sonar DB. When this property is activated, a user can log into Sonar even when the LDAP server is not available. (available since Sonar 2.14)falseNo 
sonar.authenticator.createUsersBy default, the Sonar DB is automatically populated when a new Sonar user logs into Sonar. Setting this value to false, make it mandatory for a Sonar administrator to first declare a user in the Sonar DB before allowing this user to log into Sonar.trueNo 
ldap.urlURL of the LDAP server. Note that if you are using ldaps, then you should install server certificate into java truststore. Yes (Not mandatory in case of Auto-discovery)ldap://localhost:10389
ldap.bindDnBind DN is the username of an LDAP user to connect (or bind) with. Leave blank for anonymous access to the LDAP directory. Nocn=sonar,ou=users,o=mycompany
ldap.bindPasswordBind Password is the password of the user to connect with. Leave blank for anonymous access to the LDAP directory. Nosecret
ldap.authenticationPossible values: 'simple', 'CRAM-MD5', 'DIGEST-MD5', 'GSSAPI'. See  http://java.sun.com/products/jndi/tutorial/ldap/security/auth.htmlsimpleNosee description
ldap.realm Noexample.org
ldap.contextFactoryClass(advanced option) Context factory class.com.sun.jndi.ldap.LdapCtxFactoryNo 

User Mapping

PropertyDescriptionDefault valueMandatoryExample for Active Directory Server
ldap.user.baseDnDistinguished Name (DN) of the root node in LDAP from which to search for users. Yes (Not mandatory in case of Auto-discovery)cn=users,dc=example,dc=org
ldap.user.request(available since plugin version 1.2)
No Format
(&(objectClass=inetOrgPerson)(uid={login}))
No
No Format
(&(objectClass=user)(sAMAccountName={login}))
ldap.user.objectClassDeprecated in plugin version 1.2 and replaced by 'ldap.user.request'. Object class of LDAP users.inetOrgPersonNouser
ldap.user.loginAttributeDeprecated in plugin version 1.2 and replaced by 'ldap.user.request'. Attribute in LDAP holding the user’s login.uidNosAMAccountName
ldap.user.realNameAttributeAttribute in LDAP holding the user’s real name.cnNo 
ldap.user.emailAttributeAttribute in LDAP holding the user’s email.mailNo 

Group Mapping

The following properties should be defined to allow Sonar to automatically synchronized the relationships between users and groups.

There are two limitations:

  • Groups must be static and not dynamic
  • The user entry must contain the attribute 'memberOf' with list of groups
PropertyDescriptionDefault valueMandatoryExample for Active Directory Server
ldap.group.baseDnDistinguished Name (DN) of the root node in LDAP from which to search for groups. 

Yes in version 1.1.1

No in version 1.2, if you want to disable synchronization of groups.

cn=groups,dc=example,dc=org
ldap.group.request(available since plugin version 1.2)
No Format
(&(objectClass=groupOfUniqueNames)(uniqueMember={dn}))
No
No Format
(&(objectClass=group)(member={dn}))
ldap.group.objectClassDeprecated in plugin version 1.2 and replaced by 'ldap.group.request'. Object class of LDAP groups.groupOfUniqueNamesNogroup
ldap.group.idAttributeAttribute in LDAP holding the group's id.cnNo 
ldap.group.memberAttributeDeprecated in plugin version 1.2 and replaced by 'ldap.group.request'. Attribute in LDAP holding the group's member.uniqueMemberNomember

Example of LDAP Configuration

Code Block
languagenone
# LDAP configuration
sonar.security.realm=LDAP
sonar.security.savePassword=true

ldap.url=ldap://myserver.mycompany.com
 
ldap.user.baseDn=ou=Users,dc=mycompany,dc=com
ldap.user.objectClass=inetOrgPerson
ldap.user.loginAttribute=uid
ldap.user.realNameAttribute=cn
ldap.user.emailAttribute=mail


ldap.group.baseDn=ou=Groups,dc=sonarsource,dc=com
ldap.group.request=(&(objectClass=posixGroup)(memberUid={uid}))

Anchor
Auto-discovery
Auto-discovery

...

  1. Determine DNS Domain Name:
    • from "ldap.realm" property if set
    • from FQDN of machine, where Sonar is installed (eg. if FQDN is "sonar.example.org", then DNS Domain Name will be "example.org")
  2. Determine URL of LDAP server:
    • from "ldap.url" property if set
    • from DNS server ( see known limitations ), here is example of SRV Record for domain "example.org":

      No Format
      _ldap._tcp.example.org. 72784   IN      SRV     0 5 389 ldap.example.org.

      for this domain URL of LDAP server will be "ldap://ldap.example.org:389"

  3. Determining BaseDN:
    • from "ldap.baseDn" property if set
    • from DNS Domain Name (eg. if DNS Domain Name is "example.org", then BaseDN will be "dc=example,dc=org")

...

Configure Group Mapping: at least by specifing new mandatory property - "ldap.group.baseDn".

...

Change Log

JIRA Issues
anonymoustrue
titleRelease 1.2.1
height50
renderModestatic
width800900
columnstype;key;summary;priority;status;resolution
urlhttp://jira.codehaus.org/sr/jira.issueviews:searchrequest-xml/temp/SearchRequest.xml?fixfor=18856&pid=11911&sorter/field=priority&sorter/order=DESC&tempMax=1000

 

JIRA Issues
anonymoustrue
titleRelease 1.2
height50
renderModestatic
width900
columnstype;key;summary;priority
urlhttp://jira.codehaus.org/sr/jira.issueviews:searchrequest-xml/temp/SearchRequest.xml?fixfor=18454&pid=11911&sorter/field=priority&sorter/order=DESC&tempMax=1000

...

JIRA Issues
anonymoustrue
titleRelease 1.1.1
height50
renderModestatic
width800900
columnstype;key;summary;priority;status;resolution
urlhttp://jira.codehaus.org/sr/jira.issueviews:searchrequest-xml/temp/SearchRequest.xml?fixfor=18429&pid=11911&sorter/field=priority&sorter/order=DESC&tempMax=1000

...

JIRA Issues
anonymoustrue
titleRelease 1.1
height100
renderModestatic
width800900
columnstype;key;summary;priority;status;resolution
urlhttp://jira.codehaus.org/sr/jira.issueviews:searchrequest-xml/temp/SearchRequest.xml?fixfor=18403&pid=11911&sorter/field=priority&sorter/order=DESC&tempMax=1000

...

JIRA Issues
anonymoustrue
titleRelease 1.0
height70
renderModestatic
width800900
columnstype;key;summary;priority;status;resolution
urlhttp://jira.codehaus.org/sr/jira.issueviews:searchrequest-xml/temp/SearchRequest.xml?fixfor=16915&pid=11911&sorter/field=priority&sorter/order=DESC&tempMax=1000

...

JIRA Issues
anonymoustrue
titleRelease 0.1
height250
renderModestatic
width800900
columnstype;key;summary;priority;status;resolution
urlhttp://jira.codehaus.org/sr/jira.issueviews:searchrequest-xml/temp/SearchRequest.xml?fixfor=16049&pid=11911&sorter/field=priority&sorter/order=DESC&tempMax=1000