Class LicenseConfigurator

java.lang.Object
com.sodius.oslc.server.security.services.LicenseConfigurator
Direct Known Subclasses:
BrokerLicenseConfigurator

public abstract class LicenseConfigurator extends Object
Manages the activation and configuration of a license
Since:
2.0.0
  • Constructor Details

    • LicenseConfigurator

      public LicenseConfigurator()
  • Method Details

    • getInstance

      public static LicenseConfigurator getInstance()
      Returns the current instance.
      Returns:
      the current instance.
      See Also:
    • setInstance

      public static void setInstance(LicenseConfigurator licenseConfigurator)
      Replaces the current Configurator instance with the given one.
      Parameters:
      licenseConfigurator - the new licenseConfigurator.
    • getConfiguration

      public LicenseConfiguration getConfiguration(HttpServletRequest request) throws SettingStoreException
      Sets the License Configuration properties
      Parameters:
      request - the Http Request
      Returns:
      the license Configuration
      Throws:
      SettingStoreException - if an error occurs while querying a security setting
    • validateConfiguration

      protected abstract void validateConfiguration(HttpServletRequest request, Optional<com.sodius.licensing.License> license, LicenseConfiguration licenseConfiguration)
      Sets the properties on the LicenseConfiguration object (e.g. the product name). Subclasses must implement this method and call validateActivationKey.
      Parameters:
      request - the Http Request
      license - the license object
      licenseConfiguration - the license configuration
      See Also:
    • validateActivationKey

      protected void validateActivationKey(HttpServletRequest request, LicenseConfiguration licenseConfiguration, com.sodius.licensing.License license, String... activationKeys)
      Activates the license with the keys passed as parameters and updates the status of the LicenseConfiguration object.
      Parameters:
      request - the Http Request
      licenseConfiguration - the LicenseConfiguration object
      license - the license object
      activationKeys - the keys to activate
    • validateAccess

      protected abstract void validateAccess(HttpServletRequest request, com.sodius.licensing.License license) throws com.sodius.licensing.ActivationException
      Validates that the license is correct and that the user can perform his request.
      Parameters:
      request - the http request
      license - the license
      Throws:
      com.sodius.licensing.ActivationException - if the license is absent/not valid
    • validateAccess

      public void validateAccess(HttpServletRequest request) throws com.sodius.licensing.ActivationException
      Validates that the license is correct and that the user can perform his request.
      Parameters:
      request - the http request
      Throws:
      com.sodius.licensing.ActivationException - if the license is absent/not valid