Gateway

Gateway portal customization using custom plug-ins

NetScaler Gateway RfWebUi framework provides the ability to add the custom plug-ins to customize their gateway portal. These custom plug-ins can be used to add large functionality to the gateway, such as if you want to add an entire new page in the gateway flow. For other use cases the code can be added to the custom script file provided for gateway themes at the location /var/netscaler/logon/themes/<custom_theme>/script.js.

Note:

NetScaler Gateway only supports the creation and usage custom plug-ins for the portal customization. NetScaler Gateway does not create or provide any custom plug-ins based on customer requirements.

  1. To add a custom plug-in, create the JavaScript file at the location /var/netscaler/logon/LogonPoint/plugins/ns-gateway/. For example, you can find the following plug-ins in /var/netscaler/logon/LogonPoint/plugins/ns-gateway/.

    • ns-nfactor.js

    • nsg-epa.js

    • nsg-setclient.js

    It is recommended to enter the plug-in name in the format <plugin_name>.js.

    All these plug-in files are fetched by the RfWebUI framework required by the functionality.

  2. After creating the plug-in file, use the following code as an example to register the plug-in with the RfWebUI framework.

            (function ($) {
                        CTXS.ExtensionAPI.addPlugin( {
                                    Name : “plugin name”,
                                    initialize: function() {}
                        });
                })(jQuery);
    <!--NeedCopy-->
    

    where,

    name is the name given to the plug-in. It is used as the identifier to the plug-in.

    initialize takes the function as the parameter which is used to initialize the plug-in.

  3. Enter the plug-in name and initialization function in the CTXS.ExtensionAPI.addPlugin() function to register the plug-in. The added plug-in name and location must be registered to the plugins.xml file at the location /var/netscaler/logon/themes/<custom_theme>/plugins.xml.

  4. After writing the plug-in code, the newly added plug-in name and location must be registered with the plugins.xml file at the location /var/netscaler/logon/themes/<custom_theme>/plugins.xml. The plug-in must be registered with the plug-in tag.

    <plugins>
    <plugin name="nsg-epa" src="plugins/ns-gateway/nsg-epa.js"/>
    <plugin name="nsg-setclient" src="plugins/ns-gateway/nsg-setclient.js"/>
    <plugin name="ns-nfactorn" src="plugins/ns-gateway/ns-nfactor.js"/>
    </plugins>
    <!--NeedCopy-->
    
  5. Enter a name and src for the plug-in so that RFWebUI can identify and fetch the plug-in.

Example configuration

The following example configurations can be used to add a custom plug-in to add a footer to the NetScaler Gateway logon page.

  1. Create the JavaScript plug-in file in the location, /var/netscaler/logon/LogonPoint/plugins/ns-gateway/.
  2. Name the plug-in as ns-footer.js /var/netscaler/logon/LogonPoint/plugins/ns-gateway/ns-footer.js
  3. Add the following code to the registered plug-in to the RfWebUI and in the initialization function add the footer to the gateway.

    (function ($) {
    CTXS.ExtensionAPI.addPlugin({
        name: "ns-footer", // Name of plugin - must match name sent in configuration
        initialize: function () {
            
        // Add the footer for the login page
        $("#customExplicitAuthBottom").append("<div style='text-align:center;color:white;font-size:15px;'><br />Disclaimer<br /><br />"+" Access to this website is restricted to employees of Login Consultants<br/></div>");
    
        // To Add the footer to the login timeout page
        $("#customAuthBottom").append("<div style='text-align:center;color:white;font-size:15px;'><br >Disclaimer<br /><br />"+" Access to this website is restricted to employees of Login Consultants<br /></div>");
            
        callback();
        }
    });
    })(jQuery);
    <!--NeedCopy-->
    
  4. Save the file.
  5. Add the name and src in the plugins.xml at the location var/netscaler/logon/themes/<custom_theme>/plugins.xml.

    <plugins>
    <plugin name="nsg-epa" src="plugins/ns-gateway/nsg-epa.js" />
    <plugin name="nsg-setclient" src="plugins/ns-gateway/nsg-setclient.js" />
    <plugin name="ns-nfactor" src="plugins/ns-gateway/ns-nfactor.js" />
    <plugin name="ns-footer" src="plugins/ns-gateway/ns-footer.js" />
    </plugins>
    <!--NeedCopy-->
    
  6. Configure the custom theme for which the plug-in is added.
  7. Flush the cache using the command flush cache contentgroup loginstaticobjects.
  8. Reload the portal screen. The footer is added to the NetScaler Gateway login page. Custom portal code
Gateway portal customization using custom plug-ins