Precision Healthcare Solutions
CLINICAL OFFICE MPAGE SUITE DEVELOPER REPORTS DESIGNER shopping_cart mail
SALES CONTACT US
Getting StartedCerner SetupDeveloper PC SetupGitHub Project TemplatesFull Page DeploymentWorkflow ComponentsComponents & DirectivesButtonConfirm DialogDate Range PickerDrop-DownEmbedded WorkflowIconInputLogOptional TitlePatient SearchPrevent ScrollRadio ButtonsRemaining Screen SpaceResize ObserverScroll BarSelectTabbed MenuTableTreeModels & ServicesAddressAllergyCerner FunctionsCode ValueConfigCustom Custom Data DMInfoDiagnosisDialogEncounterLicenseMPageOrganizationPersonPersonnelPhoneProblemReferenceUtility

License Service

Overview

If you are monetizing your Cerner MPages, you need a way to control who accesses your MPage, what Cerner domain they access it from and for how long. The License Service provides a simple to implement way of adding commercial license controls to your MPages.

The License Service makes no assumptions of where you store your client licenses. For full page MPages you can store your license in the config.json file and read it with the ConfigService, or you can use the Custom Data service to store and retrieve your license keys directly from Cerner. Finally, you also have the option of storing your license keys with a custom solution that suits your business needs.

The encrypt/decrypt methods use CryptoES to encrypt and decrypt your license keys.

Import

import {Component, inject, OnInit, ...etc...} from '@angular/core';
import {LicenseService} from '@clinicaloffice/mpage-developer';

Object Assignment

Using the Angular inject command, assign the LicenseService to a new object. It is recommended that you scope your object as "protected" to allow access to your component HTML.

@Component({...
...})
export class YourComponent implements OnInit {
    protected licenseService = inject(LicenseService);
    ....remaining code...

Methods / Usable Objects

decrypt(encryptedData: string | undefined, product: string, secret: string | undefined): string

The decrypt method decrypts the incoming encryptedData using the product and secret properties. If decryption is successful, the license and status methods will use the decrypted data for all operations.

encrypt(data: ILicense, product: string, secret: string): string

The encrypt method uses the product and secret properties to encrypt the content of your data ILicense object.

The ILicense interface is described at the bottom of this page and offers storage of a minimum of four required properties which are product, a string array of domains, validFromDate and validToDate. Your array of domains can contain individual domain names (e.g. ["b1234","c1234","p1234"] or if your domains end with the same text, it can be used as a wildcard (e.g. ["1234"]).

In addition to the required fields, you can optionally assign a licenseType string, licensedTo properties for customer information and custom data of your choosing in the otherData property.

license(product: string): ILicense | undefined

Returns an ILicense object containing the license content for the specified product.

status(product: string): ILicenseStatus

Returns an ILicenseStatus object containing the status of a product license. This includes boolean properties indicating if the license is invalid, expired and a numeric property called daysToExpiration which indicates how many days are left on the license.

Interfaces

ILicense {
  product: string;
  domains: string[];
  validFromDate: Date;
  validToDate: Date;
  licenseType?: string;
  licensedTo?: {
    organization: string;
    contactName?: string;
    address?: string[];
    workPhone?: string;
    mobilePhone?: string;
    email?: string;
  }
  otherData?: any;
}
ILicenseStatus {
  invalid: boolean;
  expired: boolean;
  daysToExpiration: number;
}
<< Prev: Encounter
Next: MPage >>
Copyright © 2026 Precision Healthcare Solutions