SecurityStrategyComplex Class
A Security Strategy that maintains users who have a list of associated roles.
Namespace: DevExpress.ExpressApp.Security
Assembly: DevExpress.ExpressApp.Security.v22.1.dll
Declaration
Remarks
In the SecurityStrategyComplex security strategy, each user can belong to one or more groups. These groups are called Roles (see XPO PermissionPolicyRole or EF 6/EF Core PermissionPolicyRole). Roles are characterized by an associated permission set. An application administrator creates users and roles, and assigns roles to users. An application developer can create a set of predefined users and roles that can be extended later by an administrator (see Client-Side Security (2-Tier Architecture)).
Note
To see what capabilities are provided to an administrator within the SecurityStrategyComplex security strategy, refer to the Security System Overview topic.
By default, a newly created XAF application uses no security. To enable to the SecurityStrategyComplex security strategy, invoke the Application Designer and drag the SecurityStrategyComplex component from the ToolBox‘s DX.22.1: XAF Security page to the designer’s Security pane.
You can specify a custom user and role type by changing the SecurityStrategy.UserType and SecurityStrategyComplex.RoleType values in the Properties window.
Then, specify the authentication type that will accompany the security strategy. Drag either the AuthenticationStandard or AuthenticationActiveDirectory component from the toolbox to the Security pane of the designer. You can also use a custom authentication (see How to: Use Custom Logon Parameters and Authentication).
Alternatively, you can enable the SecurityStrategyComplex Security Strategy in code. It is required to instantiate the SecurityStrategyComplex class and assign this instance to the XafApplication.Security property. In a Windows Forms application project, modify the Program.cs (Program.vb) file in the following manner.
public static void Main(string[] arguments) {
MySolutionWinApplication winApplication = new MySolutionWinApplication();
winApplication.Security =
new SecurityStrategyComplex(typeof(PermissionPolicyUser), typeof(PermissionPolicyRole),
new AuthenticationStandard());
// ...
}
In an ASP.NET Web Forms application project, modify the Global.asax.cs (Global.asax.vb) file in the following manner.
protected void Session_Start(Object sender, EventArgs e) {
WebApplication.SetInstance(Session, new MySolutionAspNetApplication());
WebApplication.Instance.Security =
new SecurityStrategyComplex(typeof(PermissionPolicyUser), typeof(PermissionPolicyRole),
new AuthenticationStandard());
// ...
}
As a result, in a WinForms application you can see the User, Role and My Details navigation items. The active user name is displayed in the status bar.
Related GitHub Examples
The following code snippets (auto-collected from DevExpress Examples) contain references to the SecurityStrategyComplex class.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.