GenericPrincipal

GenericPrincipalserializable

System.Security.Principal (mscorlib.dll)class
public class GenericPrincipal : IPrincipal { // Public Constructors    public GenericPrincipal(IIdentity identity, string[  ] roles); // Public Instance Properties    public virtual IIdentity Identity{get; }    // implements IPrincipal // Public Instance Methods    public virtual bool IsInRole(string role); // implements IPrincipal }

The GenericPrincipal class provides a generic implementation of the IPrincipal interface. The GenericPrincipal constructor takes an IIdentity object representing the principal's user and a System.String array containing the names of the roles to which the user belongs. The specified IIdentity is normally an instance of GenericIdentity, but this is not mandatory. Used in conjunction with the GenericIdentity class, GenericPrincipal provides a flexible principal implementation that can be used with any authentication and authorization mechanism.

The IsInRole( ) method takes the name of a role and returns true if it was included in the array of role names passed to the GenericPrincipal constructor. The role name comparison is case-insensitive.



Programming. NET Security
Programming .Net Security
ISBN: 0596004427
EAN: 2147483647
Year: 2005
Pages: 346

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net