Class LicenseService

java.lang.Object
dev.demeng.sentinel.client.license.LicenseService

public final class LicenseService extends Object
Facade for all license operations against the Sentinel API.

Obtain an instance via SentinelClient.licenses().

  • Constructor Details

    • LicenseService

      public LicenseService(dev.demeng.sentinel.client.internal.SentinelHttpClient httpClient, dev.demeng.sentinel.client.internal.ApiResponseParser apiResponseParser, dev.demeng.sentinel.client.internal.LicenseResponseParser licenseResponseParser, dev.demeng.sentinel.client.internal.PageResponseParser pageResponseParser, com.google.gson.Gson gson, @Nullable dev.demeng.sentinel.client.internal.SignatureVerifier signatureVerifier, @Nullable dev.demeng.sentinel.client.internal.ReplayProtector replayProtector)
  • Method Details

    • connections

      public LicenseConnectionOperations connections()
      Returns the operations handle for managing license connections.
      Returns:
      the connection operations
    • subUsers

      public LicenseSubUserOperations subUsers()
      Returns the operations handle for managing license sub-users.
      Returns:
      the sub-user operations
    • servers

      public LicenseServerOperations servers()
      Returns the operations handle for managing license server identifiers.
      Returns:
      the server operations
    • ips

      public LicenseIpOperations ips()
      Returns the operations handle for managing license IP addresses.
      Returns:
      the IP operations
    • validate

      public ValidationResult validate(ValidationRequest request) throws SentinelException
      Validates a license key against the Sentinel API.

      On validation failure (e.g. expired or blacklisted license), this method returns a ValidationResult with ValidationResult.isValid() returning false rather than throwing an exception. Use ValidationResult.requireValid() to throw on failure instead.

      If signature verification is enabled, the response signature and nonce are verified before returning. Tampered or replayed responses will throw the appropriate exception.

      Parameters:
      request - the validation request containing the license key and context
      Returns:
      the validation result
      Throws:
      SentinelException - if a network, API, signature, or replay error occurs
    • create

      public License create(CreateLicenseRequest request) throws SentinelException
      Creates a new license.
      Parameters:
      request - the creation parameters
      Returns:
      the created license
      Throws:
      SentinelException - if a network or API error occurs
    • get

      public License get(String key) throws SentinelException
      Retrieves a license by key.
      Parameters:
      key - the license key
      Returns:
      the license
      Throws:
      SentinelException - if a network or API error occurs
    • list

      public Page<License> list(ListLicensesRequest request) throws SentinelException
      Lists licenses matching the given criteria.
      Parameters:
      request - the filter and pagination parameters
      Returns:
      a page of licenses
      Throws:
      SentinelException - if a network or API error occurs
    • update

      public License update(String key, UpdateLicenseRequest request) throws SentinelException
      Partially updates a license.
      Parameters:
      key - the license key
      request - the fields to update
      Returns:
      the updated license
      Throws:
      SentinelException - if a network or API error occurs
    • delete

      public void delete(String key) throws SentinelException
      Deletes a license.
      Parameters:
      key - the license key
      Throws:
      SentinelException - if a network or API error occurs
    • regenerateKey

      public License regenerateKey(String key) throws SentinelException
      Regenerates the key for a license, assigning a random new key.
      Parameters:
      key - the current license key
      Returns:
      the license with its new key
      Throws:
      SentinelException - if a network or API error occurs
    • regenerateKey

      public License regenerateKey(String key, @Nullable String newKey) throws SentinelException
      Regenerates the key for a license, optionally specifying the new key.
      Parameters:
      key - the current license key
      newKey - the desired new key, or null for a random key
      Returns:
      the license with its new key
      Throws:
      SentinelException - if a network or API error occurs