Hardware Key
In the floating server, when the hardware key is plugged in and a hardware-key-requiring license is added to the floating server, the hardware ID of the server changes to the serial number of the hardware key. From then on, every other action that is done in this server uses the new hardware ID, as long as the hardware key is connected to the server. Multiple licenses can be activated using the same hardware key.
The following steps are required to activate a hardware-key-requiring license in the floating server:
- 1. Create a Hardware-Key-Requiring License
- Follow the instructions on our Hardware Key Licensing page to create a new license that requires hardware keys.
- 2. Start the Floating Server
- Launch the Floating Server and navigate to the configuration page.
- 3. Select the Authentication Method
- From the dropdown menu on the configuration page, select the method of license authentication:
- Key Auth
- User Auth
- Ensure that the checkbox for hardware key licenses is selected when adding a license that requires a hardware key.
- 4. Plug in the Hardware Key
- Ensure that a hardware key, which has been provisioned using the LicenseSpring platform, is plugged into the server.
- 5. Add the License
- Add the product that requires the hardware key (e.g., "hwbased") to the Floating Server. The server will recognize that the hardware key is connected.
- 6. Confirm License Activation
- After adding the product, the license will be successfully activated on the Floating Server. The hardware ID of the server will now change to the serial number of the hardware key, as long as the hardware key remains connected.
- 7. Observe the Hardware ID Change
- The hardware ID of the Floating Server will continue to use the hardware key’s serial number for all actions as long as the key is connected. If the hardware key is disconnected, the hardware ID will revert to its original value.
- 8. View Activation in LicenseSpring
- In the LicenseSpring platform, the license activation will be visible, showing that the hardware key’s serial number is being used as the hardware ID.
- 9. Add Additional Licenses
- Additional licenses, whether they require hardware keys or not, can also be added to the Floating Server. This includes both user-based and license-key authentication methods.
Once a hardware-key-based license is added to the server, any subsequent actions involving that license will first verify the hardware key's validity. If the key is invalid (e.g., disconnected), the action will fail.
It's important to note that shutting down the server will also invalidate the hardware key. Upon restarting the server, the key will no longer be recognized as valid. To restore its validity, the license must be re-added to the server.
Using the API to log in as an admin, add consumptions, feature consumptions, register a user, and register a user to a feature of a license that requires hardware key verification. This example takes advantage of authentication mode to enforce role-based access control. If you are using the server without authentication mode, you can omit the authorization headers.
- Use user/pass to login curl -u 'user1':'pass1' http://localhost:8080/auth -H "Accept: application/json" {"message":"Login successful","token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3MjY4NTU4OTMsImlhdCI6MTcyNjc2OTQ5Mywicm9sZSI6ImFkbWluIiwidXNlcm5hbWUiOiJ1c2VyMSJ9.fhJefnu7X7iECS3Brf36PVdqHRLeZIuwONTfkHdJnjA"}
- Add the product using the "isHWKeyReq" parameter curl -X GET "http://localhost:8080/api/v4/addProduct?product=hwbased&licenseKey=WTUS-5HHH-V8YP-WUHW&isHWKeyReq=yes" -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3MjY4NTU4OTMsImlhdCI6MTcyNjc2OTQ5Mywicm9sZSI6ImFkbWluIiwidXNlcm5hbWUiOiJ1c2VyMSJ9.fhJefnu7X7iECS3Brf36PVdqHRLeZIuwONTfkHdJnjA" -H "Accept: application/json" -H "Content-Type: application/json" -d '{}'
- Add consumptions curl -X POST "http://localhost:8080/api/v4/add_consumption" -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3MjY4NTU4OTMsImlhdCI6MTcyNjc2OTQ5Mywicm9sZSI6ImFkbWluIiwidXNlcm5hbWUiOiJ1c2VyMSJ9.fhJefnu7X7iECS3Brf36PVdqHRLeZIuwONTfkHdJnjA" -H "Accept: application/json" -H "Content-Type: application/json" -d '{"product":"hwbased", "consumptions": 2}'
- Add feature consumptions curl -X POST "http://localhost:8080/api/v4/add_feature_consumption" -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3MjY4NTU4OTMsImlhdCI6MTcyNjc2OTQ5Mywicm9sZSI6ImFkbWluIiwidXNlcm5hbWUiOiJ1c2VyMSJ9.fhJefnu7X7iECS3Brf36PVdqHRLeZIuwONTfkHdJnjA" -H "Accept: application/json" -H "Content-Type: application/json" -d '{"product":"hwbased", "feature": "consFeature2", "consumptions": 2}'
- Register User curl -X POST "http://localhost:8080/api/v4/register" -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3MjY4NTU4OTMsImlhdCI6MTcyNjc2OTQ5Mywicm9sZSI6ImFkbWluIiwidXNlcm5hbWUiOiJ1c2VyMSJ9.fhJefnu7X7iECS3Brf36PVdqHRLeZIuwONTfkHdJnjA" -H "Accept: application/json" -H "Content-Type: application/json" -d '{ "product": "hwbased", "user": "user1", "os_hostname": "", "ip_local": "0.1.1.1", "user_info": "", "registered_at": "2024-08-26T12:21:59.776731-07:00", "borrowed_until": "0001-01-01T00:00:00Z" }' If no errors occur, the license object will be returned.
- Register User to Feature curl -X POST "http://localhost:8080/api/v4/featureRegister" -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3MjY4NTU4OTMsImlhdCI6MTcyNjc2OTQ5Mywicm9sZSI6ImFkbWluIiwidXNlcm5hbWUiOiJ1c2VyMSJ9.fhJefnu7X7iECS3Brf36PVdqHRLeZIuwONTfkHdJnjA" -H "Accept: application/json" -H "Content-Type: application/json" -d '{ "product": "hwbased", "feature": "consFeature2", "user": "user2", "os_hostname": "", "ip_local": "0.1.1.1", "user_info": "", "registered_at": "2024-08-26T12:21:59.776731-07:00", "borrowed_until": "0001-01-01T00:00:00Z" }' response if no error: {"product":"hwbased","feature":"consFeature2","user":"user2","os_hostname":"","ip_local":"0.1.1.1","user_info":"","registered_at":"2024-09-19T12:39:16.356495803-07:00","borrowed_until":"0001-01-01T00:00:00Z"}
- Unplug the hardware key or restart the server, then add consumption curl -X POST "http://localhost:8080/api/v4/add_feature_consumption" -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3MjY4NTU4OTMsImlhdCI6MTcyNjc2OTQ5Mywicm9sZSI6ImFkbWluIiwidXNlcm5hbWUiOiJ1c2VyMSJ9.fhJefnu7X7iECS3Brf36PVdqHRLeZIuwONTfkHdJnjA" -H "Accept: application/json" -H "Content-Type: application/json" -d '{"product":"hwbased", "feature": "consFeature2", "consumptions": 2}' response: {"code":"hardware_key_not_accessible","message":"No available valid hardware key to perform the action: adding feature consumption","status":400}