Class LicenseConfigurator
java.lang.Object
com.sodius.oslc.server.security.services.LicenseConfigurator
- Direct Known Subclasses:
BrokerLicenseConfigurator
Manages the activation and configuration of a license
- Since:
- 2.0.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetConfiguration(HttpServletRequest request) Sets the License Configuration propertiesstatic LicenseConfiguratorReturns 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.
-
Constructor Details
-
LicenseConfigurator
public LicenseConfigurator()
-
-
Method Details
-
getInstance
Returns the current instance.- Returns:
- the current instance.
- See Also:
-
setInstance
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
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
-