13 public bool Valid {
get;
private set; }
16 public User User =>
user ??
throw new InvalidOperationException(
"AuthenticationContext is invalid!");
55 this.user =
user ??
throw new ArgumentNullException(nameof(
user));
57 throw new ArgumentNullException(nameof(systemIdentity));
60 ??
throw new ArgumentException(
"No PermissionSet provider", nameof(
user));
73 throw new InvalidOperationException(
"Authentication context has no user!");
82 var nullableType = typeof(Nullable<>);
83 var nullableRightsType = nullableType.MakeGenericType(rightsEnum);
85 var prop = typeToCheck.GetProperties().Where(x => x.PropertyType == nullableRightsType && x.CanRead).First();
87 var right = prop.GetMethod!.Invoke(
91 Array.Empty<
object>())
92 ??
throw new InvalidOperationException(
"A user right was null!");
string? SystemIdentifier
The SID/UID of the UserModelBase on Windows/POSIX respectively.
static bool IsInstanceRight(RightsType rightsType)
Check if a given rightsType is meant for an Models.Instance.
static Type RightToType(RightsType rightsType)
Map a given rightsType to its respective Enum Type.
PermissionSet? PermissionSet
The Models.PermissionSet the UserGroup has.
UserGroup? Group
The UserGroup the User belongs to, if any.
void Initialize(ISystemIdentity? systemIdentity, User user, InstancePermissionSet? instanceUser)
Initializes the AuthenticationContext.
AuthenticationContext()
Initializes a new instance of the AuthenticationContext class.
PermissionSet? permissionSet
Backing field for PermissionSet.
ISystemIdentity? SystemIdentity
The ISystemIdentity of User if applicable.
bool Valid
If the IAuthenticationContext is for a valid login.
ulong GetRight(RightsType rightsType)
Get the value of a given rightsType . The value of rightsType . Note that if InstancePermissionSet is...
User? user
Backing field for User.
Represents the currently authenticated Models.User.
Represents a user on the current global::System.Runtime.InteropServices.OSPlatform.
RightsType
The type of rights a model uses.