The Security Manager Object

Internet Explorer

Security Manager is a non-visual object and should be instantiated in the <head> or <body> section of a document as early as possible. Here is an example of a Security Manager object which validates ScriptX's advanced printing:

<!-- MeadCo Security Manager -->
<object id="secmgr" style="display:none"
 classid="clsid:5445be81-b796-11d2-b931-002018654e2e"
 codebase="http:// [your path here]/smsx.cab#Version=8,0,0,56
">
 <param name="GUID" value="{YOUR_LICENSE_GUID}" />
 <param name="Path" value=http://[your path here]/sxlic.mlf />
 <param name="Revision" value="[YOUR_LICENSE_REVISION]" />
 <param name="PerUser" value="true" />
</object>

<!-- Followed by the MeadCo ScriptX Factory object -->
<!-- MeadCo ScriptX -->
<object id=factory style="display:none"
 classid="clsid:1663ed61-23eb-11d2-b92f-008048fdd814">
</object>

The 'PerUser' parameter determines where a validated and accepted license is stored locally.

If the 'PerUser' value is 'true' then a valid and accepted license is stored in the user's registry.

If the 'PerUser' value is 'false' then it will be stored in the local machine registry. For the machine case and when protected mode is enabled in Internet Explorer, an elevation prompt will occur to enable this.

ScriptXtra

Security Manager is built into the ScriptXtra plugin for NPAPI compatible browsers. The license is specified with attributes of the <embed /> tag for the ScriptXtra plug-in:

<embed width="100%" height="100%"
  type="application/x-meadco-scriptxtra-ax"
  href="http://mywebapp/login.aspx" 
  LicenseGUID="{YOUR_LICENSE_GUID}"
  LicensePath="http://[your path here]/sxlic.mlf"
  LicenseRevision="[YOUR_LICENSE_REVISION]"
  LicensePerUser="true"
 />

Acceptance and installation of the license is as described in the next "How it works" section.

As when used with the Security Manager add-on for Internet Explorer the 'LicensePerUser' parameter determines where a validated and accepted license is stored locally. When 'true' (the default) then a valid and accepted license is stored in the user's registry.

If the 'LicensePerUser' value is 'false' then it will be stored in the local machine registry. For the machine case and when UAC is enabled, Security Manager must also be installed and an elevation prompt will occur.

The license is not inherited

Please note that the license used to enable the ScriptXtra plugin is not "inherited" by any content loaded and displayed by the plugin; any required license must be authored in the content as described above for Internet Explorer.

Server side / Remote printing

In server side / remote printing scenarios Security Manager works as a vehicle for licensing the use of the COM objects in the ScriptX suite.

The license is pre-installed on a machine using a utility supplied by MeadCo.

The license is then reference and applied to the running service code to enable the advanced printing features of ScriptX. For example:

@{
    Layout = "~/_SiteLayout.cshtml";
    Page.Title = "Document printed";
    
    // apply the scriptx license
    var secMgr = new SecMgr.SecMgr();
    secMgr.Apply("", ConfigurationManager.AppSettings["licenseGUID"],
       int.Parse(ConfigurationManager.AppSettings["licenseRevision"]));
    ...
}

Applications

Any application that can utilise the ScriptX suite COM components and wants to use the advanced printing features of ScriptX must have access to a valid license file for the application and apply that license to the running application each time the application wishes to make use of advanced feastures. For example in a C# WPF desktop application:

/// <summary>
/// License this application for use of ScriptX Advanced features.
/// *NOTE* When debugging, must *not* Enable the Visual Studio Hosting Process 
/// (on Project properties -> Debug page)
/// </summary>
///
/// <param name="licenseUri">The Uri of the license file, 
///                      can be null/empty if using a machine license</param>
/// <param name="licenseGuid">The unique id of the license</param>
/// <param name="licenseRevision">The license revision</param>
private void ApplyScriptXLicense(Uri licenseUri, Guid licenseGuid, int licenseRevision)
{
   var secMgr = new SecMgr.SecMgr();

   try
   {
      secMgr.Apply(licenseUri.ToString(),
         "{" + licenseGuid.ToString() + "}",
         licenseRevision);
   }
   catch (Exception e)
   {
      MessageBox.Show(string.Format("Failed to license this application using: {0}\n\n
          The error was: {1}", 
          licenseUri == null ? "the machine license" : licenseUri.ToString(),e.Message),
          this.Title);
   }
}