Geeks With Blogs
Cloud9 Azure and Cloud Services, WCF, WF, Dublin, Geneva and Federated Security, Oslo


Below is a Microsoft.IdentityModel configuration you might find in a web.config or app.config that hosts websites or webservices that leverage Claims based authentication and authorization.

If your requirements require you to do this at runtime at the start of the app you can do the following....

void Application_Start(object sender, EventArgs e)
    FederatedAuthentication.ServiceConfigurationCreated += new EventHandler<ServiceConfigurationCreatedEventArgs>(FederatedAuthentication_ServiceConfigurationCreated);

void FederatedAuthentication_ServiceConfigurationCreated(object sender, ServiceConfigurationCreatedEventArgs e)
    // you can configure ServiceConfiguration by accessing e.ServiceConfiguration



You might want some simple wizards around application administration and setup for example if you are reselling your same software to many different companies... and you dont want them to muck around with security.. just set it up based on initial values and save that in the database to called upon application initialization.

federatedAuthentication is different..... that config is associated with federated authentication http modules so you have to catch another event inside the pipeline.

service certificate and audience uris

e.ServiceConfiguration.AudienceRestriction.AllowedAudienceUris.Add("<your audience uri>")
e.ServiceConfiguration.ServiceCertificate = <your certificate>

For configurations insdie wsFederation, you will have to add the following to your global.asax:

void Application_AuthenticateRequest(object sender, EventArgs e)
    FederatedAuthentication.WSFederationAuthenticationModule.Issuer = "<your issuer>";
    FederatedAuthentication.WSFederationAuthenticationModule.Realm = "<your realm>";



Posted on Monday, November 30, 2009 9:05 PM | Back to top

Comments on this post: Runtime Customization of Microsoft.IdentityModel configuration

No comments posted yet.
Your comment:
 (will show your gravatar)

Copyright © Juan Suero | Powered by: