I want to use the IAuthRepository in a non-Servicestack Application.
services.AddSingleton(c => new OrmLiteAuthRepository(c.Resolve()));
to add the repo to DI. My Problem is, when creating a user with an email as username, it is refused as invalid username. In an Servicestack app I can set “ValidUserNameRegEx” but how do I do this in a non-Servicestack app?`
You haven’t given any info about how else your application is setup, you want to provide enough information for others to replicate the problem. Sounds like a validation issue so likely best to ask on StackOverflow with specifics around validation as well as how you are trying to create a user etc.
Most ServiceStack components are required to be used with ServiceStack, e.g. Auth Repositories requires access to the AuthFeature plugin registered with a ServiceStack AppHost.
You’d either need to register a ServiceStack Host in the Startup otherwise you can take a copy of the OrmLiteAuthRepository and locally modify it to replace usages of AuthFeature (and extension methods using AuthFeature) with a different implementation.
The source code for OrmLiteAuthRepository is predominantly in these 2 classes:
Allright, thanks for your input. After thinking about the whole architecture I thought it may be even a better approach to just USE the existing api via the Servicestack-Client, so all those problems would be solved and I would have two clearly separated Applications.