28.12.2013 Views

Building Secure ASP.NET Applications - People Search Directory

Building Secure ASP.NET Applications - People Search Directory

Building Secure ASP.NET Applications - People Search Directory

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

How To:<br />

Create GenericPrincipal Objects<br />

with Forms Authentication<br />

<strong>Applications</strong> that use Forms authentication will often want to use the<br />

GenericPrincipal class (in conjunction with the FormsIdentity class), to create a<br />

non-Windows specific authorization scheme, independent of a Windows domain.<br />

For example, an application may:<br />

● Use Forms authentication to obtain user credentials (user name and password).<br />

● Validate the supplied credentials against a data store; for example, a database or<br />

Microsoft® Active <strong>Directory</strong>® directory service.<br />

●<br />

Create GenericPrincipal and FormsIdentity objects based on values retrieved<br />

from the data store. These may include a user’s role membership details.<br />

● Use these objects to make authorization decisions.<br />

This How To describes how to create a Forms-based Web application that authenticates<br />

users and creates a custom Forms authentication ticket that contains user and<br />

role information. It also shows you how to map this information into<br />

GenericPrincipal and FormsIdentity objects and associate the new objects with the<br />

HTTP Web request context, allowing them to be used for authorization logic within<br />

your application.<br />

This How To focuses on the construction of the GenericPrincipal and<br />

FormsIdentity objects together with the processing of the forms authentication<br />

ticket. For details about how to authenticate users against Active <strong>Directory</strong> and SQL<br />

Server 2000, see the following related How Tos in the Reference section of this<br />

guide:<br />

● “How to use Forms authentication with Active <strong>Directory</strong>”<br />

● “How to use Forms authentication with SQL Server 2000”

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!