Chapter 11. The Client Membership System

In the last chapter, I talked about synchronizing data with the server and how important it was to be able to work offline. In this chapter, I am going to discuss how to implement membership features, such as authentication, in an offline scenario.

The Problem

Now that the application has a nice, service-based way of working offline and synchronizing all of its data with the server, there needs to be a way to enable authentication and authorization while offline as well.

Users should be able to authenticate (i.e., log in to the application) and be able to perform work based on their assigned role(s) in the system. This is easy to do in an online ASP.NET application using the ASP.NET Membership System, but it is a lot trickier in a smart client application. One way of implementing these features is to call web services on the server that will authenticate the user and provide authorization information. The web services could actually wrap methods on the ASP.NET Membership System. The problem with that approach in the SmartCA application is that it requires that the user has a network or Internet connection, and if you remember from Chapter 1, the users sometimes are out in the middle of nowhere with no access to any type of network connection.

The Design

Since I already have a nice data synchronization strategy in place, why not use that to help solve the problem of performing membership tasks offline? After thinking about it for a while, I thought, ...

Get .NET Domain-Driven Design with C#: Problem – Design – Solution now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.