License Restrictions
The Restrictions section in a Babel Licensing template allows you to define specific constraints on how licenses can be used. These restrictions provide granular control over license behavior, enabling you to implement various licensing models and enforce usage conditions. Babel Licensing offers several built-in restriction types along with the ability to create custom restrictions.
Overview of License Restrictions
License restrictions serve as enforceable conditions that determine how, when, and where your software can be used under a specific license. Each restriction type addresses a specific aspect of license control, from time-limited usage to hardware binding. Multiple restrictions can be combined within a single license template to create sophisticated licensing models tailored to your specific requirements.
Beta Restriction
The Beta restriction is designed for pre-release software, tagging licenses with information that indicates the software is in beta status.
Key Properties:
Build Type: Specifies the build type (e.g., "Alpha", "Beta", "RC") to indicate the development stage of the software.
Recent Changes: A text field where you can document changes or features specific to this beta release.
Use Cases:
Distributing early access versions to testers or select customers
Time-limited beta programs before full product release
Limiting liability by clearly identifying software as pre-release
Implementation Example:
Hardware Restriction
The Hardware restriction binds a license to specific hardware, preventing unauthorized use on different machines. This is achieved through a hardware key generated from the target computer's unique characteristics.
Key Properties:
Hardware Key: A unique identifier generated from hardware components of the machine (can be empty in the template and filled during license activation).
Data: Additional data that can be used to store hardware-specific information.
Use Cases:
Single-machine perpetual licenses
Preventing license sharing across multiple devices
High-security environments where software must be bound to authorized hardware
Trial Restriction
The Trial restriction limits software usage based on time or execution parameters, making it ideal for implementing free trial versions of your software.
Key Properties:
Expire Days: Number of days the trial is valid after first use.
Run Instances: Maximum number of concurrent instances allowed.
Run Count: Maximum total number of application executions allowed.
Run Time: Maximum duration the application can run per session.
Terms: Special terms and conditions that apply to the trial license.
Use Cases:
Time-limited evaluation versions
Feature-limited trial versions
Usage-count limited demo versions
Freemium model implementation
Implementation Example:
Domain Restriction
The Domain restriction limits license usage to a specific network domain, ensuring that software can only be used within authorized organizational boundaries.
Key Properties:
Domain: The network domain name where the license is valid (e.g., "example.com").
Role: Optional role identifier within the domain (e.g., "developer", "admin").
Use Cases:
Enterprise licensing for specific organizations
Limiting software use to authorized corporate networks
Different licensing terms for different organizational units
Usage Restriction
The Usage restriction defines the environment where the application is allowed to run, providing control over deployment scenarios and execution contexts.
Key Properties:
Usage: Identifies the allowed usage environment or context.
Can Run In Virtual Environment: When true, allows the software to run in virtualized environments.
Process List: A list of processes that must or must not be running for the license to be valid.
Use Cases:
Preventing execution in virtual machines for security-sensitive applications
Limiting software to specific environments (development, staging, production)
Requiring or prohibiting the presence of specific companion processes
Custom Restrictions
Beyond the built-in restrictions, Babel Licensing allows you to create custom restrictions to address unique licensing requirements specific to your application. Custom restrictions are powerful extensions that enable you to implement specialized validation logic tailored to your specific business and technical needs.
Implementing Custom Restrictions
To create a custom restriction, you need to implement a class that inherits from Restriction
and implements the ILicenseSerializable
interface. This gives you complete control over both the validation logic and how the restriction is serialized in the license file.
Key Components of a Custom Restriction:
Name Property: A unique identifier for your restriction type.
Custom Properties: Properties specific to your restriction's functionality.
Validation Logic: Custom code that determines whether the license is valid based on your criteria.
Serialization Methods: Methods to read and write your restriction data to XML or format.
Example: Memory Requirements Restriction
Here's an example of a custom restriction that validates whether a machine meets minimum memory requirements.
Full sample project is available on GitHub:
Using Custom Restrictions in License Creation
Once you've defined your custom restriction class, you can use it when generating licenses:
Use Cases for Custom Restrictions
Custom restrictions can address a wide range of specialized licensing requirements:
Hardware Requirements: Ensure software only runs on machines meeting minimum specifications.
Network Configuration: Validate specific network configurations or connectivity requirements.
Time-Zone Restrictions: Limit software use to specific geographic regions based on time zones.
Application Co-existence: Verify that required companion applications are installed.
Database Engine Validation: Ensure compatible database systems are present.
Cloud Environment Detection: Apply special rules for cloud-hosted deployments.
Custom Business Rules: Implement industry-specific or organization-specific licensing rules.
Custom Restrictions and License Templates
Custom restrictions can be seamlessly integrated into the Babel Licensing template system, allowing you to save and reuse license configurations that include your custom validation logic. When saved as part of a license template in the Babel Licensing Service, these custom restrictions become reusable components that can be applied consistently across multiple licenses.
Storing Custom Restrictions in License Templates
Once you've implemented a custom restriction, you can incorporate it into a license template through the Babel Licensing Service:
Create your license with the custom restriction as shown in the previous example.
Save this license as a template in the Babel Licensing Database.
The template, including the custom restriction, becomes available for generating new licenses.
Benefits of Template-Based Custom Restrictions
Storing custom restrictions in license templates offers several advantages:
Consistency: Ensures that all licenses generated from the template apply the same custom validation rules, maintaining consistency across your licensing strategy.
Centralized Management: Manage your custom restrictions from a single location within the Babel Licensing Service, making it easier to update or modify licensing rules.
Simplified License Generation: Generate new licenses with complex custom restrictions without having to reimplement the validation logic each time.
Versioning and Tracking: Keep track of different versions of your custom restrictions as your licensing requirements evolve.
Integration with Licensing Workflows: Incorporate custom restrictions into your existing licensing processes, such as license activation, floating licenses, or file-based licenses.
Example Workflow
Here's a typical workflow for utilizing custom restrictions within the Babel Licensing Service template system:
Development: Create and test your custom restriction class in your development environment.
Template Creation: Develop a license with your custom restriction and save it as a template:
License Generation: Use the template to generate specific licenses for customers.
Distribution: Distribute the generated license to the customer using your preferred delivery method (direct download, email, activation code, etc.).
Validation: When the customer uses your application, the custom restriction validation logic is executed as part of the license validation process.
Implementing Template-Compatible Custom Restrictions
To ensure your custom restrictions work well within the template system, consider these implementation guidelines:
Parameter Flexibility: Design your custom restriction class to support both parameterized initialization (for programmatic creation) and parameter-less initialization (for template-based creation).
XML Serialization: Implement the
IXmlSerializable
interface properly to ensure your custom restriction's configuration can be saved to and loaded from license templates.Backward Compatibility: Maintain backward compatibility when updating custom restrictions to ensure that existing templates and licenses continue to function.
Error Handling: Implement robust error handling in both your serialization and validation logic to prevent issues when your custom restriction is used in a template.
Integration with Babel Licensing Service Features
Custom restrictions stored in templates can leverage the full suite of Babel Licensing Service features:
Activation Licenses: Apply custom restrictions to licenses that require activation, adding your specialized validation to the activation process.
Floating Licenses: Use custom restrictions with floating licenses to add specialized validation criteria to concurrent license usage.
File Licenses: Include custom restrictions in file-based licenses for offline validation scenarios.
By incorporating custom restrictions into your license templates within the Babel Licensing Service, you create a powerful, flexible, and maintainable licensing system that can address even the most unique and specialized licensing requirements while maintaining the benefits of centralized license management.
Best Practices for Custom Restrictions
Keep Validation Fast: Custom restriction validation code runs during license checking, so keep it efficient.
Handle Exceptions: Ensure your validation code handles exceptions gracefully to prevent application crashes.
Provide Clear Feedback: When validation fails, return meaningful information about why the validation failed.
Secure Sensitive Logic: Any sensitive validation logic in your custom restriction could be subject to reverse engineering; consider obfuscation for critical code.
Test Comprehensively: Test your custom restrictions in various environments to ensure consistent behavior.
Document Thoroughly: Document your custom restrictions for both internal development and customer-facing materials.
Custom restrictions extend Babel Licensing's capabilities to address unique licensing requirements, providing a flexible and powerful licensing solution tailored to your specific needs. These specialized validation rules enable you to implement precisely the licensing model your application requires, giving you complete control over how your software is licensed and used.
Combining Restrictions
A powerful feature of Babel Licensing is the ability to combine multiple restrictions to create sophisticated licensing models. For example, you might combine:
Trial + Hardware: A time-limited trial that's bound to a specific machine
Domain + Usage: A license valid only within a corporate domain and in non-virtual environments
Beta + Custom: A beta license with custom restrictions for specific testing scenarios
When multiple restrictions are applied, all restrictions must be satisfied for the license to be considered valid. This allows for precise control over how your software is licensed and used.
Best Practices for Using Restrictions
Start Simple: Begin with the minimum restrictions necessary and add more as your licensing needs evolve.
Consider User Experience: Balance security with usability. Overly restrictive licenses may frustrate legitimate users.
Provide Clear Feedback: When a restriction causes a license validation failure, ensure your application provides clear information about why the license is invalid.
Test Thoroughly: Test all restriction combinations to ensure they work as expected in various scenarios.
Document for End Users: Clearly document the restrictions applied to each license type so customers understand the limitations.
Implement Graceful Degradation: Where possible, consider allowing limited functionality rather than complete application failure when certain restrictions are not met.
Effective utilization of license restrictions in your templates creates a flexible licensing system that protects your intellectual property while providing appropriate access to customers based on their licensing level. These restrictions serve as the foundation for implementing sophisticated licensing models that balance security with usability, ensuring that your software is used according to your licensing terms while delivering a seamless experience for legitimate users.
Last updated