Class BrokerLicenseConfigurator

java.lang.Object
com.sodius.oslc.server.security.services.LicenseConfigurator
com.sodius.oslc.broker.security.services.BrokerLicenseConfigurator

public abstract class BrokerLicenseConfigurator extends LicenseConfigurator
Manages the activation and configuration of the broker license. This configurator can differentiate between the general product usage of the support for global configurations and TRS, potentially seen as an optional feature.
Since:
4.0.0
  • Constructor Details

    • BrokerLicenseConfigurator

      protected BrokerLicenseConfigurator(BrokerLicenseSettings settings)
      Creates a license configurator with given settings.
      Parameters:
      settings - the settings detailing the activation key controlling access to product features
  • Method Details

    • validateConfiguration

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

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

      protected void validateAccess(HttpServletRequest request, com.sodius.licensing.License license) throws com.sodius.licensing.ActivationException
      Description copied from class: LicenseConfigurator
      Validates that the license is correct and that the user can perform his request.
      Specified by:
      validateAccess in class LicenseConfigurator
      Parameters:
      request - the http request
      license - the license
      Throws:
      com.sodius.licensing.ActivationException - if the license is absent/not valid
    • getActivationKey

      protected Optional<String> getActivationKey(HttpServletRequest request)
      Returns the activation key to check in the license for the given servlet path.
      Parameters:
      request - the servlet request to validate
      Returns:
      the activation key to check in the license, or an empty optional if no license check is necessary for the servlet path
    • getUserCount

      protected Optional<Integer> getUserCount(HttpServletRequest request)
      Returns the number of user accounts detected in the brokered application, so that it can be compared with the user threshold value in the license file, if any.

      Default implementation returns an empty optional. It throws an UnsupportedOperationException if a user threshold property is configured, as subclasses must override this method in such case, to determine the actual number of user accounts.

      If implementation cannot determine the actual number of user accounts (for example if an access to database fails), it shall log an error and return an empty optional. Not being able to determine this information should not prevent accessing the broker.

      Parameters:
      request - the servlet request
      Returns:
      the actual number of user accounts, or an empty optional if this number cannot be determined or no user threshold is used.