Activate a Controller for the Logon Form

When you use the Security System with the AuthenticationStandard authentication, the logon window is displayed at startup. This window contains a Detail View of a Logon Parameters object (AuthenticationStandardLogonParameters by default, or custom Logon Parameters). In contrast to the main window, Controllers are not activated automatically for the logon form for security reasons. This topic describes how to activate your custom Controller for the Logon Form.

To activate a specific Controller, override the CreateLogonWindowControllers of the XafApplication class, or handle the XafApplication.CreateCustomLogonWindowControllers event as follows.

public sealed partial class MySolutionModule : ModuleBase {
    // ...
    public override void Setup(XafApplication application) {
        base.Setup(application);
        application.CreateCustomLogonWindowControllers += application_CreateCustomLogonWindowControllers;
    }
    private void application_CreateCustomLogonWindowControllers(object sender, CreateCustomLogonWindowControllersEventArgs e) {
        e.Controllers.Add(((XafApplication)sender).CreateController<MyController>());
    }
}

Certain built-it Controllers (e.g., Controllers of the Validation and Conditional Appearance modules) are active on logon by default. This enables you to apply appearance and validation rules to the logon parameters object.