KeyMaster.NET
IUserPermissions Interface
KeyMaster.NETCaplin.KeyMaster.PermissioningIUserPermissions
Interface that represents the permissions for a single user.
Declaration Syntax
C#Visual BasicVisual C++
public interface IUserPermissions
Public Interface IUserPermissions
public interface class IUserPermissions
Members
All MembersMethods



IconMemberDescription
AddMapping(ISubjectMapping)
Adds a new subject mapping to the user's permissioning information.

AddPermission(IPermission)
Adds a new subject permission to the user's permissioning information.

ToPermissionString()()()
Returns a string representation of the user's permissions.

Examples

This example demonstrates how to insert an IUserPermissions into a token.

CopyC#
using System;
using System.Collections.Generic;
using System.Text;

using Caplin.KeyMaster;
using Caplin.KeyMaster.Permissioning;
using Caplin.KeyMaster.Formatters;

namespace KeyMasterSnippets.Permissioning
{
    public class CreateTokenWithPermissions
    {
        public string GenerateToken(IKeyMaster keymaster, string username, IUserPermissions permissions)
        {
            // Create a set of authentication parameters that encapsulate the permissions.
            IAuthenticationParameters authParams = new AuthenticationParameters(username, permissions);

            // Create a new formatter instance (they can be reused).
            IKeyMasterFormatter formatter = new StandardFormatter();

            // Generate and return the KeyMaster token.
            return keymaster.GenerateToken(authParams, formatter);
        }


    }
}

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