This example customizes standard authentication behavior and supplies additional logon parameters in an XAF application. The default login form displays User Name and Password editors. This sample replaces User Name with Company and Application User lookup editors.
Note:
- When first running a Blazor application, it does not create a database or populate lookup editors. To create a database, either log in with an empty username or start the Middle Tier server.
- If using Middle Tier security, start the Middle Tier server before launching the Blazor or Win Forms client.
-
Define a Company class that contains company names. This class should contain a list of
ApplicationUserobjects as a part of a one-to-many relationship. Add the second part of this relationship to the ApplicationUser class generated by the Template Kit. Then, add theCompanyclass to your application's DbContext. -
Create a custom logon parameter class that uses the
Companyclass (CustomLogonParameters.cs). -
To access lists of companies and application users in login form (before authentication), implement data transfer objects (DTO) (CompanyDTO.cs / ApplicationUserDTO.cs).
-
Register the
CustomLogonParameterstype as a known logon parameter type (Program.cs (Blazor) / Program.cs (WinForms)). -
A lookup editor displays the Edit button. Create a controller and call the CustomizeViewItemControl method to hide the button from the Company and Application User lookup editors (CustomLogonParameterLookupActionVisibilityController.cs).
For detailed instructions, refer to the following topic: Customize Standard Authentication Behavior and Supply Additional Logon Parameters.
- Company.cs
- ApplicationUser.cs
- EFCoreCustomLogonAllDbContext.cs
- CustomLogonParameters.cs
- Program.cs (Blazor)
- Program.cs (WinForms)
- CompanyDTO.cs
- ApplicationUserDTO.cs
- CustomLogonParameterLookupActionVisibilityController.cs
- Customize Standard Authentication Behavior and Supply Additional Logon Parameters (.NET Applications)
- Customize Standard Authentication Behavior and Supply Additional Logon Parameters (.NET Framework Applications)
(you will be redirected to DevExpress.com to submit your response)
