WS-Federation Technology Preview

620 views
Skip to first unread message

Cornelis Frank

unread,
Apr 15, 2010, 7:21:48 AM4/15/10
to eid-a...@googlegroups.com
Dear ASP.NET developer,


As of today you can have seamless integration of the eID Identity Provider within your ASP.NET based web applications.
What you need is:
- some Windows operating system
- Visual Studio 2008 SP1
- Windows Identity Foundation SDK

Fire up Visual Studio. Create an ASP.NET web application via File -> New Web Site... -> ASP.NET Web Site (Language: Visual C#) -> OK
Right-click in the Solution Explorer on the web application and choose "Add STS Reference...". Say Next and then select "Use an existing STS". For STS WS-Federation metadata document location you fill in:
https://www.e-contract.be/eid-idp/endpoints/ws-federation-metadata.xml
Continue the WIF wizard until finished.

Add the following line to the Default.aspx page:
<input runat="server" id="name" />

Open the underlying Default.aspx.cs page code file and add the following to the Page_Load method:
IClaimsPrincipal principal = Thread.CurrentPrincipal as IClaimsPrincipal;
this.name.Value = principal.Identity.Name;

For this you also need the following includes on the top of the file:
using System.Threading;
using Microsoft.IdentityModel.Claims;

Hit F5, sit back and watch the show!


Many thanks to Vittorio Bertocci for giving an excellent introduction to WS-Federation and ASP.NET at the Windows Identity Foundation Workshop last March here in Brussels.


Kind Regards,
Frank.

Tanguy Ingels

unread,
Apr 15, 2010, 7:56:40 AM4/15/10
to eid-a...@googlegroups.com
Nice show!
=> before you can install the WIF SDK, you must install the WIF Runtime

Below, for a lazy VB-developer :-)

Imports System.Threading
Imports Microsoft.IdentityModel.Claims

Partial Class _Default
Inherits System.Web.UI.Page

Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load
Dim objPrincipal As IClaimsPrincipal = Thread.CurrentPrincipal
name.Value = objPrincipal.Identity.Name
End Sub
End Class

Dear ASP.NET developer,


Kind Regards,
Frank.

--
You received this message because you are subscribed to the Google Groups
"eID Applet" group.
To post to this group, send email to eid-a...@googlegroups.com.
To unsubscribe from this group, send email to
eid-applet+...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/eid-applet?hl=en.


Cornelis Frank

unread,
Apr 16, 2010, 6:39:24 AM4/16/10
to eid-a...@googlegroups.com
Hi,


I've created a video demonstrating the eID IdP integration within ASP.NET web applications using Visual Studio. Check out:
http://www.youtube.com/watch?v=7AFGfWj7q5Q&hd=1


Kind Regards,
Frank.
________________________________________
Van: eid-a...@googlegroups.com [eid-a...@googlegroups.com] namens Tanguy Ingels [t...@swylix.be]
Verzonden: donderdag 15 april 2010 13:56
Aan: eid-a...@googlegroups.com
Onderwerp: RE: [eid-applet] WS-Federation Technology Preview

Cliff

unread,
Apr 21, 2010, 8:01:36 AM4/21/10
to eID Applet
Thx, nice show indeed! This offers great possibilities!

Frank, are you also considering active scenario's, where the IDP could
be called through webservices?
Is also possible to get other claims like the Belgian National Number?

Kind regards,

Cliff
> For more options, visit this group athttp://groups.google.com/group/eid-applet?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups "eID Applet" group.
> To post to this group, send email to eid-a...@googlegroups.com.
> To unsubscribe from this group, send email to eid-applet+...@googlegroups.com.
> For more options, visit this group athttp://groups.google.com/group/eid-applet?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups "eID Applet" group.
> To post to this group, send email to eid-a...@googlegroups.com.
> To unsubscribe from this group, send email to eid-applet+...@googlegroups.com.
> For more options, visit this group athttp://groups.google.com/group/eid-applet?hl=en.- Tekst uit oorspronkelijk bericht niet weergeven -
>
> - Tekst uit oorspronkelijk bericht weergeven -

Cornelis Frank

unread,
Apr 21, 2010, 1:54:49 PM4/21/10
to eid-a...@googlegroups.com
Hi Cliff,


About the active scenario, the problem is that the eID IdP always requires eID user interaction via the web browser. So only the WS-Federation passive request scenario, OpenID, and the SAML2 Browser POST Profile makes sense IMHO. The active requestor scheme can only be used to exchange tokens (pure STS functionality). But if you can think of some use case for an active WS-Federation scheme, I'm all ears.

I've already added all available eID attributes as WS-Federation claims. Let me know if you want me to redeploy the eID IdP on the e-contract server if you want to check this out yourself.


Kind Regards,
Frank.
________________________________________
Van: eid-a...@googlegroups.com [eid-a...@googlegroups.com] namens Cliff [cliff.d...@gmail.com]
Verzonden: woensdag 21 april 2010 14:01
Aan: eID Applet
Onderwerp: [eid-applet] Re: WS-Federation Technology Preview

Cliff

unread,
Apr 22, 2010, 4:04:59 AM4/22/10
to eID Applet
Well, I am personally working on setting up an Identity Provider for
Healthworkers, more particular for General Practitioners. These GP's
use several applications (both fat clients and websites) and
authenticate via the eID through a custom built identity provider.
Based on the "Authentication" eID certificate, a token is generated
with a claim indicating the Healthworkers' role.

