Clarity, Technology, and Solving Problems | PracticeThis.com
WP7 App with Key Windows Azure resources – Slides, Videos, How-To’s, and T-shooting – for quick consumption on the go.
In this post I outline the steps I needed to complete in order to migrate ASP.NET site from using Windows Integrated authentication to using Windows Identity Foundation.
Summary of steps:
The rest of the post is detailed explanation for each step followed by resources in the end.
<body> <form id="form1" runat="server"> <asp:Literal ID="UserID" runat="server"></asp:Literal> </form> </body>
protected void Page_Load(object sender, EventArgs e) { UserID.Text = User.Identity.Name; }
<authentication mode="Windows"/>
In the previous steps I have created an ASP.NET web application that utilizes Windows Integrated Authentication.
In the next section I will accomplish steps to migrate my ASP.NET web application to using Windows Identity Foundation for authentication.
There are several prerequisite in order to work with Windows Identity Foundation. Short list is as follows:
More info here Windows Identity Foundation (WIF) By Example Part I – How To Get Started.
To make ASP.NET application Claims Aware there is a need for STS (Security Token Service). Download and use SelfSTS utility that emulates minimal behavior of STS. It’s available here http://code.msdn.microsoft.com/SelfSTS.
NOTE. SelfSTS utility is for development and testing purposes only. It’s insecure in any possible way. Do not use it for production purposes.
IClaimsPrincipal claimsPrincipal = Page.User as IClaimsPrincipal; IClaimsIdentity claimsIdentity = (IClaimsIdentity)claimsPrincipal.Identity; foreach (var claim in claimsIdentity.Claims ) { Response.Write(claim.ClaimType + " = " + claim.Value + "<BR/>"); }
<httpRuntime requestValidationMode="2.0"/> <pages validateRequest="false"/>