Posts

Showing posts from May, 2018

User Registration with CAC/Client Certificates in Asp.Net made easy - PART I

Implementing CAC registration in Asp.Net web applications is fairly vague and mystified. Quite frankly, there just isn't a lot of literature on this topic, and what is out there tends to be rather old and not very comprehensive. That said, I'd like to share a way to implement a CAC registration in your Asp.Net web applications. Note, this article is only going to cover things from the .Net Application perspective. For more info on setting up CAC/Client Certs in general, view our other articles. https://dcdevs.blogspot.com/2017/06/iis-express-client-certificates.html https://dcdevs.blogspot.com/2017/06/aspnet-mvc-how-to-enabledisable_19.html The first thing to do is to create a class that can take in a ClientCertificate, validate it, and parse out the information needed to create an account. Here is an example of a CertificateManager class that can be used in your app. public class CertificateManager { public Boolean HasCertificate { get; } pub

Getting Identity Claims to update immediately

Image
Asp.Net Identity Claims are a very useful feature for adding extra metadata to a user's account. This metadata could consist of a user's organization, affiliation, or even profile settings that they can set through the app. In the latter case of having claims values that can be updated dynamically, you will want to have the changes to these values reflected as soon as possible to avoid potential UX issues. By default, claims are refreshed when a user logs into the app. In the case of users who stay logged in for prolonged periods, we want to have control over the interval for when the claims cookie gets refreshed from the database. The default interval that Identity sets for you is not ideal for dynamically updated claims values. It is located in Startup.Auth.cs (assuming this is standard .Net MVC project). As you can see in the screen above, the default is set to 30 min. To configure claims values to update more quickly, just change the Timespan to something like.