Migrating users from another system by overriding ServiceStack's credential-based authentication
If you're creating a new system and you want your users to move to the new system, it might make sense to want to move their authenticate information to your new system so that in the future, you don't have to maintain both systems. Ideally, we can make this as seamless as possible for end users. In this recipe, we will look at overriding CredentialAuthProvider
to give it custom behavior, which in this case is to check whether the credentials are valid for a legacy system and migrate the user to the new one.
Getting ready
In this example, we are going to extend ServiceStack's TextFileSettings
class to mock our external authentication system. This new class is just illustrating the custom behavior inside the TryAuthenticate
method, which will be our new custom credential-based authentication provider, as follows:
public class UserMigrationStorage : TextFileSettings { public UserMigrationStorage...