Hi,
Have all the x templates been upgraded to work with > 8.1 ?
I’m trying to migrate one of my project to ServiceStack 8.3 from 8.0 and I’m running into some issues with the ConfigureAuth class.
So I updated x and created a new project to see if there are were any changes in the generated classes.
This is the class created by x:
public class ConfigureAuth : IHostingStartup
{
public void Configure(IWebHostBuilder builder) => builder
.ConfigureServices(services => {
//services.AddSingleton<ICacheClient>(new MemoryCacheClient()); //Store User Sessions in Memory Cache (default)
})
.ConfigureAppHost(appHost => {
var appSettings = appHost.AppSettings;
appHost.Plugins.Add(new AuthFeature(() => new CustomUserSession(),
new IAuthProvider[] {
new CredentialsAuthProvider(appSettings),
//...
}));
appHost.Plugins.Add(new RegistrationFeature()); //Enable /register Service
//override the default registration validation with your own custom implementation appHost.RegisterAs<CustomRegistrationValidator, IValidator<Register>>();
});}
From what I understood plugins are supposed to be added here:
public class ConfigureAuth : IHostingStartup
{
public void Configure(IWebHostBuilder builder) => builder
.ConfigureServices((context, services) => {
services.AddPlugin(new AuthFeature(() => new CustomUserSession(),
new IAuthProvider[] {
new CredentialsAuthProvider(new NetCoreAppSettings(context.Configuration)),
}));
}) .ConfigureAppHost(appHost => {
//override the default registration validation with your own custom implementation
appHost.RegisterAs<CustomRegistrationValidator, IValidator<Register>>();
});}
Is this how it should be done now?
If I comment out options.MapEndpoints() in program.cs everything seems to work fine:
app.UseServiceStack(new AppHost(), options => {
//options.MapEndpoints();
});
But if I uncomment it I’m getting :
Could not deserialize 'application/json' request using ServiceStack.Authenticate'
Error: The JSON value could not be converted to System.Nullable`1[System.Boolean]. Path: $.RememberMe | LineNumber: 0 | BytePositionInLine: 68.
System.Runtime.Serialization.SerializationException: Could not deserialize 'application/json' request using ServiceStack.Authenticate'
Do you have a project that has been upgraded to 8.1 and that’s using more features like AutoQuery, the AuthRepository, etc. that I could look at to see the other changes?
Thanks a lot.