leves

使一切更加简单!

导航

ASP.NET 标识矩阵

ASP.NET 标识矩阵

用户对象实现 IPrincipal 接口并表示特定用户(代码代表该用户运行)的安全上下文。用户对象包括用户的标识(作为包含的 IIdentity 对象)和用户所属的任何角色。

ASP.NET 提供了以下用户和标识对象实现

?   WindowsPrincipal WindowsIdentity 对象表示已使用 Windows 身份验证验证了身份的用户。对于这些对象可以从 Windows 用户所属的 Windows 组集中自动获取角色列表。

?   GenericPrincipal GenericIdentity 对象表示已使用表单身份验证或其他自定义身份验证机制验证了身份的用户。对于这些对象,以自定义方式获取角色列表(通常是从数据库中获取的)。

?   FormsIdentity PassportIdentity 对象分别表示已使用表单身份验证和 Passport 身份验证验证了身份的用户。

 

以下各表说明了在 IIS 身份验证设置的范围内从保存 IPrincipal / IIdentity 对象的每个变量中获取的结果标识。表中使用了以下缩写词:

?   HttpContext = HttpContext.Current.User它返回包含当前 Web 请求的安全信息的 IPrincipal 对象。这是经身份验证的 Web 客户端。

?   WindowsIdentity = WindowsIdentity.GetCurrent()它返回当前执行的 Win32 线程的安全上下文的标识。

?   Thread = Thread.CurrentPrincipal它返回当前执行的 .NET 线程 Win32 线程之上的用户。

1IIS 匿名身份验证

Web.config 设置

变量位置

结果标识

<identity impersonate="true"/>

<authentication mode="Windows" />

HttpContext

WindowsIdentity

Thread

-

MACHINE\IUSR_MACHINE

-

<identity impersonate="false"/>

<authentication mode="Windows" />

HttpContext

WindowsIdentity

Thread

-

MACHINE\ASPNET

-

 

<identity impersonate="true"/>

<authentication mode="Forms" />

HttpContext

WindowsIdentity

Thread

用户提供的名称

MACHINE\IUSR_MACHINE

用户提供的名称

 

<identity impersonate="false"/>

<authentication mode="Forms" />

HttpContext

WindowsIdentity

Thread

用户提供的名称

MACHINE\ASPNET

用户提供的名称

 

2IIS 基本身份验证

Web.config 设置

变量位置

结果标识

<identity impersonate="true"/>

<authentication mode="Windows" />

HttpContext

WindowsIdentity

Thread

\用户名

\用户名

\用户名

<identity impersonate="false"/>

<authentication mode="Windows" />

HttpContext

WindowsIdentity

Thread

\用户名

MACHINE\ASPNET

\用户名

<identity impersonate="true"/>

<authentication mode="Forms" />

HttpContext

WindowsIdentity

Thread

用户提供的名称

\用户名

用户提供的名称

<identity impersonate="false"/>

<authentication mode="Forms" />

HttpContext

WindowsIdentity

Thread

用户提供的名称

MACHINE\ASPNET

用户提供的名称

 

3IIS 摘要身份验证

Web.config 设置

变量位置

结果标识

<identity impersonate="true"/>

<authentication mode="Windows" />

HttpContext

WindowsIdentity

Thread

\用户名

\用户名

\用户名

<identity impersonate="false"/>

<authentication mode="Windows" />

HttpContext

WindowsIdentity

Thread

\用户名

MACHINE\ASPNET

\用户名

<identity impersonate="true"/>

<authentication mode="Forms" />

HttpContext

WindowsIdentity

Thread

用户提供的名称

\用户名

用户提供的名称

<identity impersonate="false"/>

<authentication mode="Forms" />

HttpContext

WindowsIdentity

Thread

用户提供的名称

MACHINE\ASPNET

用户提供的名称

 

4IIS 集成 Windows

Web.config 设置

变量位置

结果标识

<identity impersonate="true"/>

<authentication mode="Windows" />

HttpContext

WindowsIdentity

Thread

\用户名

\用户名

\用户名

<identity impersonate="false"/>

<authentication mode="Windows" />

HttpContext

WindowsIdentity

Thread

\用户名

MACHINE\ASPNET

\用户名

<identity impersonate="true"/>

<authentication mode="Forms" />

HttpContext

WindowsIdentity

Thread

用户提供的名称

\用户名

用户提供的名称

<identity impersonate="false"/>

<authentication mode="Forms" />

HttpContextWindowsIdentity

Thread

用户提供的名称

MACHINE\ASPNET

用户提供的名称

posted on 2005-09-28 16:05  leves  阅读(610)  评论(0编辑  收藏  举报