This section defines default Principal and identity objects shipped with the NGWS runtime. Applications may define their own objects to deal with specific needs. These objects may be referenced across multiple threads within an AppDomain, and so must be thread safe.
namespace System.Security.Principal public class GenericPrincipal : IPrincipal { // Constructors public GenericPrincipal (IIdentity identity, String [] roles) {} // IPrincipal Properties public IIdentity Identity { get; } // IPrincipal Method public virtual bool IsInRole(String Role); }
namespace System.Security.Principal public class GenericIdentity : IIdentity { // Constructors. public GenericIdentity (String name) public GenericIdentity (String name, String type) // IIdentity Properties public String Name { get; } public String Type { get; } public bool IsAuthenticated {get;} }
Notes:
namespace System.Security.Principal public class WindowsPrincipal : IPrincipal { // Public Constructor public WindowsPrincipal (WindowsIdentity ntIdentity) {} // IPrincipal Property public IIdentity Identity { get;} // IPrincipal Method public virtual bool IsInRole (String Role); // Populate the list of NT groups in which this entity is present private void PopulateGroups(); }
Notes:
namespace System.Security.Principal public class WindowsIdentity : IIdentity { // IIdentity Properties public String Name { get; } public String Type { get; } bool IsAuthenticated {get;} // WindowsIdentity Properties public int Token { get;} public bool IsGuest {get;} public bool IsSystem {get;} // Public Constructors, Token must be a valid Windows Token public WindowsIdentity (int Token) {} public WindowsIdentity (int Token, String type) {} public WindowsIdentity (int Token, String type, WindowsAccountType acctType) {} public WindowsIdentity (int Token, String type, WindowsAccountType acctType, bool isAuthenticated) {} // Try to impersonate based on the Windows Token public virtual WindowsImpersonationContext Impersonate(); public virtual WindowsImpersonationContext Impersonate(int Token); // Static method to get a WindowsIdentity for the current // execution token public static WindowsIdentity GetCurrent(); }
Where:
Enum WindowsAccountType { Guest; Normal; System; } public class WindowsImpersonationContext { // Revert from the impersonation associated with this object public void Undo(); }
Notes: