Show / Hide Table of Contents

Class WMPrincipal

Abstract base class representing an entity to which access privileges can be granted.

Inheritance
object
WMPrincipal
WMOrganization
WMUser
WMProxyPrincipal
Implements
IDbEntity
IWMEntity
IPolicyAssignable
IWMAssetOwner
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: Quantellia.WMServer.Auth
Assembly: WMServer.dll
Syntax
public abstract class WMPrincipal : IDbEntity, IWMEntity, IPolicyAssignable, IWMAssetOwner

Constructors

WMPrincipal()

Default constructor initializes ID with a new GUID.

Declaration
public WMPrincipal()

WMPrincipal(string)

Declaration
public WMPrincipal(string id)
Parameters
Type Name Description
string id

Properties

CreatedBy

ID of the user that created this entity.

Declaration
public string CreatedBy { get; set; }
Property Value
Type Description
string

CreatedDate

Date and time at which this entity was last updated.

Declaration
public DateTime CreatedDate { get; set; }
Property Value
Type Description
DateTime

DomainID

The ID of the WMPrincipal.Domain this principal is logged in under. If Individual, this is irrelevant. If Organization, this is the OrganizationID.

Declaration
[NotMapped]
public string DomainID { get; }
Property Value
Type Description
string

DomainIDClaim

The claim name contained in a Token detailing the domain a user has logged in under.

Declaration
public static string DomainIDClaim { get; }
Property Value
Type Description
string

DomainType

The WMPrincipal.Domain this principal is logged in under. Dictates the principal's behavior, including whether they can login at all.

Declaration
[NotMapped]
[JsonConverter(typeof(StringEnumConverter))]
public WMPrincipal.Domain DomainType { get; }
Property Value
Type Description
WMPrincipal.Domain

DomainTypeClaim

The claim name contained in a Token detailing the domain type a user has logged in under.

Declaration
public static string DomainTypeClaim { get; }
Property Value
Type Description
string

ID

Declaration
public string ID { get; protected set; }
Property Value
Type Description
string

IsSysAdmin

Checks whether the principal is a user, and a sysadmin.

Declaration
[NotMapped]
public bool IsSysAdmin { get; }
Property Value
Type Description
bool

LastUpdatedBy

ID of the user that last updated this entity.

Declaration
public string LastUpdatedBy { get; set; }
Property Value
Type Description
string

LastUpdatedDate

Date and time at which this entity was last updated.

Declaration
public DateTime LastUpdatedDate { get; set; }
Property Value
Type Description
DateTime

Name

Actual name of the principal

Declaration
public string Name { get; set; }
Property Value
Type Description
string

Policies

List of Policy instances assigned to this WMPrincipal

Declaration
public virtual List<Policy> Policies { get; }
Property Value
Type Description
List<Policy>

Status

Declaration
public PrincipalStatus Status { get; set; }
Property Value
Type Description
PrincipalStatus

Methods

AssignDomain(Domain, string)

Assigns a domain to this principal. This must be called in GetUser(ControllerBase), which evaluates the token claims for a domain, and if one is found, assigns it. Nowhere else in the application should this be called, and the user should always be found with GetUser(ControllerBase)

Declaration
public void AssignDomain(WMPrincipal.Domain domainType, string domainID)
Parameters
Type Name Description
WMPrincipal.Domain domainType
string domainID

Get(string, string)

Static factory that gets the instance of a WMPrincipal sub-class depending on its type and ID.

Declaration
public static Task<WMPrincipal> Get(string typeName, string id)
Parameters
Type Name Description
string typeName
string id
Returns
Type Description
Task<WMPrincipal>

HashPassword(string, out string)

Declaration
public static string HashPassword(string password, out string salt)
Parameters
Type Name Description
string password
string salt
Returns
Type Description
string
Exceptions
Type Condition
ArgumentNullException

VerifyPassword(string, string, string)

Declaration
public static bool VerifyPassword(string password, string hash, string salt)
Parameters
Type Name Description
string password
string hash
string salt
Returns
Type Description
bool
Exceptions
Type Condition
ArgumentNullException

Implements

IDbEntity
IWMEntity
IPolicyAssignable
IWMAssetOwner
In this article
Back to top Copyright © 2025 Quantellia LLC.    Version 2.0.0 Revision 399     Last Updated 1/15/2025    DRAFT DOCUMENTATION. SUBJECT TO CHANGE