This blog post walks you through the process of creating an ASP.NET MVC application that authenticates and displays some useful information available on your Belgian eID card.
In order to authenticate, we will use an existing STS endpoint: https://www.e-contract.be/eid-idp/endpoints/ws-federation/metadata/auth-ident-metadata.xml, from which we will retrieve a set of claims.
[Update]If you haven't done so far, please install the Windows Identity Foundation SDK (WIF). This add the "Add STS Reference" in Visual Studio.
using System;
using System.Web;
using System.Web.Util;
using Microsoft.IdentityModel.Protocols.WSFederation;
/// <summary>
/// This SampleRequestValidator validates the wresult parameter of the
/// WS-Federation passive protocol by checking for a SignInResponse message
/// in the form post. The SignInResponse message contents are verified later by
/// the WSFederationPassiveAuthenticationModule or the WIF signin controls.
/// </summary>
public class SampleRequestValidator : RequestValidator
{
protected override bool IsValidRequestString(HttpContext context, string value, RequestValidationSource requestValidationSource, string collectionKey, out int validationFailureIndex)
validationFailureIndex = 0;
if (requestValidationSource == RequestValidationSource.Form && collectionKey.Equals(WSFederationConstants.Parameters.Result, StringComparison.Ordinal))
var message = WSFederationMessage.CreateFromFormPost(context.Request) as SignInResponseMessage;
if (message != null)
return true;
}
return base.IsValidRequestString(context, value, requestValidationSource, collectionKey, out validationFailureIndex);
<system.web>
<httpRuntime requestValidationType="SampleRequestValidator" />
…
</system.web>
public ActionResult Index()
ViewBag.Message = "Welcome to ASP.NET MVC!";
var claimsIndentity = User.Identity as ClaimsIdentity;
return View(claimsIndentity.Claims);
@model IEnumerable<Microsoft.IdentityModel.Claims.Claim>
<table>
@foreach (var item in Model)
<tr>
<td>
@Html.DisplayFor(modelItem => item.ClaimType)
</td>
@Html.DisplayFor(modelItem => item.Issuer)
@Html.DisplayFor(modelItem => item.Value)
</tr>
</table>
Are there any other STS providers that we can use for the e-id (belgium) ?
Here's the list of end points, provided by Frank Cornelis
www.e-contract.be/.../main.seam. I'm not aware of any other STS providers...
Looks a lot like this post: fabriccontroller.net/.../the-belgian-eid-in-windows-azure-part-1-authentication-and-identification