You are missing the following lines in the web.config file:
In the configSections element:
<section name="system.identityModel" type="System.IdentityModel.Configuration.SystemIdentityModelSection, System.IdentityModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/> <section name="system.identityModel.services" type="System.IdentityModel.Services.Configuration.SystemIdentityModelServicesSection, System.IdentityModel.Services, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
In the element system.webServer
<modules> <remove name="FormsAuthentication" /> <add name="WSFederationAuthenticationModule" type="System.IdentityModel.Services.WSFederationAuthenticationModule, System.IdentityModel.Services, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" preCondition="managedHandler" /> <add name="SessionAuthenticationModule" type="System.IdentityModel.Services.SessionAuthenticationModule, System.IdentityModel.Services, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" preCondition="managedHandler" /> </modules>
Your Uris audience is empty. You must specify your web application so that it can use this function. So add this line:
<audienceUris> <add value="http://localhost/dss.web.frontend"/> </audienceUris>
If your problems are repeated after this change, you can implement your own authentication module obtained from the WSFederationAuthenticationModule. Something like that:
public class CustomAuthenticationModule : WSFederationAuthenticationModule { public CustomAuthenticationModule() { base.SecurityTokenReceived += CustomAuthenticationModule_SecurityTokenReceived; } public void CustomAuthenticationModule_SecurityTokenReceived(object sender, SecurityTokenReceivedEventArgs e) { } protected override void OnAuthenticateRequest(object sender, EventArgs args) { base.OnAuthenticateRequest(sender, args); } }
and then only in the configuration change, instead of the WSFederationAuthenticationModule, set the CustomAuthenticationModule with the appropriate namespace and assembly signature. This way you can intercept calls in your delegate.
Hope this helps you.
Rastko