SecurityStrategy.AnonymousAllowedTypes Property
Specifies types that users can access anonymously before they log in.
Namespace: DevExpress.ExpressApp.Security
Assembly: DevExpress.ExpressApp.Security.v21.2.dll
NuGet Package: DevExpress.ExpressApp.Security
Declaration
Remarks
Anonymous access may be required when you use custom logon parameters and want to display certain data in the logon window before a user logs on. Add the required types to the AnonymousAllowedTypes collection to grant access to these types before a successful user authentication. This code should be executed before the application displays the logon window.
The following examples demonstrate how to specify this property:
WinForms
File: MySolution.Win\WinApplication.cs(.vb) (the WinApplication descendant’s constructor).
using DevExpress.ExpressApp;
using DevExpress.ExpressApp.Security;
using DevExpress.ExpressApp.Win;
// ...
public partial class CustomLogonParametersExampleWindowsFormsApplication : WinApplication {
// ...
public CustomLogonParametersExampleWindowsFormsApplication() {
// ...
((SecurityStrategy)Security).AnonymousAllowedTypes.Add(typeof(Company));
((SecurityStrategy)Security).AnonymousAllowedTypes.Add(typeof(Employee));
}
// ...
}
ASP.NET Web Forms
File: MySolution.Web\WebApplication.cs(.vb) (the WebApplication descendant’s constructor).
using DevExpress.ExpressApp;
using DevExpress.ExpressApp.Security;
using DevExpress.ExpressApp.Web;
// ...
public partial class CustomLogonParametersExampleAspNetApplication : WebApplication {
// ...
public CustomLogonParametersExampleAspNetApplication() {
// ...
((SecurityStrategy)Security).AnonymousAllowedTypes.Add(typeof(Company));
((SecurityStrategy)Security).AnonymousAllowedTypes.Add(typeof(Employee));
}
// ...
}
ASP.NET Core Blazor and Web API
File: MySolution.Blazor.Server\Startup.cs (the ConfigureServices method).
using DevExpress.ExpressApp.Security;
using Microsoft.Extensions.DependencyInjection;
// ...
public class Startup {
// ...
public void ConfigureServices(IServiceCollection services) {
// ...
services.AddXafSecurity(options => {
// ...
options.Events.OnSecurityStrategyCreated = securityStrategy => {
// ...
((SecurityStrategy)securityStrategy).AnonymousAllowedTypes.Add(typeof(Company));
((SecurityStrategy)securityStrategy).AnonymousAllowedTypes.Add(typeof(Employee));
};
})
// ...
}
}