From db7ed9167c16379f2e95f9ed690a2996f516662f Mon Sep 17 00:00:00 2001 From: "nikulina.svetlana" Date: Mon, 4 Aug 2025 23:55:21 +0400 Subject: [PATCH 01/10] update --- README.md | 39 +++++++++++++++++---------------------- 1 file changed, 17 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index ee7c039..35941fb 100644 --- a/README.md +++ b/README.md @@ -6,41 +6,36 @@ # XAF - Customize Logon Parameters -This example demonstrates how to customize standard authentication behavior and supply additional logon parameters in XAF applications. The default login form displays **User Name** and **Password** editors. This sample customizes the login form to show **Company** and **Application User** lookup editors instead of **User Name**. +This example customizes standard authentication behavior and supply additional logon parameters in a XAF application. The default login form displays `User Name` and `Password` editors. This sample replaces `User Name` with `Company` and `Application User` lookup editors. ![Login form](https://docs.devexpress.com/eXpressAppFramework/images/custom-logon-prameters-blazor.png) -## Implementation Details - -### ASP.NET Core Blazor - -1. Define a [Company](./CS/EF/EFCoreCustomLogonAll.Module/BusinessObjects/Company.cs) class that contains company names. This class should contain a list of `ApplicationUser` objects as a part of a one-to-many relationship. Add the second part of this relationship to the [ApplicationUser](./CS/EF/EFCoreCustomLogonAll.Module/BusinessObjects/ApplicationUser.cs#L28) class generated by the Solution Wizard. Finally, add the `Company` class to your application’s [DbContext](./CS/EF/EFCoreCustomLogonAll.Module/BusinessObjects/EFCoreCustomLogonAllDbContext.cs#L43). -2. Create a custom logon parameter class that uses the `Company` class. To see an example, refer to the following file - [CustomLogonParameters.cs]. -3. Implement [custom authentication] that uses custom logon parameters. -4. Implement a custom [authentication provider] that creates an instance of the custom authentication strategy. -5. Pass custom classes to the Security System. To see an example, refer to the following file - [Startup.cs](./CS/EF/EFCoreCustomLogonAll.Blazor.Server/Startup.cs#L73-L78). -6. Add [demo data](./CS/EF/EFCoreCustomLogonAll.Module/DatabaseUpdate/Updater.cs). -7. Generate a [demo database](https://docs.devexpress.com/eXpressAppFramework/404264/data-security-and-safety/security-system/authentication/customize-standard-authentication-behavior-and-supply-additional-logon-parameters/customize-authentication-behavior-blazor#generate-a-demo-database). -8. Run the application. +> **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. -For detailed instructions, refer to the following topic: [Customize Standard Authentication Behavior and Supply Additional Logon Parameters (Blazor)](https://docs.devexpress.com/eXpressAppFramework/404264/data-security-and-safety/security-system/authentication/customize-standard-authentication-behavior-and-supply-additional-logon-parameters/customize-authentication-behavior-blazor). +## Implementation Details -### WinForms and ASP.NET Web Forms +1. Define a [Company](./CS/EF/EFCoreCustomLogonAll.Module/BusinessObjects/Company.cs) class that contains company names. This class should contain a list of `ApplicationUser` objects as a part of a one-to-many relationship. Add the second part of this relationship to the [ApplicationUser](./CS/EF/EFCoreCustomLogonAll.Module/BusinessObjects/ApplicationUser.cs#L28) class generated by the [Template Kit](https://docs.devexpress.com/eXpressAppFramework/405447/installation-upgrade-version-history/visual-studio-integration/template-kit). Finally, add the `Company` class to your application's [DbContext](./CS/EF/EFCoreCustomLogonAll.Module/BusinessObjects/EFCoreCustomLogonAllDbContext.cs#L43). +1. Create a custom logon parameter class that uses the `Company` class (file [CustomLogonParameters.cs](./CS/EF/EFCoreCustomLogonAll.Module/Authentication/CustomLogonParameters.cs)). +1. To access lists of companies and application users in login form (before authentication), implement data transfer objects (DTO) (files [CompanyDTO.cs](./CS/EF/EFCoreCustomLogonAll.Module/Authentication/CompanyDTO.cs) and [ApplicationUserDTO.cs](./CS/EF/EFCoreCustomLogonAll.Module/Authentication/ApplicationUserDTO.cs)). +1. Register the `CustomLogonParameters` type as a known logon parameter type (files [Program.cs (Blazor)](./CS/EF/EFCoreCustomLogonAll.Blazor.Server/Program.cs#L17) and [Program.cs (WinForms)](CS/EF/EFCoreCustomLogonAll.Win/Program.cs#L14)). +1. A lookup editor displays the Edit button. Create a controller and call the [CustomizeViewItemControl](https://docs.devexpress.com/eXpressAppFramework/DevExpress.ExpressApp.DetailViewExtensions.CustomizeViewItemControl.overloads) method to hide the button ([CustomLogonParameterLookupActionVisibilityController](./CS/EF/EFCoreCustomLogonAll.Blazor.Server/Authentication/CustomLogonParameterLookupActionVisibilityController.cs)). -For detailed instructions, refer to the following topic: [Customize Standard Authentication Behavior and Supply Additional Logon Parameters (WinForms & ASP.NET Web Forms)](https://docs.devexpress.com/eXpressAppFramework/112982/data-security-and-safety/security-system/authentication/customize-standard-authentication-behavior-and-supply-additional-logon-parameters/customize-authentication-behavior-web). +For detailed instructions, refer to the following topic: [Customize Standard Authentication Behavior and Supply Additional Logon Parameters](https://docs.devexpress.com/eXpressAppFramework/404264/data-security-and-safety/security-system/authentication/customize-standard-authentication-behavior-and-supply-additional-logon-parameters/customize-authentication-behavior-blazor). ## Files to Review * [Company.cs](./CS/EF/EFCoreCustomLogonAll.Module/BusinessObjects/Company.cs) -* [CustomLogonParameters.cs] -* [CustomAuthentication.cs] -* [CustomAuthenticationStandardProvider.cs] +* [ApplicationUser.cs](./CS/EF/EFCoreCustomLogonAll.Module/BusinessObjects/ApplicationUser.cs) +* [CustomLogonParameters.cs](./CS/EF/EFCoreCustomLogonAll.Module/Authentication/CustomLogonParameters.cs) +* [Program.cs (Blazor)](./CS/EF/EFCoreCustomLogonAll.Blazor.Server/Program.cs#L17) / [Program.cs (WinForms)](CS/EF/EFCoreCustomLogonAll.Win/Program.cs#L14) ## Documentation -* [Customize Standard Authentication Behavior and Supply Additional Logon Parameters (Blazor)](https://docs.devexpress.com/eXpressAppFramework/404264/data-security-and-safety/security-system/authentication/customize-standard-authentication-behavior-and-supply-additional-logon-parameters/customize-authentication-behavior-blazor) -* [Customize Standard Authentication Behavior and Supply Additional Logon Parameters (WinForms & ASP.NET Web Forms)](https://docs.devexpress.com/eXpressAppFramework/112982/data-security-and-safety/security-system/authentication/customize-standard-authentication-behavior-and-supply-additional-logon-parameters/customize-authentication-behavior-web) +* [Customize Standard Authentication Behavior and Supply Additional Logon Parameters (**.NET Applications**)](https://docs.devexpress.com/eXpressAppFramework/404264/data-security-and-safety/security-system/authentication/customize-standard-authentication-behavior-and-supply-additional-logon-parameters/customize-authentication-behavior-blazor) +* [Customize Standard Authentication Behavior and Supply Additional Logon Parameters (**.NET Framework Applications**)](https://docs.devexpress.com/eXpressAppFramework/112982/data-security-and-safety/security-system/authentication/customize-standard-authentication-behavior-and-supply-additional-logon-parameters/customize-authentication-behavior-web) ## More Examples -* [XAF ASP.NET Web Forms - Use OAuth2 Authentication Providers](https://github.com/DevExpress-Examples/xaf-web-forms-use-oauth2-authentication-providers) + * [Role-based Access Control, Permission Management, and OData / Web / REST API Services for Entity Framework and XPO ORM](https://github.com/DevExpress-Examples/XAF_Security_E4908) ## Does this example address your development requirements/objectives? From 3df8563d06f3a09d28022eb88ccf05b232aedcdf Mon Sep 17 00:00:00 2001 From: DevExpressExampleBot Date: Mon, 4 Aug 2025 23:56:38 +0400 Subject: [PATCH 02/10] README auto update [skip ci] --- README.md | 83 +++++++++++++++++++++++++++---------------------------- 1 file changed, 41 insertions(+), 42 deletions(-) diff --git a/README.md b/README.md index 35941fb..278efdc 100644 --- a/README.md +++ b/README.md @@ -1,46 +1,45 @@ - -![](https://img.shields.io/endpoint?url=https://codecentral.devexpress.com/api/v1/VersionRange/587734441/25.1.3%2B) -[![](https://img.shields.io/badge/Open_in_DevExpress_Support_Center-FF7200?style=flat-square&logo=DevExpress&logoColor=white)](https://supportcenter.devexpress.com/ticket/details/T1145991) -[![](https://img.shields.io/badge/📖_How_to_use_DevExpress_Examples-e9f6fc?style=flat-square)](https://docs.devexpress.com/GeneralInformation/403183) -[![](https://img.shields.io/badge/💬_Leave_Feedback-feecdd?style=flat-square)](#does-this-example-address-your-development-requirementsobjectives) - -# XAF - Customize Logon Parameters - -This example customizes standard authentication behavior and supply additional logon parameters in a XAF application. The default login form displays `User Name` and `Password` editors. This sample replaces `User Name` with `Company` and `Application User` lookup editors. - -![Login form](https://docs.devexpress.com/eXpressAppFramework/images/custom-logon-prameters-blazor.png) - -> **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. - -## Implementation Details - -1. Define a [Company](./CS/EF/EFCoreCustomLogonAll.Module/BusinessObjects/Company.cs) class that contains company names. This class should contain a list of `ApplicationUser` objects as a part of a one-to-many relationship. Add the second part of this relationship to the [ApplicationUser](./CS/EF/EFCoreCustomLogonAll.Module/BusinessObjects/ApplicationUser.cs#L28) class generated by the [Template Kit](https://docs.devexpress.com/eXpressAppFramework/405447/installation-upgrade-version-history/visual-studio-integration/template-kit). Finally, add the `Company` class to your application's [DbContext](./CS/EF/EFCoreCustomLogonAll.Module/BusinessObjects/EFCoreCustomLogonAllDbContext.cs#L43). -1. Create a custom logon parameter class that uses the `Company` class (file [CustomLogonParameters.cs](./CS/EF/EFCoreCustomLogonAll.Module/Authentication/CustomLogonParameters.cs)). -1. To access lists of companies and application users in login form (before authentication), implement data transfer objects (DTO) (files [CompanyDTO.cs](./CS/EF/EFCoreCustomLogonAll.Module/Authentication/CompanyDTO.cs) and [ApplicationUserDTO.cs](./CS/EF/EFCoreCustomLogonAll.Module/Authentication/ApplicationUserDTO.cs)). -1. Register the `CustomLogonParameters` type as a known logon parameter type (files [Program.cs (Blazor)](./CS/EF/EFCoreCustomLogonAll.Blazor.Server/Program.cs#L17) and [Program.cs (WinForms)](CS/EF/EFCoreCustomLogonAll.Win/Program.cs#L14)). -1. A lookup editor displays the Edit button. Create a controller and call the [CustomizeViewItemControl](https://docs.devexpress.com/eXpressAppFramework/DevExpress.ExpressApp.DetailViewExtensions.CustomizeViewItemControl.overloads) method to hide the button ([CustomLogonParameterLookupActionVisibilityController](./CS/EF/EFCoreCustomLogonAll.Blazor.Server/Authentication/CustomLogonParameterLookupActionVisibilityController.cs)). - -For detailed instructions, refer to the following topic: [Customize Standard Authentication Behavior and Supply Additional Logon Parameters](https://docs.devexpress.com/eXpressAppFramework/404264/data-security-and-safety/security-system/authentication/customize-standard-authentication-behavior-and-supply-additional-logon-parameters/customize-authentication-behavior-blazor). - -## Files to Review -* [Company.cs](./CS/EF/EFCoreCustomLogonAll.Module/BusinessObjects/Company.cs) -* [ApplicationUser.cs](./CS/EF/EFCoreCustomLogonAll.Module/BusinessObjects/ApplicationUser.cs) -* [CustomLogonParameters.cs](./CS/EF/EFCoreCustomLogonAll.Module/Authentication/CustomLogonParameters.cs) -* [Program.cs (Blazor)](./CS/EF/EFCoreCustomLogonAll.Blazor.Server/Program.cs#L17) / [Program.cs (WinForms)](CS/EF/EFCoreCustomLogonAll.Win/Program.cs#L14) - -## Documentation -* [Customize Standard Authentication Behavior and Supply Additional Logon Parameters (**.NET Applications**)](https://docs.devexpress.com/eXpressAppFramework/404264/data-security-and-safety/security-system/authentication/customize-standard-authentication-behavior-and-supply-additional-logon-parameters/customize-authentication-behavior-blazor) -* [Customize Standard Authentication Behavior and Supply Additional Logon Parameters (**.NET Framework Applications**)](https://docs.devexpress.com/eXpressAppFramework/112982/data-security-and-safety/security-system/authentication/customize-standard-authentication-behavior-and-supply-additional-logon-parameters/customize-authentication-behavior-web) - -## More Examples - -* [Role-based Access Control, Permission Management, and OData / Web / REST API Services for Entity Framework and XPO ORM](https://github.com/DevExpress-Examples/XAF_Security_E4908) - + +[![](https://img.shields.io/badge/Open_in_DevExpress_Support_Center-FF7200?style=flat-square&logo=DevExpress&logoColor=white)](https://supportcenter.devexpress.com/ticket/details/T1145991) +[![](https://img.shields.io/badge/📖_How_to_use_DevExpress_Examples-e9f6fc?style=flat-square)](https://docs.devexpress.com/GeneralInformation/403183) +[![](https://img.shields.io/badge/💬_Leave_Feedback-feecdd?style=flat-square)](#does-this-example-address-your-development-requirementsobjectives) + +# XAF - Customize Logon Parameters + +This example customizes standard authentication behavior and supply additional logon parameters in a XAF application. The default login form displays `User Name` and `Password` editors. This sample replaces `User Name` with `Company` and `Application User` lookup editors. + +![Login form](https://docs.devexpress.com/eXpressAppFramework/images/custom-logon-prameters-blazor.png) + +> **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. + +## Implementation Details + +1. Define a [Company](./CS/EF/EFCoreCustomLogonAll.Module/BusinessObjects/Company.cs) class that contains company names. This class should contain a list of `ApplicationUser` objects as a part of a one-to-many relationship. Add the second part of this relationship to the [ApplicationUser](./CS/EF/EFCoreCustomLogonAll.Module/BusinessObjects/ApplicationUser.cs#L28) class generated by the [Template Kit](https://docs.devexpress.com/eXpressAppFramework/405447/installation-upgrade-version-history/visual-studio-integration/template-kit). Finally, add the `Company` class to your application's [DbContext](./CS/EF/EFCoreCustomLogonAll.Module/BusinessObjects/EFCoreCustomLogonAllDbContext.cs#L43). +1. Create a custom logon parameter class that uses the `Company` class (file [CustomLogonParameters.cs](./CS/EF/EFCoreCustomLogonAll.Module/Authentication/CustomLogonParameters.cs)). +1. To access lists of companies and application users in login form (before authentication), implement data transfer objects (DTO) (files [CompanyDTO.cs](./CS/EF/EFCoreCustomLogonAll.Module/Authentication/CompanyDTO.cs) and [ApplicationUserDTO.cs](./CS/EF/EFCoreCustomLogonAll.Module/Authentication/ApplicationUserDTO.cs)). +1. Register the `CustomLogonParameters` type as a known logon parameter type (files [Program.cs (Blazor)](./CS/EF/EFCoreCustomLogonAll.Blazor.Server/Program.cs#L17) and [Program.cs (WinForms)](CS/EF/EFCoreCustomLogonAll.Win/Program.cs#L14)). +1. A lookup editor displays the Edit button. Create a controller and call the [CustomizeViewItemControl](https://docs.devexpress.com/eXpressAppFramework/DevExpress.ExpressApp.DetailViewExtensions.CustomizeViewItemControl.overloads) method to hide the button ([CustomLogonParameterLookupActionVisibilityController](./CS/EF/EFCoreCustomLogonAll.Blazor.Server/Authentication/CustomLogonParameterLookupActionVisibilityController.cs)). + +For detailed instructions, refer to the following topic: [Customize Standard Authentication Behavior and Supply Additional Logon Parameters](https://docs.devexpress.com/eXpressAppFramework/404264/data-security-and-safety/security-system/authentication/customize-standard-authentication-behavior-and-supply-additional-logon-parameters/customize-authentication-behavior-blazor). + +## Files to Review +* [Company.cs](./CS/EF/EFCoreCustomLogonAll.Module/BusinessObjects/Company.cs) +* [ApplicationUser.cs](./CS/EF/EFCoreCustomLogonAll.Module/BusinessObjects/ApplicationUser.cs) +* [CustomLogonParameters.cs](./CS/EF/EFCoreCustomLogonAll.Module/Authentication/CustomLogonParameters.cs) +* [Program.cs (Blazor)](./CS/EF/EFCoreCustomLogonAll.Blazor.Server/Program.cs#L17) / [Program.cs (WinForms)](CS/EF/EFCoreCustomLogonAll.Win/Program.cs#L14) + +## Documentation +* [Customize Standard Authentication Behavior and Supply Additional Logon Parameters (**.NET Applications**)](https://docs.devexpress.com/eXpressAppFramework/404264/data-security-and-safety/security-system/authentication/customize-standard-authentication-behavior-and-supply-additional-logon-parameters/customize-authentication-behavior-blazor) +* [Customize Standard Authentication Behavior and Supply Additional Logon Parameters (**.NET Framework Applications**)](https://docs.devexpress.com/eXpressAppFramework/112982/data-security-and-safety/security-system/authentication/customize-standard-authentication-behavior-and-supply-additional-logon-parameters/customize-authentication-behavior-web) + +## More Examples + +* [Role-based Access Control, Permission Management, and OData / Web / REST API Services for Entity Framework and XPO ORM](https://github.com/DevExpress-Examples/XAF_Security_E4908) + ## Does this example address your development requirements/objectives? [](https://www.devexpress.com/support/examples/survey.xml?utm_source=github&utm_campaign=xaf-custom-logon-parameters&~~~was_helpful=yes) [](https://www.devexpress.com/support/examples/survey.xml?utm_source=github&utm_campaign=xaf-custom-logon-parameters&~~~was_helpful=no) -(you will be redirected to DevExpress.com to submit your response) - +(you will be redirected to DevExpress.com to submit your response) + From 5883c5bbf6e712db782ff8a0eb28df8fe36d86be Mon Sep 17 00:00:00 2001 From: Svetlana Nikulina Date: Tue, 5 Aug 2025 14:28:12 +0400 Subject: [PATCH 03/10] Update README.md --- README.md | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 278efdc..d3053e7 100644 --- a/README.md +++ b/README.md @@ -16,18 +16,23 @@ This example customizes standard authentication behavior and supply additional l ## Implementation Details 1. Define a [Company](./CS/EF/EFCoreCustomLogonAll.Module/BusinessObjects/Company.cs) class that contains company names. This class should contain a list of `ApplicationUser` objects as a part of a one-to-many relationship. Add the second part of this relationship to the [ApplicationUser](./CS/EF/EFCoreCustomLogonAll.Module/BusinessObjects/ApplicationUser.cs#L28) class generated by the [Template Kit](https://docs.devexpress.com/eXpressAppFramework/405447/installation-upgrade-version-history/visual-studio-integration/template-kit). Finally, add the `Company` class to your application's [DbContext](./CS/EF/EFCoreCustomLogonAll.Module/BusinessObjects/EFCoreCustomLogonAllDbContext.cs#L43). -1. Create a custom logon parameter class that uses the `Company` class (file [CustomLogonParameters.cs](./CS/EF/EFCoreCustomLogonAll.Module/Authentication/CustomLogonParameters.cs)). -1. To access lists of companies and application users in login form (before authentication), implement data transfer objects (DTO) (files [CompanyDTO.cs](./CS/EF/EFCoreCustomLogonAll.Module/Authentication/CompanyDTO.cs) and [ApplicationUserDTO.cs](./CS/EF/EFCoreCustomLogonAll.Module/Authentication/ApplicationUserDTO.cs)). -1. Register the `CustomLogonParameters` type as a known logon parameter type (files [Program.cs (Blazor)](./CS/EF/EFCoreCustomLogonAll.Blazor.Server/Program.cs#L17) and [Program.cs (WinForms)](CS/EF/EFCoreCustomLogonAll.Win/Program.cs#L14)). -1. A lookup editor displays the Edit button. Create a controller and call the [CustomizeViewItemControl](https://docs.devexpress.com/eXpressAppFramework/DevExpress.ExpressApp.DetailViewExtensions.CustomizeViewItemControl.overloads) method to hide the button ([CustomLogonParameterLookupActionVisibilityController](./CS/EF/EFCoreCustomLogonAll.Blazor.Server/Authentication/CustomLogonParameterLookupActionVisibilityController.cs)). +1. Create a custom logon parameter class that uses the `Company` class ([CustomLogonParameters.cs](./CS/EF/EFCoreCustomLogonAll.Module/Authentication/CustomLogonParameters.cs)). +1. To access lists of companies and application users in login form (before authentication), implement data transfer objects (DTO) ([CompanyDTO.cs](./CS/EF/EFCoreCustomLogonAll.Module/Authentication/CompanyDTO.cs) / [ApplicationUserDTO.cs](./CS/EF/EFCoreCustomLogonAll.Module/Authentication/ApplicationUserDTO.cs)). +1. Register the `CustomLogonParameters` type as a known logon parameter type ([Program.cs (Blazor)](./CS/EF/EFCoreCustomLogonAll.Blazor.Server/Program.cs#L17) / [Program.cs (WinForms)](CS/EF/EFCoreCustomLogonAll.Win/Program.cs#L14)). +1. A lookup editor displays the Edit button. Create a controller and call the [CustomizeViewItemControl](https://docs.devexpress.com/eXpressAppFramework/DevExpress.ExpressApp.DetailViewExtensions.CustomizeViewItemControl.overloads) method to hide the button from the `Company` and `Application User` lookup editors ([CustomLogonParameterLookupActionVisibilityController](./CS/EF/EFCoreCustomLogonAll.Blazor.Server/Authentication/CustomLogonParameterLookupActionVisibilityController.cs)). For detailed instructions, refer to the following topic: [Customize Standard Authentication Behavior and Supply Additional Logon Parameters](https://docs.devexpress.com/eXpressAppFramework/404264/data-security-and-safety/security-system/authentication/customize-standard-authentication-behavior-and-supply-additional-logon-parameters/customize-authentication-behavior-blazor). ## Files to Review * [Company.cs](./CS/EF/EFCoreCustomLogonAll.Module/BusinessObjects/Company.cs) * [ApplicationUser.cs](./CS/EF/EFCoreCustomLogonAll.Module/BusinessObjects/ApplicationUser.cs) +* [EFCoreCustomLogonAllDbContext](./CS/EF/EFCoreCustomLogonAll.Module/BusinessObjects/EFCoreCustomLogonAllDbContext.cs) * [CustomLogonParameters.cs](./CS/EF/EFCoreCustomLogonAll.Module/Authentication/CustomLogonParameters.cs) -* [Program.cs (Blazor)](./CS/EF/EFCoreCustomLogonAll.Blazor.Server/Program.cs#L17) / [Program.cs (WinForms)](CS/EF/EFCoreCustomLogonAll.Win/Program.cs#L14) +* [Program.cs (Blazor)](./CS/EF/EFCoreCustomLogonAll.Blazor.Server/Program.cs) +* [Program.cs (WinForms)](CS/EF/EFCoreCustomLogonAll.Win/Program.cs) +* [CompanyDTO.cs](./CS/EF/EFCoreCustomLogonAll.Module/Authentication/CompanyDTO.cs) +* [ApplicationUserDTO.cs](./CS/EF/EFCoreCustomLogonAll.Module/Authentication/ApplicationUserDTO.cs) +* [CustomLogonParameterLookupActionVisibilityController](./CS/EF/EFCoreCustomLogonAll.Blazor.Server/Authentication/CustomLogonParameterLookupActionVisibilityController.cs) ## Documentation * [Customize Standard Authentication Behavior and Supply Additional Logon Parameters (**.NET Applications**)](https://docs.devexpress.com/eXpressAppFramework/404264/data-security-and-safety/security-system/authentication/customize-standard-authentication-behavior-and-supply-additional-logon-parameters/customize-authentication-behavior-blazor) @@ -37,9 +42,10 @@ For detailed instructions, refer to the following topic: [Customize Standard Aut * [Role-based Access Control, Permission Management, and OData / Web / REST API Services for Entity Framework and XPO ORM](https://github.com/DevExpress-Examples/XAF_Security_E4908) -## Does this example address your development requirements/objectives? - -[](https://www.devexpress.com/support/examples/survey.xml?utm_source=github&utm_campaign=xaf-custom-logon-parameters&~~~was_helpful=yes) [](https://www.devexpress.com/support/examples/survey.xml?utm_source=github&utm_campaign=xaf-custom-logon-parameters&~~~was_helpful=no) - +## Does this example address your development requirements/objectives? + +[](https://www.devexpress.com/support/examples/survey.xml?utm_source=github&utm_campaign=xaf-custom-logon-parameters&~~~was_helpful=yes) [](https://www.devexpress.com/support/examples/survey.xml?utm_source=github&utm_campaign=xaf-custom-logon-parameters&~~~was_helpful=no) + (you will be redirected to DevExpress.com to submit your response) + From c4367a8fd44600d91313f1cc265bcd190f1276fd Mon Sep 17 00:00:00 2001 From: Svetlana Nikulina Date: Tue, 5 Aug 2025 14:29:03 +0400 Subject: [PATCH 04/10] Update README.md --- README.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index d3053e7..0ce79c8 100644 --- a/README.md +++ b/README.md @@ -19,20 +19,20 @@ This example customizes standard authentication behavior and supply additional l 1. Create a custom logon parameter class that uses the `Company` class ([CustomLogonParameters.cs](./CS/EF/EFCoreCustomLogonAll.Module/Authentication/CustomLogonParameters.cs)). 1. To access lists of companies and application users in login form (before authentication), implement data transfer objects (DTO) ([CompanyDTO.cs](./CS/EF/EFCoreCustomLogonAll.Module/Authentication/CompanyDTO.cs) / [ApplicationUserDTO.cs](./CS/EF/EFCoreCustomLogonAll.Module/Authentication/ApplicationUserDTO.cs)). 1. Register the `CustomLogonParameters` type as a known logon parameter type ([Program.cs (Blazor)](./CS/EF/EFCoreCustomLogonAll.Blazor.Server/Program.cs#L17) / [Program.cs (WinForms)](CS/EF/EFCoreCustomLogonAll.Win/Program.cs#L14)). -1. A lookup editor displays the Edit button. Create a controller and call the [CustomizeViewItemControl](https://docs.devexpress.com/eXpressAppFramework/DevExpress.ExpressApp.DetailViewExtensions.CustomizeViewItemControl.overloads) method to hide the button from the `Company` and `Application User` lookup editors ([CustomLogonParameterLookupActionVisibilityController](./CS/EF/EFCoreCustomLogonAll.Blazor.Server/Authentication/CustomLogonParameterLookupActionVisibilityController.cs)). +1. A lookup editor displays the Edit button. Create a controller and call the [CustomizeViewItemControl](https://docs.devexpress.com/eXpressAppFramework/DevExpress.ExpressApp.DetailViewExtensions.CustomizeViewItemControl.overloads) method to hide the button from the `Company` and `Application User` lookup editors ([CustomLogonParameterLookupActionVisibilityController.cs](./CS/EF/EFCoreCustomLogonAll.Blazor.Server/Authentication/CustomLogonParameterLookupActionVisibilityController.cs)). For detailed instructions, refer to the following topic: [Customize Standard Authentication Behavior and Supply Additional Logon Parameters](https://docs.devexpress.com/eXpressAppFramework/404264/data-security-and-safety/security-system/authentication/customize-standard-authentication-behavior-and-supply-additional-logon-parameters/customize-authentication-behavior-blazor). ## Files to Review * [Company.cs](./CS/EF/EFCoreCustomLogonAll.Module/BusinessObjects/Company.cs) * [ApplicationUser.cs](./CS/EF/EFCoreCustomLogonAll.Module/BusinessObjects/ApplicationUser.cs) -* [EFCoreCustomLogonAllDbContext](./CS/EF/EFCoreCustomLogonAll.Module/BusinessObjects/EFCoreCustomLogonAllDbContext.cs) +* [EFCoreCustomLogonAllDbContext.cs](./CS/EF/EFCoreCustomLogonAll.Module/BusinessObjects/EFCoreCustomLogonAllDbContext.cs) * [CustomLogonParameters.cs](./CS/EF/EFCoreCustomLogonAll.Module/Authentication/CustomLogonParameters.cs) * [Program.cs (Blazor)](./CS/EF/EFCoreCustomLogonAll.Blazor.Server/Program.cs) * [Program.cs (WinForms)](CS/EF/EFCoreCustomLogonAll.Win/Program.cs) * [CompanyDTO.cs](./CS/EF/EFCoreCustomLogonAll.Module/Authentication/CompanyDTO.cs) * [ApplicationUserDTO.cs](./CS/EF/EFCoreCustomLogonAll.Module/Authentication/ApplicationUserDTO.cs) -* [CustomLogonParameterLookupActionVisibilityController](./CS/EF/EFCoreCustomLogonAll.Blazor.Server/Authentication/CustomLogonParameterLookupActionVisibilityController.cs) +* [CustomLogonParameterLookupActionVisibilityController.cs](./CS/EF/EFCoreCustomLogonAll.Blazor.Server/Authentication/CustomLogonParameterLookupActionVisibilityController.cs) ## Documentation * [Customize Standard Authentication Behavior and Supply Additional Logon Parameters (**.NET Applications**)](https://docs.devexpress.com/eXpressAppFramework/404264/data-security-and-safety/security-system/authentication/customize-standard-authentication-behavior-and-supply-additional-logon-parameters/customize-authentication-behavior-blazor) @@ -49,3 +49,4 @@ For detailed instructions, refer to the following topic: [Customize Standard Aut (you will be redirected to DevExpress.com to submit your response) + From 9698303ed9a5b5607ec91de868d911489d05a9b1 Mon Sep 17 00:00:00 2001 From: DevExpressExampleBot Date: Tue, 5 Aug 2025 14:29:37 +0400 Subject: [PATCH 05/10] README auto update [skip ci] --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 0ce79c8..03e1f29 100644 --- a/README.md +++ b/README.md @@ -42,10 +42,10 @@ For detailed instructions, refer to the following topic: [Customize Standard Aut * [Role-based Access Control, Permission Management, and OData / Web / REST API Services for Entity Framework and XPO ORM](https://github.com/DevExpress-Examples/XAF_Security_E4908) -## Does this example address your development requirements/objectives? - -[](https://www.devexpress.com/support/examples/survey.xml?utm_source=github&utm_campaign=xaf-custom-logon-parameters&~~~was_helpful=yes) [](https://www.devexpress.com/support/examples/survey.xml?utm_source=github&utm_campaign=xaf-custom-logon-parameters&~~~was_helpful=no) - +## Does this example address your development requirements/objectives? + +[](https://www.devexpress.com/support/examples/survey.xml?utm_source=github&utm_campaign=xaf-custom-logon-parameters&~~~was_helpful=yes) [](https://www.devexpress.com/support/examples/survey.xml?utm_source=github&utm_campaign=xaf-custom-logon-parameters&~~~was_helpful=no) + (you will be redirected to DevExpress.com to submit your response) From 8021a351967d608d9bd354ef1ba65a428a667192 Mon Sep 17 00:00:00 2001 From: Svetlana Nikulina Date: Tue, 5 Aug 2025 14:53:06 +0400 Subject: [PATCH 06/10] Update README.md --- README.md | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 03e1f29..53cf434 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ # XAF - Customize Logon Parameters -This example customizes standard authentication behavior and supply additional logon parameters in a XAF application. The default login form displays `User Name` and `Password` editors. This sample replaces `User Name` with `Company` and `Application User` lookup editors. +This example customizes standard authentication behavior and supply additional logon parameters in a XAF application. The default login form displays **User Name** and **Password** editors. This sample replaces **User Name** with **Company** and **Application User** lookup editors. ![Login form](https://docs.devexpress.com/eXpressAppFramework/images/custom-logon-prameters-blazor.png) @@ -19,7 +19,7 @@ This example customizes standard authentication behavior and supply additional l 1. Create a custom logon parameter class that uses the `Company` class ([CustomLogonParameters.cs](./CS/EF/EFCoreCustomLogonAll.Module/Authentication/CustomLogonParameters.cs)). 1. To access lists of companies and application users in login form (before authentication), implement data transfer objects (DTO) ([CompanyDTO.cs](./CS/EF/EFCoreCustomLogonAll.Module/Authentication/CompanyDTO.cs) / [ApplicationUserDTO.cs](./CS/EF/EFCoreCustomLogonAll.Module/Authentication/ApplicationUserDTO.cs)). 1. Register the `CustomLogonParameters` type as a known logon parameter type ([Program.cs (Blazor)](./CS/EF/EFCoreCustomLogonAll.Blazor.Server/Program.cs#L17) / [Program.cs (WinForms)](CS/EF/EFCoreCustomLogonAll.Win/Program.cs#L14)). -1. A lookup editor displays the Edit button. Create a controller and call the [CustomizeViewItemControl](https://docs.devexpress.com/eXpressAppFramework/DevExpress.ExpressApp.DetailViewExtensions.CustomizeViewItemControl.overloads) method to hide the button from the `Company` and `Application User` lookup editors ([CustomLogonParameterLookupActionVisibilityController.cs](./CS/EF/EFCoreCustomLogonAll.Blazor.Server/Authentication/CustomLogonParameterLookupActionVisibilityController.cs)). +1. A lookup editor displays the Edit button. Create a controller and call the [CustomizeViewItemControl](https://docs.devexpress.com/eXpressAppFramework/DevExpress.ExpressApp.DetailViewExtensions.CustomizeViewItemControl.overloads) method to hide the button from the **Company** and **Application User** lookup editors ([CustomLogonParameterLookupActionVisibilityController.cs](./CS/EF/EFCoreCustomLogonAll.Blazor.Server/Authentication/CustomLogonParameterLookupActionVisibilityController.cs)). For detailed instructions, refer to the following topic: [Customize Standard Authentication Behavior and Supply Additional Logon Parameters](https://docs.devexpress.com/eXpressAppFramework/404264/data-security-and-safety/security-system/authentication/customize-standard-authentication-behavior-and-supply-additional-logon-parameters/customize-authentication-behavior-blazor). @@ -42,11 +42,12 @@ For detailed instructions, refer to the following topic: [Customize Standard Aut * [Role-based Access Control, Permission Management, and OData / Web / REST API Services for Entity Framework and XPO ORM](https://github.com/DevExpress-Examples/XAF_Security_E4908) -## Does this example address your development requirements/objectives? - -[](https://www.devexpress.com/support/examples/survey.xml?utm_source=github&utm_campaign=xaf-custom-logon-parameters&~~~was_helpful=yes) [](https://www.devexpress.com/support/examples/survey.xml?utm_source=github&utm_campaign=xaf-custom-logon-parameters&~~~was_helpful=no) - +## Does this example address your development requirements/objectives? + +[](https://www.devexpress.com/support/examples/survey.xml?utm_source=github&utm_campaign=xaf-custom-logon-parameters&~~~was_helpful=yes) [](https://www.devexpress.com/support/examples/survey.xml?utm_source=github&utm_campaign=xaf-custom-logon-parameters&~~~was_helpful=no) + (you will be redirected to DevExpress.com to submit your response) + From ef042e502a3a242c635eb2c2e61bcaa6eb4b79d1 Mon Sep 17 00:00:00 2001 From: DevExpressExampleBot Date: Tue, 5 Aug 2025 14:57:06 +0400 Subject: [PATCH 07/10] README auto update [skip ci] --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 53cf434..26d918a 100644 --- a/README.md +++ b/README.md @@ -42,10 +42,10 @@ For detailed instructions, refer to the following topic: [Customize Standard Aut * [Role-based Access Control, Permission Management, and OData / Web / REST API Services for Entity Framework and XPO ORM](https://github.com/DevExpress-Examples/XAF_Security_E4908) -## Does this example address your development requirements/objectives? - -[](https://www.devexpress.com/support/examples/survey.xml?utm_source=github&utm_campaign=xaf-custom-logon-parameters&~~~was_helpful=yes) [](https://www.devexpress.com/support/examples/survey.xml?utm_source=github&utm_campaign=xaf-custom-logon-parameters&~~~was_helpful=no) - +## Does this example address your development requirements/objectives? + +[](https://www.devexpress.com/support/examples/survey.xml?utm_source=github&utm_campaign=xaf-custom-logon-parameters&~~~was_helpful=yes) [](https://www.devexpress.com/support/examples/survey.xml?utm_source=github&utm_campaign=xaf-custom-logon-parameters&~~~was_helpful=no) + (you will be redirected to DevExpress.com to submit your response) From 65048a780bb526ff026fadea67bb12b2238e9c23 Mon Sep 17 00:00:00 2001 From: Svetlana Nikulina Date: Mon, 8 Sep 2025 15:06:43 +0400 Subject: [PATCH 08/10] Apply suggestions from code review Co-authored-by: dirkpieterse --- README.md | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 26d918a..b806657 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,8 @@ # XAF - Customize Logon Parameters -This example customizes standard authentication behavior and supply additional logon parameters in a XAF application. The default login form displays **User Name** and **Password** editors. This sample replaces **User Name** with **Company** and **Application User** lookup editors. +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. + ![Login form](https://docs.devexpress.com/eXpressAppFramework/images/custom-logon-prameters-blazor.png) @@ -15,7 +16,8 @@ This example customizes standard authentication behavior and supply additional l ## Implementation Details -1. Define a [Company](./CS/EF/EFCoreCustomLogonAll.Module/BusinessObjects/Company.cs) class that contains company names. This class should contain a list of `ApplicationUser` objects as a part of a one-to-many relationship. Add the second part of this relationship to the [ApplicationUser](./CS/EF/EFCoreCustomLogonAll.Module/BusinessObjects/ApplicationUser.cs#L28) class generated by the [Template Kit](https://docs.devexpress.com/eXpressAppFramework/405447/installation-upgrade-version-history/visual-studio-integration/template-kit). Finally, add the `Company` class to your application's [DbContext](./CS/EF/EFCoreCustomLogonAll.Module/BusinessObjects/EFCoreCustomLogonAllDbContext.cs#L43). +1. Define a [Company](./CS/EF/EFCoreCustomLogonAll.Module/BusinessObjects/Company.cs) class that contains company names. This class should contain a list of `ApplicationUser` objects as a part of a one-to-many relationship. Add the second part of this relationship to the [ApplicationUser](./CS/EF/EFCoreCustomLogonAll.Module/BusinessObjects/ApplicationUser.cs#L28) class generated by the [Template Kit](https://docs.devexpress.com/eXpressAppFramework/405447/installation-upgrade-version-history/visual-studio-integration/template-kit). Then, add the `Company` class to your application's [DbContext](./CS/EF/EFCoreCustomLogonAll.Module/BusinessObjects/EFCoreCustomLogonAllDbContext.cs#L43). + 1. Create a custom logon parameter class that uses the `Company` class ([CustomLogonParameters.cs](./CS/EF/EFCoreCustomLogonAll.Module/Authentication/CustomLogonParameters.cs)). 1. To access lists of companies and application users in login form (before authentication), implement data transfer objects (DTO) ([CompanyDTO.cs](./CS/EF/EFCoreCustomLogonAll.Module/Authentication/CompanyDTO.cs) / [ApplicationUserDTO.cs](./CS/EF/EFCoreCustomLogonAll.Module/Authentication/ApplicationUserDTO.cs)). 1. Register the `CustomLogonParameters` type as a known logon parameter type ([Program.cs (Blazor)](./CS/EF/EFCoreCustomLogonAll.Blazor.Server/Program.cs#L17) / [Program.cs (WinForms)](CS/EF/EFCoreCustomLogonAll.Win/Program.cs#L14)). @@ -42,10 +44,10 @@ For detailed instructions, refer to the following topic: [Customize Standard Aut * [Role-based Access Control, Permission Management, and OData / Web / REST API Services for Entity Framework and XPO ORM](https://github.com/DevExpress-Examples/XAF_Security_E4908) -## Does this example address your development requirements/objectives? - -[](https://www.devexpress.com/support/examples/survey.xml?utm_source=github&utm_campaign=xaf-custom-logon-parameters&~~~was_helpful=yes) [](https://www.devexpress.com/support/examples/survey.xml?utm_source=github&utm_campaign=xaf-custom-logon-parameters&~~~was_helpful=no) - +## Does this example address your development requirements/objectives? + +[](https://www.devexpress.com/support/examples/survey.xml?utm_source=github&utm_campaign=xaf-custom-logon-parameters&~~~was_helpful=yes) [](https://www.devexpress.com/support/examples/survey.xml?utm_source=github&utm_campaign=xaf-custom-logon-parameters&~~~was_helpful=no) + (you will be redirected to DevExpress.com to submit your response) From 9dedfe30b4f1617993e1f8be744cb1315ca1ec2e Mon Sep 17 00:00:00 2001 From: DevExpressExampleBot Date: Mon, 8 Sep 2025 15:14:00 +0400 Subject: [PATCH 09/10] README auto update [skip ci] --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index b806657..3722eb5 100644 --- a/README.md +++ b/README.md @@ -44,10 +44,10 @@ For detailed instructions, refer to the following topic: [Customize Standard Aut * [Role-based Access Control, Permission Management, and OData / Web / REST API Services for Entity Framework and XPO ORM](https://github.com/DevExpress-Examples/XAF_Security_E4908) -## Does this example address your development requirements/objectives? - -[](https://www.devexpress.com/support/examples/survey.xml?utm_source=github&utm_campaign=xaf-custom-logon-parameters&~~~was_helpful=yes) [](https://www.devexpress.com/support/examples/survey.xml?utm_source=github&utm_campaign=xaf-custom-logon-parameters&~~~was_helpful=no) - +## Does this example address your development requirements/objectives? + +[](https://www.devexpress.com/support/examples/survey.xml?utm_source=github&utm_campaign=xaf-custom-logon-parameters&~~~was_helpful=yes) [](https://www.devexpress.com/support/examples/survey.xml?utm_source=github&utm_campaign=xaf-custom-logon-parameters&~~~was_helpful=no) + (you will be redirected to DevExpress.com to submit your response) From b49c5d90bcacba163b2d656a8764a0cdfe5af96d Mon Sep 17 00:00:00 2001 From: DevExpressExampleBot Date: Mon, 8 Sep 2025 16:18:19 +0400 Subject: [PATCH 10/10] README auto update [skip ci] --- README.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 28bc475..ee87ab9 100644 --- a/README.md +++ b/README.md @@ -43,5 +43,9 @@ For detailed instructions, refer to the following topic: [Customize Standard Aut * [Role-based Access Control, Permission Management, and OData / Web / REST API Services for Entity Framework and XPO ORM](https://github.com/DevExpress-Examples/XAF_Security_E4908) +## Does this example address your development requirements/objectives? + +[](https://www.devexpress.com/support/examples/survey.xml?utm_source=github&utm_campaign=xaf-custom-logon-parameters&~~~was_helpful=yes) [](https://www.devexpress.com/support/examples/survey.xml?utm_source=github&utm_campaign=xaf-custom-logon-parameters&~~~was_helpful=no) + (you will be redirected to DevExpress.com to submit your response) - \ No newline at end of file +