ServiceStack RegistrationFeature and Localized Validation messages
By : randylang
Date : March 29 2020, 07:55 AM
|
Is it possible to override the default URL for Servicestack RegistrationFeature?
By : Julieann
Date : March 29 2020, 07:55 AM
I think the issue was by ths following , I just committed a fix so in the next release (v3.9.55+) you can configure it with: code :
Plugins.Add(new RegistrationFeature { AtRestPath = "/myregisterpath" });
|
How can I use ServiceStack RegistrationFeature plugin with Redis?
By : user2111836
Date : March 29 2020, 07:55 AM
hop of those help? If you enable the RegistrationFeature and use the Redis setup I suggested in this answer (shown below for completeness) then Registrations will work like normal ServiceStack authentication. code :
private IRedisClientsManager redisClientsManager;
public override void Configure(Funq.Container container)
{
// Configure ServiceStack to connect to Redis
// Replace with your connection details
redisClientsManager = new PooledRedisClientManager("127.0.0.1:6379");
container.Register<IRedisClientsManager>(c => redisClientsManager);
container.Register<ICacheClient>(c => c.Resolve<IRedisClientsManager>().GetCacheClient()).ReusedWithin(Funq.ReuseScope.None);
// Setup the authorisation feature
Plugins.Add(new AuthFeature(()=>
new AuthUserSession(),
new IAuthProvider[]{ new BasicAuthProvider() }
));
// Use a RedisAuthRepository
var userRepo = new RedisAuthRepository(redisClientsManager);
container.Register<IUserAuthRepository>(userRepo);
// Enable the RegistrationFeature
Plugins.Add(new RegistrationFeature());
}
{
"UserName": "john.smith",
"Password": "test",
"Email": "john.smith@domain.com",
"FirstName": "John",
"LastName": "Smith",
"DisplayName": "John Smith"
}
|
Require admin role for ServiceStack's RegistrationFeature
By : yashwant vemuru
Date : March 29 2020, 07:55 AM
Hope that helps If you don't want users to be able to register themselves then maybe you don't want to enable the RegistrationFeature itself which is not registered by default. You'll have more flexibility in just using the IAuthRepository itself in your own Service to create users. code :
if (authRepo.GetUserAuthByUserName("user@gmail.com") == null)
{
var testUser = authRepo.CreateUserAuth(new UserAuth
{
DisplayName = "Test User",
Email = "user@gmail.com",
FirstName = "Test",
LastName = "User",
}, "p@55wOrd");
}
if (authRepo.GetUserAuthByUserName("manager@gmail.com") == null)
{
var roleUser = authRepo.CreateUserAuth(new UserAuth
{
DisplayName = "Test Manager",
Email = "manager@gmail.com",
FirstName = "Test",
LastName = "Manager",
}, "p@55wOrd");
authRepo.AssignRoles(roleUser, roles:new[]{ "Manager" });
}
if (authRepo.GetUserAuthByUserName("admin@gmail.com") == null)
{
var roleUser = authRepo.CreateUserAuth(new UserAuth
{
DisplayName = "Admin User",
Email = "admin@gmail.com",
FirstName = "Admin",
LastName = "User",
}, "p@55wOrd");
authRepo.AssignRoles(roleUser, roles:new[]{ "Admin" });
}
|
How to add a http header when post request to a servicestack web api using servicestack swift plugin?
By : Irad Raz
Date : March 29 2020, 07:55 AM
|