SecurityStrategyComplex Class

A Security Strategy that maintains users who have a list of associated roles.

Namespace: DevExpress.ExpressApp.Security

Assembly: DevExpress.ExpressApp.Security.v18.1.dll

Syntax

public class SecurityStrategyComplex :
    SecurityStrategy,
    ISupportChangePasswordOption,
    ISupportChangedNotification,
    ICanInitializeNewUser,
    IObjectSpaceLinks,
    IDataServerSecurity,
    ISelectDataSecurityProvider,
    IRequestSecurityStrategy,
    IRequestSecurity,
    ISupportLogonEvent,
    ISupportSecurityTypeManager,
    ISupportNavigationPermissionsForTypes,
    ISecurityComplex,
    ISecurityStrategyBase,
    IRoleTypeProvider

In the SecurityStrategyComplex security strategy, each user can belong to one or more groups. These groups are called Roles (see XPO PermissionPolicyRole or EF 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.18.1: XAF Security page to the designer's Security pane.

Security_UseSecurityStrategyComplex

You can specify a custom user and role type by changing the SecurityStrategy.UserType and SecurityStrategyComplex.RoleType values in the Properties window.

Security_SetCustomUserType

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).

Security_DesignerAuthenticationSimple

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 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.Tutorial_Security_ActiveDir

Inheritance

Object
DevExpress.ExpressApp.Security.SecurityStrategyBase
SecurityStrategy
SecurityStrategyComplex

See Also