Skip to main content
All docs
V24.2
.NET 8.0+
  • The page you are viewing does not exist in the .NET Framework 4.6.2+ platform documentation. This link will take you to the parent topic of the current section.

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

AuthenticationStandardEvents.OnUserValidated Property

Specifies custom logic used to implement additional validation checks that run after the standard checks succeed.

Namespace: DevExpress.ExpressApp.Security

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

NuGet Package: DevExpress.ExpressApp.Security

#Declaration

public Action<ValidateUserContext> OnUserValidated { get; set; }

#Property Value

Type Description
Action<DevExpress.ExpressApp.Security.ValidateUserContext>

A delegate method that implements custom logic.

#Remarks

Use this event to implement additional user validation logic on top of the standard validation checks. The specified validation logic runs after the standard checks succeed. If validation fails, assign an AuthenticationException to the context.ValidationError property.

Important

Do not throw an exception directly from the handler method. This can lead to faulty behavior.

File: MySolution.Blazor.Server\Startup.cs, MySolution.Win\Startup.cs, MySolution.WebApi\Startup.cs

The following code snippet demonstrates how to use the OnUserValidated event:

services.AddXaf(Configuration, builder => {
    // ...
    builder.Security
        .AddPasswordAuthentication(options => {
            options.IsSupportChangePassword = true;
            options.Events.OnUserValidated += context => { 
                if(((CustomLogonParameters)context.LogonParameters).CustomData == "FAIL") { 
                    context.ValidationError = new AuthenticationException(context.User.UserName); 
                }
            };
        });
        // ...
});
See Also