Class SecurityServices

All Implemented Interfaces:
IConfigurableObject, INotScriptFriendly, ISupportsDeprecation, IDiffableObject, IAvatar, IEntityLifeCycleEvent, IPersistable, IServiceProvider, ITaggableObject, IDependencyScannableObject, IEntityDefinition, IPersistableObject<String>, IDesignTimeSecurable, IDesignTimeSecurableEntity, IRunTimeSecurable, IRunTimeSecurableEntity, ISecurable, IVisibilitySecurable, IVisibilitySecurableEntity, IAspectContainer, INamedObject, Serializable

@ThingworxExtensionApiClass(since={8,5,1}) public class SecurityServices extends Resource
See Also:
  • Constructor Details

    • SecurityServices

      protected SecurityServices()
  • Method Details

    • SanitizeHtml

      @ThingworxExtensionApiMethod(since={8,5,1}) public InfoTable SanitizeHtml(String html, String policy) throws Exception
      Service Category:
      Service Description:
      Sanitizes the specified HTML string using the rules defined by the specified Policy. Valid Policy names are: "default", "blog", "wiki", "none".


      Sanitizes the specified HTML string using the rules defined by the specified Policy.

      The returned InfoTable will contain one row.

      The "HtmlSanitizationResult" DataShape describes the returned InfoTable, and defines the following fields:

      • "policy" : the name of the policy specified when this Service was invoked
      • "sanitizationId" : the arbitrary, but unique, identifier for this result (useful for logging, etc)
      • "sanitizedHtml" : the resulting sanitized HTML string
      Parameters:
      html - the non-null HTML String to sanitize
      policy - the name of the Policy defining the rules by which the specified HTML string is to be sanitized
      Returns:
      a non-null, single-row InfoTable, defined by the "HtmlSanitizationResult" DataShape, containing the sanitized results
      Throws:
      Exception - if html is null, or if policy does not match a valid policy name
    • SanitizeBatchHtml

      @ThingworxExtensionApiMethod(since={8,5,4}) public InfoTable SanitizeBatchHtml(org.json.JSONObject batch, String policy) throws Exception
      Service Category:
      Service Description:
      Sanitizes the specified batch of HTML strings using the rules defined by the specified Policy. Valid Policy names are: "default", "blog", "wiki", "none". The keys within the "batch" parameter are arbitrary, but must be unique to the batch. The expected JSON syntax for the "batch" parameter is: {"key-1":"html-string-to-sanitize-1", "key-2":"html-string-to-sanitize-2", ... }.


      Sanitizes the specified batch HTML strings using the rules defined by the specified Policy.

      The format of the specified batch must be:

            {
                "<key-1>" : "<html-string-to-sanitize-1>",
                "<key-2>" : "<html-string-to-sanitize-2>",
                ...
            }
        
      ...where the arbitrary keys must be unique to the batch.

      The returned InfoTable will contain one row for every key/value pair in the specified batch.

      The "HtmlSanitizationBatchResult" DataShape describes the returned InfoTable, and defines the following fields:

      • "batchId" : the arbitrary, but unique, identifier for the batch that produced these results (useful for logging, etc)
      • "policy" : the name of the policy specified when this Service was invoked
      • "key" : the key passed into this Service for a given HTML string
      • "sanitizationId" : the arbitrary, but unique, identifier for the result of sanitizing the HTML string keyed by the key in the specified batch (useful for logging, etc)
      • "sanitizedHtml" : the resulting sanitized HTML string for the key
      Parameters:
      batch - the non-null JSON object containing arbitrary (but unique to the batch) keys, whose corresponding values are the HTML strings to sanitize
      policy - the name of the Policy defining the rules by which the specified HTML string is to be sanitized
      Returns:
      a non-null, multi-row InfoTable, defined by the "HtmlSanitizationBatchResult" DataShape, containing the sanitized results
      Throws:
      Exception - if batch is null, or contains duplicate or null keys, or contains null or non-alphanumeric values, or if policy does not match a valid policy name