first_page the funky knowledge base
personal notes from way, _way_ back and maybe today

MCAD/MCSD Notes: Chapter 8, Lesson 2; Using Windows Authentication

Lesson 2: Using Windows Authentication

The purpose of this lesson is to show the relationship between Windows (or NTLM) authentication and ASP.NET. This lesson also delves into the concept of impersonation.

This Web application configuration denies anonymous users:

<authentication mode="Windows"/>
<authorization>
    <deny users="?"/>
    <!-- Deny unauthenticated users -->
</authorization>

For more information on authentication configuration see:

http://msdn.microsoft.com/library/en-us/
    cpgenref/html/gngrfauthorizationsection.asp

Keep in mind that the impersonated credentials must have the same rights as the "limited" ASPNET account otherwise lack of access to folders like \\Temporary ASP.NET Files will cause exceptions. For more details, see "How To: Create a Custom Account to Run ASP.NET" by J.D. Meier, Alex Mackman, Michael Dunner and Srinath Vasireddy here:

http://msdn.microsoft.com/library/en-us/dnnetsec/html/SecNetHT01.asp

The speculation here suggests that this certificate "persists" elsewhere when cookie-less sessions are enabled.

This feature is best enjoyed in a domain-based Intranet setting using Microsoft Web browsers.

This is the example:

<authorization>
    <allow users="contoso\\DeannaMeyer,contoso\\MichaelEmanuel" />
    <deny users="*" />
</authorization>

This is the example:

<authorization>
    <allow roles="contoso\\Administrators" />
    <deny users="*" />
</authorization>

The Identity property is a member of System.Web.UI.Page.User.

This topic seems to be connected with HTTP Modules such as in "INFO: ASP.NET HTTP Modules and HTTP Handlers Overview" at:

http://support.microsoft.com/default.aspx?scid=kb;EN-US;Q307985

Because the "most restrictive" setting is used the order of events here seems irrelevant.

This recommendation must also be weighed against the MSKB article "Password Synchronization/Allow IIS to Control Password May Cause Problems" at:

http://support.microsoft.com/default.aspx?scid=kb;en-us;Q216828

This default behavior is changed by declaring the identity element with the form:

<configuration>
    <system.web>
        <identity impersonate="true" />
    </system.web>
</configuration>

The authenticated user that ASP.NET runs under must have the same (or more) security privileges as the ASP.NET user account. The WindowsIdentity.GetCurrent() method of System.Security.Principal can be used to verify the running account.

ASP.NET can also run under a single, known account with a configuration like this:

<configuration>
    <system.web>
        <identity impersonate="true" userName="root" password="jkdfjds#X5g" />
    </system.web>
</configuration>

This configuration (in a file called Web.config) can be placed in a subfolder of the Web application to define certain areas of the application that run under impersonation.

mod date: 2005-08-31T01:21:15.000Z