In this scenario it is checked in the STS:
1) whether the personal (eID) information is valid
2) whether the person, login in is in fact a general practitioner

It is logic that we do the second check ourselves (the IDP is under
control of a GP organization), but the first check we currently also
perform in the Identity Provider (by checking the certificate chain).
If there would be a service available to "outsource" this validation
check to the official Belgian Identity Provider this would make greate
sense!

I hope this scenario is somehow clear, otherwise please ask ;-)

Thanks in advance for the consideration!



On 21 apr, 13:54, Cornelis Frank <Frank.Corne...@fedict.be> wrote:
> Hi Cliff,
>
> About the active scenario, the problem is that the eID IdP always requires eID user interaction via the web browser. So only the WS-Federation passive request scenario, OpenID, and the SAML2 Browser POST Profile makes sense IMHO. The active requestor scheme can only be used to exchange tokens (pure STS functionality). But if you can think of some use case for an active WS-Federation scheme, I'm all ears.
>
> I've already added all available eID attributes as WS-Federation claims. Let me know if you want me to redeploy the eID IdP on the e-contract server if you want to check this out yourself.
>
> Kind Regards,
> Frank.
> ________________________________________
> Van: eid-a...@googlegroups.com [eid-a...@googlegroups.com] namens Cliff [cliff.decle...@gmail.com]
> > For more options, visit this group athttp://groups.google.com/group/eid-applet?hl=en.-Tekst uit oorspronkelijk bericht niet weergeven -

Mel Gerats

unread,
Apr 29, 2010, 10:59:56 AM4/29/10
to eID Applet
Hi Frank,

Great work on the STS!
I tried using it today but I can't quite get it to work.
After redirecting back to my web site I get the following error (see
below)

I've tried several combinations of encryption/no encryption and with
and without certificates. Do you have any idea what culd be the cause?

Kind regards,
mel.

The system cannot find the file specified.
Description: An unhandled exception occurred during the execution of
the current web request. Please review the stack trace for more
information about the error and where it originated in the code.

Exception Details:
System.Security.Cryptography.CryptographicException: The system cannot
find the file specified.


Source Error:
An unhandled exception was generated during the execution of the
current web request. Information regarding the origin and location of
the exception can be identified using the exception stack trace
below.

Stack Trace:

[CryptographicException: The system cannot find the file specified.
]
System.Security.Cryptography.ProtectedData.Protect(Byte[] userData,
Byte[] optionalEntropy, DataProtectionScope scope) +681

Microsoft.IdentityModel.Web.ProtectedDataCookieTransform.Encode(Byte[]
value) +121

[InvalidOperationException: ID1074: A CryptographicException occurred
when attempting to encrypt the cookie using the ProtectedData API (see
inner exception for details). If you are using IIS 7.5, this could be
due to the loadUserProfile setting on the Application Pool being set
to false. ]

Microsoft.IdentityModel.Web.ProtectedDataCookieTransform.Encode(Byte[]
value) +1278036

Microsoft.IdentityModel.Tokens.SessionSecurityTokenHandler.ApplyTransforms(Byte[]
cookie, Boolean outbound) +74

Microsoft.IdentityModel.Tokens.SessionSecurityTokenHandler.WriteToken(XmlWriter
writer, SecurityToken token) +571

Microsoft.IdentityModel.Tokens.SessionSecurityTokenHandler.WriteToken(SessionSecurityToken
sessionToken) +103

Microsoft.IdentityModel.Web.SessionAuthenticationModule.WriteSessionTokenToCookie(SessionSecurityToken
sessionToken) +136

Microsoft.IdentityModel.Web.WSFederationAuthenticationModule.SignInWithResponseMessage(HttpRequest
request) +639

Microsoft.IdentityModel.Web.WSFederationAuthenticationModule.OnAuthenticateRequest(Object
sender, EventArgs args) +1096502

System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
+80
System.Web.HttpApplication.ExecuteStep(IExecutionStep step,
Boolean& completedSynchronously) +171
> > > For more options, visit this group athttp://groups.google.com/group/eid-applet?hl=en.-Tekstuit oorspronkelijk bericht niet weergeven -

Mel Gerats

unread,
Apr 30, 2010, 3:15:53 AM4/30/10
to eID Applet
I'm stupid, after doing what the error suggests everything works fine.

"If you are using IIS 7.5, this could be due to the loadUserProfile
setting on the Application Pool being set to false."

Indeed!
> > > > For more options, visit this group athttp://groups.google.com/group/eid-applet?hl=en.-Tekstuitoorspronkelijk bericht niet weergeven -
>
> > > > - Tekst uit oorspronkelijk bericht weergeven -
>
> > > --
> > > You received this message because you are subscribed to the Google Groups "eID Applet" group.
> > > To post to this group, send email to eid-a...@googlegroups.com.
> > > To unsubscribe from this group, send email to eid-applet+...@googlegroups.com.
> > > For more options, visit this group athttp://groups.google.com/group/eid-applet?hl=en.
>
> > > --
> > > You received this message because you are subscribed to the Google Groups "eID Applet" group.
> > > To post to this group, send email to eid-a...@googlegroups.com.
> > > To unsubscribe from this group,...
>
> read more »
Reply all
Reply to author
Forward
0 new messages