I’m building a WCF-based application with the users authenticating using certificates on smart cards. The service is hosted on IIS7 and the clients are Windows forms apps.
The problem is that when a new user is added (new certificate created) that user can’t log in until the IIS is restarted or the application pool recycled. If an existing user is deleted he’s also able to log on until a restart/recycle.
In my behaviour definition I have
<serviceCredentials>
<serviceCertificate findValue="blahblah.local"
x509FindType="FindBySubjectName" storeLocation="LocalMachine" storeName="My" />
<userNameAuthentication userNamePasswordValidationMode="MembershipProvider"
membershipProviderName="SqlMembershipProvider" cacheLogonTokens="true"/>
<clientCertificate>
<authentication mapClientCertificateToWindowsAccount="true"
certificateValidationMode="ChainTrust" revocationMode="Online"/>
</clientCertificate>
</serviceCredentials>
Is there any way to prevent this certificate “caching” from taking place or refresh the active certificate list on demand?
Apparently the caching was a known “feature” of System.Identitymodel. It’s discussed here and more info available here.
What I did was to use a custom validator (code below) which took care of the issue.
EDIT: Added more code for validating X.509 certificates against CRL’s in real-time here
web.config
code