Is there a way to configure user lockout settings per tenant? #10229
-
The after reading the docs, it seems to be global for all tenants |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
IMHO it could be possible - and the current documentation missed for multi tenant - may be because it's obvious to achieve by implementing Option Pattern? https://docs.microsoft.com/en-us/aspnet/core/fundamentals/configuration/options?view=aspnetcore-5.0 You can modify any I have not tested - but you can try following and see if that works for you. If implementing
internal class TenantIdentityOptions : IConfigureOptions<IdentityOptions>
{
private readonly IShellConfiguration _shellConfiguration;
public TenantIdentityOptions(IShellConfiguration shellConfiguration)
{
_shellConfiguration = shellConfiguration;
}
public void Configure(IdentityOptions options)
{
_shellConfiguration.GetSection("IdentityOptions").Bind(options);
}
}
services.ConfigureOptions<TenantIdentityOptions>();
{
"OrchardCore": {
"TenantA": {
"IdentityOptions": {
"Lockout": {
"AllowedForNewUsers": true,
"DefaultLockoutTimeSpan ": "00:05:00",
"MaxFailedAccessAttempts ": 5
},
"Password": {
"RequireDigit": false,
"RequireLowercase": true,
"RequireUppercase": true,
"RequireNonAlphanumeric": false,
"RequiredUniqueChars": 3,
"RequiredLength": 6
}
}
}
}
} |
Beta Was this translation helpful? Give feedback.
IMHO it could be possible - and the current documentation missed for multi tenant - may be because it's obvious to achieve by implementing Option Pattern? https://docs.microsoft.com/en-us/aspnet/core/fundamentals/configuration/options?view=aspnetcore-5.0
You can modify any
IOptions
values by implementingIConfigureOptions
orIPostConfigureOptions
I have not tested - but you can try following and see if that works for you. If implementing
IConfigureOptions
doesn't work then try implementingIPostConfigureOptions
TenantIdentity
options