Class LicenseConfigurator
- java.lang.Object
-
- com.sodius.oslc.server.security.services.LicenseConfigurator
-
public abstract class LicenseConfigurator extends Object
Manages the activation and configuration of a license- Since:
- 2.0.0
-
-
Constructor Summary
Constructors Constructor Description LicenseConfigurator()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description LicenseConfigurationgetConfiguration(HttpServletRequest request)Sets the License Configuration propertiesstatic LicenseConfiguratorgetInstance()Returns the current instance.static voidsetInstance(LicenseConfigurator licenseConfigurator)Replaces the current Configurator instance with the given one.voidvalidateAccess(HttpServletRequest request)Validates that the license is correct and that the user can perform his request.protected abstract voidvalidateAccess(HttpServletRequest request, com.sodius.licensing.License license)Validates that the license is correct and that the user can perform his request.protected voidvalidateActivationKey(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 theLicenseConfigurationobject.protected abstract voidvalidateConfiguration(HttpServletRequest request, Optional<com.sodius.licensing.License> license, LicenseConfiguration licenseConfiguration)Sets the properties on theLicenseConfigurationobject (e.g.
-
-
-
Method Detail
-
getInstance
public static LicenseConfigurator getInstance()
Returns the current instance.- Returns:
- the current instance.
- See Also:
setInstance(LicenseConfigurator)
-
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 theLicenseConfigurationobject (e.g. the product name). Subclasses must implement this method and callvalidateActivationKey.- Parameters:
request- the Http Requestlicense- the license objectlicenseConfiguration- the license configuration- See Also:
validateActivationKey(HttpServletRequest, LicenseConfiguration, License, String...)
-
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 theLicenseConfigurationobject.- Parameters:
request- the Http RequestlicenseConfiguration- the LicenseConfiguration objectlicense- the license objectactivationKeys- 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 requestlicense- 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
-
-