Class WMPrincipal
Abstract base class representing an entity to which access privileges can be granted.
Assembly: WMServer.dll
Syntax
public abstract class WMPrincipal : IDbEntity, IWMEntity, IPolicyAssignable, IWMAssetOwner
Constructors
WMPrincipal()
Default constructor initializes ID with a new GUID.
Declaration
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
CreatedDate
Date and time at which this entity was last updated.
Declaration
public DateTime CreatedDate { get; set; }
Property Value
DomainID
Declaration
[NotMapped]
public string DomainID { get; }
Property Value
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
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
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
ID
Declaration
public string ID { get; protected set; }
Property Value
IsSysAdmin
Checks whether the principal is a user, and a sysadmin.
Declaration
[NotMapped]
public bool IsSysAdmin { get; }
Property Value
LastUpdatedBy
ID of the user that last updated this entity.
Declaration
public string LastUpdatedBy { get; set; }
Property Value
LastUpdatedDate
Date and time at which this entity was last updated.
Declaration
public DateTime LastUpdatedDate { get; set; }
Property Value
Name
Actual name of the principal
Declaration
public string Name { get; set; }
Property Value
Policies
Declaration
public virtual List<Policy> Policies { get; }
Property Value
Status
Declaration
public PrincipalStatus Status { get; set; }
Property Value
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
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
Returns
HashPassword(string, out string)
Declaration
public static string HashPassword(string password, out string salt)
Parameters
Returns
Exceptions
VerifyPassword(string, string, string)
Declaration
public static bool VerifyPassword(string password, string hash, string salt)
Parameters
Returns
Exceptions
Implements