KeyMaster.NET
ISubjectMapping Interface
KeyMaster.NETCaplin.KeyMaster.PermissioningISubjectMapping
Interface that represents the mapping of a set of subjects from one namespace to another.
Declaration Syntax
C#Visual BasicVisual C++
public interface ISubjectMapping
Public Interface ISubjectMapping
public interface class ISubjectMapping
Members
All MembersProperties



IconMemberDescription
MapFromPattern
Gets or sets the pattern that will match a request for a subject.

MapToPattern
Gets or sets the pattern that client requests matching MapFromPattern will be mapped to.

Remarks

The patterns used within the permissioning system are Basic or Extended regular expressions. The full .NET regular expressions syntax is not supported. However, the syntax for the most common regular expression operations is the same in each case. For more information on the various regular expression syntaxes, see www.regular-expressions.info.

Regular expression captures can be used to perform substitution between the MapFromPattern and MapToPattern. This functionality can be used to implement tiering for StreamLink clients. For example, setting a MapFromPattern to ^/FX/(.*) and the MapToPattern to ^/FX/TIER1/(1) causes all client requests within the /FX namespace to be mapped to "TIER1" prices; thus a request for the subject /FX/EURGBP is mapped to /FX/TIER1/EURGBP.

Examples

This example demonstrates implementing tiering on FX instruments for a non-trading user.

CopyC#
using System;
using System.Collections.Generic;
using System.Text;
using Caplin.KeyMaster.Permissioning;

namespace KeyMasterSnippets.Permissioning
{
    public class SettingATierForAUser
    {
        public IUserPermissions CreateTieredPermission()
        {
            // Create an empty set of permissions.
            IUserPermissions userPerms = new UserPermissions();

            // Create a mapping so that any request for /FX/.* is mapped to /FX/TIER1/.*
            userPerms.AddMapping(new SubjectMapping("^/FX/(.*)", "/FX/TIER/(1)"));

            // Add a read permission for /FX/TIER1/*
            userPerms.AddPermission(new Permission("^/FX/TIER1/.*", true, false, false));

            return userPerms;
        }

    }
}

Assembly: Caplin.KeyMaster (Module: Caplin.KeyMaster) Version: 5.0.4.0 (5.0.4.0)