Identity Class

Represents the identity of a principal. The identity is a name plus any associated claims. The identity is immutable.

Syntax

public abstract class Identity : MarshalByRefObject, System.Security.Principal.IIdentity

Remarks

The Identity class is the base class for all identity classes. It represents the name of a principal and any associated claims. The identity is immutable, meaning that once it is created, its properties cannot be changed.

The Identity class implements the IIdentity interface, which defines the common properties and methods for all identity classes. These include the Name property, which returns the name of the principal, and the IsAuthenticated property, which indicates whether the principal has been authenticated.

The Identity class is an abstract class, meaning that it cannot be instantiated directly. Instead, you must derive from it to create a concrete identity class. Common derived classes include WindowsIdentity, which represents the identity of a Windows user, and GenericIdentity, which represents a generic identity.

Table of Contents

Properties

AuthenticationType

Gets the type of authentication used to get the identity.

public abstract string AuthenticationType { get; }

IsAuthenticated

Gets a value that indicates whether the current principal has been authenticated.

public abstract bool IsAuthenticated { get; }

Name

Gets the name of the current principal.

public abstract string Name { get; }

Methods

Dispose

Releases the unmanaged resources that are used by the current instance of the Identity class and, optionally, releases the managed resources.

public void Dispose();

Equals

Determines whether the specified object is equal to the current object.

public override bool Equals(object obj);

GetHashCode

Serves as the default hash function.

public override int GetHashCode();

GetType

Gets the Type of the current instance.

public Type GetType();

ToString

Returns a string that represents the current object.

public override string ToString();

Inherited Members

This class inherits members from the following base classes:

This class implements interfaces: