Crowd MySQL Connector

This is a plugin for Atlassian Crowd, which allows to connect to any MySQL database. The database is queried for users, groups and groups memberships. The tool is Open Source, licensed under the Apache 2.0 license.

Download

The Connector is distributed as jar file, download here: https://dev.d-herrmann.de/downloads/mysqldirectory-0.3.2.jar

You can find the sources in the repository.

Issue tracker can be found here: https://dev.d-herrmann.de/jira/browse/CMC/

Installation – Jar File

If you choose to use the pre-compiled JAR archive, upload it to your Crowd server and place it in %CROWDHOME%/webapp/WEB-INF/lib. Remember to set correct permissions, and then restart Crowd. Go on with the configuration section.

Manual Installation

If you want to make further changes, you need to compile the Directory on your own. There are several requirements:

  • Java JDK 1.6 or higher
  • Apache Maven

On Windows, make sure the mvn executable is in your path. The compile the code, follow those steps:

  • You need to compile the sources and generate a jar file. A POM file is provided with the project, which includes the required MAVEN configuration.
  • Download and extract the files to a directory
  • Build them with mvn install
  • Copy the generated JAR file to your crowd installation: %CROWDHOME%/webapp/WEB-INF/lib

Configuration

Finally you need to create a Custom Directory and perform some configuration steps.

  • Create a new custom directory with class “de.d_herrmann.crowd.directory.kras.MySQLDirectoryServer”
  • De-activate all directory permissions such as Create/Add/Edit User or Group
  • Further, you need to configure the database parameters, this is done using the crowd directory attributes

The following attributes are available. The table lists the same, a description and a default value, which is used if the attribute is not set. Unfortunately Crowd does not seem to apply the new attribute map at runtime, so in the meantime, please restart Crowd after setting the attributes.

AttributeDefaultDescription
db.hostlocalhostIP or DNS Name of the MySQL Database Server
db.namedatabaseName of the Database
db.usernameusernameUsername to connect to the database
db.passwordPassword of the user
user.tablenameuserName of the table which stores the users
group.tablenamegroupName of the table which stores the groups
usergroup.tablenameusergroupName of the table which maps the users to their groups. See note below for details
user.idfieldidUser Column Name which stores the ID
user.namefieldusernameUser Column Name which stores the username
user.firstnamefieldfirstnameUser Column Name which stores the first name
user.lastnamefieldlastnameUser Column Name which stores the last name
user.activefieldactiveUser Column Name which stores whether the user is active or not
user.birthdatefieldbirthdateUser Column Name which stores the birthdate
user.passwordfieldpasswordUser Column Name which stores the encrypted password
user.emailfieldemailUser Column Name which stores the email
group.namefieldnameGroup Column Name which stores the group name
usergroup.userfielduserField of the mapping table which stores the user identifier
usergroup.groupfieldgroupField of the mapping table which stores the group identifier
hash.saltfieldField of the user table which is used as salt value in password hash calculation
hash.saltmethodnoneMethod used to salt the password. Available methods are:

- none
- salt_hash
- hash_salt_hash

For details refer to the following documentation.
hash.hashalgorithmmd5Algorithm used to hash the password. Available algorithms are:

- md5
- sha1
- sha256
- sha512

For details refer to the following documentation.
c3p0.minpoolsize3Minimum size of the connection pool. Refer to c3p0 documentation for further details.
c3p0.maxpoolsize10Maximum size of the connection pool. Refer to c3p0 documentation for further details.
c3p0.acquireincrement2Number of connections which will be acquired at once. Refer to c3p0 documentation for further details.
c3p0.testconnectiononcheckouttrueEnable connection testing on checkout. Refer to c3p0 documentation for further details.
c3p0.automatictesttable c3p0-testDefines the name of the connection test table. Refer to c3p0 documentation for further details.

Hashing and Salting

As described in the table, there are various methods to hash a passwords using the hash algorithms listed in the table. The salt methods however require some further explanation:

  • none refers to plain hashing of the password.
  • salt_hash refers to normal salting, which concatenating the hash and the salt, and hashing the resulting string
  • hash_salt_hash refers to an advanced hashing method. First, the password is hashed. The salt is appended to the resulting hash, and this string is hashed again.

Known Issues

  • Nested Groups are not supported
  • Modifying, Creating and Deleting Users and Groups is not supported
  • Groups are always active, it is not possible to de-activate groups

9 thoughts on “Crowd MySQL Connector

  1. Tim

    Hello Daniel,

    i’ve tried your plugin and when ich try to create the custom connector, Crowd gives me an error message.
    “The supplied implementation class is invalid. ”

    Any hints?

    Regards,
    Tim

    Reply
    1. Daniel Herrmann Post author

      Hi Tim,

      The error message means that Crowd was not able to find the class files. Did you place the JAR file into the right directory? Is it readable and executable by the Crowd User?

      Further, AFAIK Crowd needs to be restarted in order to detect new libraries. Did you restart Crowd? Finally, I have only tested the Directory Plugin with Crowd 2.8.0. I cannot guarantee that older versions are supported, too.

      Best,
      Daniel

      Reply
      1. james

        I was able to build the plugin but it does not seem to work with Crowd 2.8.4 probably for the same reason. Crowd only gives me two error messages and I can’t find anything in the logs – one is a Null Pointer exception and the other is a “The supplied implementation class is invalid.” Is there an obvious cause to this problem or is it more likely to be some kind of cryptic update applied on the atlassian side that broke everything between 2.8 and 2.8.4?

        Thanks for this cool plugin – even if it doesn’t work the fact that you were able to get this working at some point at all is really impressive.

        Reply
        1. Daniel Herrmann Post author

          Hi James,

          very sorry for my late reply… somehow WordPress refused to send my mails 🙂 The plugin is currently running at Crowd 2.8.3 here. Going to update to 2.8.4 or later and check whether it still works.

          Reply
  2. Phil Lajoie

    The link to the pre-compile JAR going to seafile is broken. Thanks for building this connection 🙂

    Reply
    1. Daniel Herrmann Post author

      Hi Phil.

      thank you for reporting this, I have fixed the links.

      Best,
      Daniel

      Reply
  3. james

    This plugin looks awesome / like it will save me several hours of my life but it also looks like the precompiled JAR link broke again. Any chance you could fix it when you get the chance?

    Reply
    1. Daniel Herrmann Post author

      Thank you for the comment. I recently found time to rename the Url, as the product is now called bitbucket and not stash anymore. Link has been updated!

      Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload the CAPTCHA.