.NET Standard 2.0+
.NET Framework 4.5.2+
.NET Standard 2.0+
.NET 5.0+

AuthenticationStandard Class

An Authentication that assumes an interactive logon. A user inputs logon parameters (e.g. user name and password) manually via the logon dialog.

Namespace: DevExpress.ExpressApp.Security

Assembly: DevExpress.ExpressApp.Security.v21.2.dll

Declaration

[ToolboxTabName("DX.21.2: XAF Security")]
public class AuthenticationStandard :
    AuthenticationBase,
    IAuthenticationStandard,
    ISupportChangePasswordOption

Remarks

When the AuthenticationStandard authentication is in use, the logon Window displays a Detail View of an AuthenticationStandardLogonParameters type object. This object has two string properties: UserName and Password. The UserName property is used to find the corresponding user in the database. Logging on to the application is not allowed if the user is not found or the specified password is wrong. The AuthenticationStandard object works only with objects of the AuthenticationStandardLogonParameters type or its descendants.

Logon Window in a WinForms Application

Logon Window in a WinForms Application

Logon Window in an ASP.NET Web Forms Application

Logon Window in an ASP.NET Web Forms Application

Logon Window in an ASP.NET Core Blazor Application

Logon Window in an ASP.NET Core Blazor Application

You can enable the AuthenticationStandard authentication in code. It is required to instantiate the AuthenticationStandard class and pass this instance to the SecurityStrategyComplex constructor. Then, the created security strategy object should be assigned 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 SecurityDemoAuthentication());
    // ...
}

In a Blazor application project, modify the Startup.cs file in the following manner.

using DevExpress.ExpressApp.Blazor.Services;
using DevExpress.Persistent.BaseImpl.PermissionPolicy; // for XPO
using DevExpress.Persistent.BaseImpl.EF.PermissionPolicy; // for EF Core
// ...
namespace MySolutionName.Blazor.Server {
    public class Startup {
        // ...
        public void ConfigureServices(IServiceCollection services) {
            // ...
            services.AddXaf<MySolutionNameBlazorApplication>(Configuration);
            services.AddXafSecurity(options => {
                options.RoleType = typeof(PermissionPolicyRole);
                options.UserType = typeof(PermissionPolicyUser);
                options.Events.OnSecurityStrategyCreated = securityStrategy => ((SecurityStrategy)securityStrategy).RegisterXPOAdapterProviders();
                options.SupportNavigationPermissionsForTypes = false;
            }).AddExternalAuthentication<HttpContextPrincipalProvider>()
            .AddAuthenticationStandard(options => {
                options.IsSupportChangePassword = true;
            });
            services.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme).AddCookie(options => {
                options.LoginPath = "/LoginPage";
            });
        }
        // ...
    }
}

In .NET Framework applications, you can also enable the AuthenticationStandard authentication in the Application Designer. To do this, invoke the designer and drag the AuthenticationStandard component from the ToolBox‘s DX.21.2: XAF Security page to the designer’s Security pane.

Security_DesignerAuthenticationSimple

If the server-side security is used, refer to the Middle Tier Security topic to see how to enable the AuthenticationStandard authentication.

See Also