SecurityStrategyComplex.NewUserRoleName Property
Specifies the name of role which is assigned to auto-created users.
Namespace: DevExpress.ExpressApp.Security
Assembly: DevExpress.ExpressApp.Security.v26.1.dll
NuGet Package: DevExpress.ExpressApp.Security
Declaration
Property Value
| Type | Description |
|---|---|
| String | A string which is the name of the role assigned to auto-created users. |
Remarks
For instance, users are auto-created when AuthenticationActiveDirectory authentication is used and the AuthenticationActiveDirectory.CreateUserAutomatically property is set to true.
You can use this property to update existing applications with Active Directory authentication. For this purpose, follow the steps below:
In Release mode (for production purposes), you can create security users and roles (other than Admins) according to your specific business needs in SolutionName.Module\DatabaseUpdate\Updater.xx. In this case, ensure that this code is not placed under the
#if DEBUGpreprocessor directive. Alternatively, you can create new users and roles at runtime directly from your production application UI or database.Set the
SecurityStrategyComplex.NewUserRoleNameproperty to the name of the role you want to assign to new users automatically.
WinForms Applications
File: MySolution.Win\ApplicationBuilder.cs
public class ApplicationBuilder : IDesignTimeApplicationFactory {
public static WinApplication BuildApplication(string connectionString) {
var builder = WinApplication.CreateBuilder();
// ...
builder.Security
.UseIntegratedMode(options => {
// ...
// Assign the role with the 'Default' name to new users.
options.NewUserRoleName = "Default";
// ...
})
.UseWindowsAuthentication(options => {
options.CreateUserAutomatically();
// ...
});
// ...
}
}
ASP.NET Core Blazor Applications
File: MySolution.Blazor.Server\Startup.cs
public class Startup {
// ...
public void ConfigureServices(IServiceCollection services) {
// ...
services.AddXaf(Configuration, builder => {
// ...
builder.Security
.UseIntegratedMode(options => {
// ...
// Assign the role with the 'Default' name to new users.
options.NewUserRoleName = "Default";
// ...
})
// ...
.AddWindowsAuthentication(options => {
options.CreateUserAutomatically();
// ...
});
// ...
});
}
}
Web API Applications
File: MySolution.WebApi\Startup.cs
public class Startup {
// ...
public void ConfigureServices(IServiceCollection services) {
// ...
services.AddXafWebApi(builder => {
builder.Security
.UseIntegratedMode(options => {
// ...
// Assign the role with the 'Default' name to new users.
options.NewUserRoleName = "Default";
// ...
})
// ...
.AddWindowsAuthentication(options => {
options.CreateUserAutomatically();
// ...
});
// ...
}, Configuration);
}
}
Middle Tier Server Applications
File: MySolution.MiddleTierWebApi\Startup.cs
public class Startup {
// ...
public void ConfigureServices(IServiceCollection services) {
// ...
services.AddXafMiddleTier(Configuration, builder => {
// ...
builder.Security
.UseIntegratedMode(options => {
// ...
// Assign the role with the 'Default' name to new users.
options.NewUserRoleName = "Default";
// ...
})
.AddWindowsAuthentication(options => {
options.CreateUserAutomatically();
// ...
});
// ...
});
}
}