PDA

View Full Version : Customized your own Basic Authenication Module


Chow
03-29-2007, 12:23 AM
**Tested for our longhorn beta 2

Here's a sample to create your own Anonymous Authentication Module. With this module, you will perform authentication against an arbitrary credential store. This module has a hard coded username:test and password:test. You can freely set this up to use other credential stores (e.g. AsP.net 2.0 Membership system) if you wish. With this sample, you will be replacing the current basic authentication which is tied in with the Windows credential store and support an arbitrary one. This is a brief instruction targeted for our Longhorn system. We have tested and modified proper settings based on IIS.NET 's article (http://www.iis.net/default.aspx?tabid=2&subtabid=25&i=942&p=1)for your beta testing convenience.

1. Download file iis7_DASP002.zip attachment.
2. Extract the downloaded file and place the file "BasicAuthenticationModule.cs" in the /app_code directory of the IIS7 beta site (you can customize this file if you like).
3. Add the following to your root web.config file in between the modules and security tags if already not exist. This will remove the current Basic Authentication and replace
it with you custom module.It willalso beturning off the anonymous authentication and Windows credential store to test the basic authentication.
<system.webServer>
<modules>
<remove name="BasicAuthenticationModule" />
<add name="MyBasicAuthenticationModule" type="IIS7Demos.BasicAuthenticationModule" />
</modules>

<security>
<authentication>
<anonymousAuthentication enabled="false" />
<windowsAuthentication enabled="false" />
</authentication>
</security>
</system.webServer>

That's it, you're done! Simply open your browser and hit your website. You will be challenged with an authentication prompt. Use the hard-coded user:test and password: test and you're
in! You can remove the<anonymousAuthentication enabled="false" /> line or change to "true" if you want to keep the basic authentication, but want anonymous to work. Have Fun!





Chow
DiscountASP.NET
<SUB><SUP>http://DiscountASP.NET (http://discountasp.net/)