Skip to content

omnistrate-oss/omnistrate-licensing-sdk-java

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

83 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Omnistrate Licensing SDK for Java

CI CodeQL

Overview

omnistrate-licensing-sdk-java is an SDK that allows you to validate license files generated by Omnistrate.

How to get the SDK

You can get the package from Maven Central:

<dependency>
    <groupId>om.omnistrate.licensing</groupId>
    <artifactId>omnistrate-licensing-sdk-java</artifactId>
    <version>${LATEST_VERSION}</version>
</dependency>

For more details, visit: Maven Central

Usage Examples

Pre-requisites

The Licensing feature needs to be enabled for the service plan. When enabling the feature, a product identifier can be optionally configured. That value can then be optionally used to validate the license.

Docker compose example:

x-customer-integrations:
  licensing: 
    # optional - defaults to 7 days
    licenseExpirationInDays: 7
    # optional - identifier used to add extra security on validation - defaults to product tier id
    productPlanUniqueIdentifier: '[product plan unique id]' 

When used on a Container-based resource, Omnistrate takes care of mounting the secret and setting the environment variables for verification.

Service spec configuration:

features:
  CUSTOMER: 
    licensing:
      # optional - defaults to 7 days
      licenseExpirationInDays: 7 
      # optional - identifier used to add extra security on validation - defaults to product tier id
      productPlanUniqueIdentifier: '[product plan unique id]'

When using Helm or Operator, the secret service-plan-subscription-license generated with the license needs to be mounted on /var/subscription/

Get your Organization ID

The Organization ID will be needed to ensure the license maps to products plans defined for your organization. We will that globally unique id in the validation process.

You can get you Organization ID from your user profile. Profile

Usage

During startup and periodically, implement the following check:

Validate License

package com.example;

import com.omnistrate.licensing.validation.Validator;

public class Main {
    public static void main(String[] args) {
        try {
            boolean isValid = Validator.validateLicenseForProduct("[org-id]", "[product plan unique id]"); /// value should be hardcoded, based on the value configured when enabling the feature
            if (isValid) {
                System.out.println("License validation for product succeeded");
            } else {
                System.out.println("License validation for product failed");
            }
        } catch (Exception e) {
            System.out.println("License validation for product failed: " + e.getMessage());
        }
    }
}

Contributing

Want to contribute? Awesome! You can find information about contributing to this project in the CONTRIBUTING page

About Omnistrate

Omnistrate is the operating system for your SaaS, offering enterprise-grade capabilities: automated provisioning, serverless capabilities, auto-scaling, billing, monitoring, centralized logging, self-healing, intelligent patching and much more!

About

Java SDK for Omnistrate Licensing

Resources

License

Stars

Watchers

Forks

Contributors 3

  •  
  •  
  •