License management plugin for Grails application

I have been recently working on a plugin that provides ability to securely create, install and verify license for closed source grails applications. This plugin utilizes TrueLicense Library Collection (TLC). You can download the plugin here.

Installation

grails install-plugin <path-to-grails-license-0.1.zip>

Usage

  • Generate license file: grails generate-license
  • Start app: grails run-app
  • Instal/verify license at http://localhost:8080/your_app/license. If you try to access your app without installing license, you will be redirected to this page.

Components

  • /plugins/license-0.1/etc/privateKey.store - private key file. This never gets included in your WAR. (You should generate your own private/public keys with keytool command. see tips section below)
  • /plugins/license-0.1/etc/LicensePrivateConfig.properties - holds all necessary configuration to create a license such as issuer, holder, validity etc. Again not included in WAR
  • /plugins/license-0.1/conf/publicCerts.store - public key file. This is included in WAR
  • /plugins/license-0.1/conf/LicensePublicConfig.groovy - holds all necessary information required for the client. Included in WAR
  • /plugins/license-0.1/controller/LicenseController - Install, verify license
  • /plugins/license-0.1/services/LicenseService - Install, verify license
  • /plugins/license-0.1/conf/LicenseFilter - defines which controllers, actions need to be protected.

Tips

  • To generate private key:
    keytool -genkey -alias privatekey -keystore privateKeys.store
  • To generate public key
    keytool -export -alias privatekey -file certfile.cer -keystore privateKeys.store
    keytool -import -alias publiccert -file certfile.cer -keystore publicCerts.store
  • The system preferences are stored in the registry in windows and file system (/etc/.java/) in Linux. You may need appropriate permissions to be able to do this.

2 Responses to “License management plugin for Grails application”

  1. Björn Wilmsmann Says:

    I’ve been trying to get the plugin to work under Grails 1.0.2 during the last few hours. However, I basically run into two problems:

    - If I generate a license with the key pair that comes with the plugin, the license won’t be accepted and the following exception is thrown: service.LicenseService License could not be installedde.schlichtherle.xml.PersistenceServiceException: java.lang.ClassCastException: org.apache.xerces.jaxp.SAXParserFactoryImpl . Usually, I would assume this is due to conflicting xercesImpl.jarS. However, in my app there is only one, that is the one that comes with Grails 1.0.2
    - After having generated my own private / public key pair and changing the config settings accordingly, ‘grails generate-license’ simply prints out ‘null’, which seems to originate from line 68 in GenerateLicense.groovy: LicenseManager lm = new LicenseManager(licenseParam). I have double-checked the settings in conf/LicensePublicConfig.groovy and etc/LicensePrivateConfig.properties.


    Best regards,
    Bjoern Wilmsmann

    PS: Besides, this plugin should definitely be added to the official Grails plugins page, as it provides a very useful feature.

  2. Mano Says:

    The exception indicates that probably there is a conflicting jar. I have tried the plugin with both grails 1.0.1 and 1.0.2 and works fine. Can you try the plugin with a simple HelloWorld app? If you still have problems, let me know your OS, java ver etc

    BTW, the plugin has already been added to grails repo. You should be able to install the plugin by grails install-plugin license.

    - Mano

Leave a Reply

Spam protection by WP Captcha-Free