Class BrokerLicenseConfigurator
java.lang.Object
com.sodius.oslc.server.security.services.LicenseConfigurator
com.sodius.oslc.broker.security.services.BrokerLicenseConfigurator
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 Summary
ConstructorsModifierConstructorDescriptionprotectedCreates a license configurator with given settings. -
Method Summary
Modifier and TypeMethodDescriptiongetActivationKey(HttpServletRequest request) Returns the activation key to check in the license for the given servlet path.getUserCount(HttpServletRequest request) Returns the number of user accounts detected in the brokered application, so that it can be compared with theuser thresholdvalue in the license file, if any.voidvalidateAccess(HttpServletRequest request) Validates that the license is correct and that the user can perform his request.protected voidvalidateAccess(HttpServletRequest request, com.sodius.licensing.License license) Validates that the license is correct and that the user can perform his request.protected voidvalidateConfiguration(HttpServletRequest request, Optional<com.sodius.licensing.License> license, LicenseConfiguration licenseConfiguration) Sets the properties on theLicenseConfigurationobject (e.g.Methods inherited from class com.sodius.oslc.server.security.services.LicenseConfigurator
getConfiguration, getInstance, setInstance, validateActivationKey
-
Constructor Details
-
BrokerLicenseConfigurator
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:LicenseConfiguratorSets the properties on theLicenseConfigurationobject (e.g. the product name). Subclasses must implement this method and callvalidateActivationKey.- Specified by:
validateConfigurationin classLicenseConfigurator- Parameters:
request- the Http Requestlicense- the license objectlicenseConfiguration- the license configuration- See Also:
-
validateAccess
public void validateAccess(HttpServletRequest request) throws com.sodius.licensing.ActivationException Description copied from class:LicenseConfiguratorValidates that the license is correct and that the user can perform his request.- Overrides:
validateAccessin classLicenseConfigurator- 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:LicenseConfiguratorValidates that the license is correct and that the user can perform his request.- Specified by:
validateAccessin classLicenseConfigurator- Parameters:
request- the http requestlicense- the license- Throws:
com.sodius.licensing.ActivationException- if the license is absent/not valid
-
getActivationKey
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
Returns the number of user accounts detected in the brokered application, so that it can be compared with theuser thresholdvalue in the license file, if any.Default implementation returns an empty optional. It throws an
UnsupportedOperationExceptionif auser thresholdproperty 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.
-