/// <summary>
        /// BuildNodes method
        /// </summary>
        private void BuildNodes(bool doall = true)
        {
            if (doall)
            {
                this.RootNode = new RootScopeNode();
                FormViewDescription fvr = new FormViewDescription();
                fvr.DisplayName = "MFA Platform";
                fvr.ControlType = typeof(RootViewControl);
                fvr.ViewType    = typeof(RootFormView);
                this.RootNode.ViewDescriptions.Add(fvr);
                this.RootNode.ViewDescriptions.DefaultIndex = 0;

                if (IsPrimary)
                {
                    // Service Node
                    this.ServiceNode = new ServiceScopeNode();
                    FormViewDescription fvc = new FormViewDescription();
                    fvc.DisplayName = "MFA Platform Service";
                    fvc.ControlType = typeof(ServiceViewControl);
                    fvc.ViewType    = typeof(ServiceFormView);
                    this.ServiceNode.ViewDescriptions.Add(fvc);
                    this.ServiceNode.ViewDescriptions.DefaultIndex = 0;

                    // General Scope
                    this.ServiceGeneralNode = new ServiceGeneralScopeNode();
                    FormViewDescription fvs = new FormViewDescription();
                    fvs.DisplayName = "MFA Platform General Properties";
                    fvs.ControlType = typeof(GeneralViewControl);
                    fvs.ViewType    = typeof(GeneralFormView);
                    this.ServiceGeneralNode.ViewDescriptions.Add(fvs);
                    this.ServiceGeneralNode.ViewDescriptions.DefaultIndex = 0;

                    // ADDS Scope
                    this.ServiceADDSNode = new ServiceADDSScopeNode();
                    FormViewDescription fadds = new FormViewDescription();
                    fadds.DisplayName = "MFA Platform Active Directory Properties";
                    fadds.ControlType = typeof(ADDSViewControl);
                    fadds.ViewType    = typeof(ServiceADDSFormView);
                    this.ServiceADDSNode.ViewDescriptions.Add(fadds);
                    this.ServiceADDSNode.ViewDescriptions.DefaultIndex = 0;

                    // SQL Scope
                    this.ServiceSQLNode = new ServiceSQLScopeNode();
                    FormViewDescription fsql = new FormViewDescription();
                    fsql.DisplayName = "MFA Platform SQL Server Properties";
                    fsql.ControlType = typeof(SQLViewControl);
                    fsql.ViewType    = typeof(ServiceSQLFormView);
                    this.ServiceSQLNode.ViewDescriptions.Add(fsql);
                    this.ServiceSQLNode.ViewDescriptions.DefaultIndex = 0;

                    // Security Scope
                    this.ServiceSecurityNode = new ServiceSecurityRootScopeNode();
                    FormViewDescription fsec = new FormViewDescription();
                    fsec.DisplayName = "Security Features";
                    fsec.ControlType = typeof(ServiceSecurityRootViewControl);
                    fsec.ViewType    = typeof(ServiceSecurityRootFormView);
                    this.ServiceSecurityNode.ViewDescriptions.Add(fsec);
                    this.ServiceSecurityNode.ViewDescriptions.DefaultIndex = 0;

                    // RNG
                    this.ServiceRNGNode = new ServiceSecurityRNGScopeNode();
                    FormViewDescription frng = new FormViewDescription();
                    frng.DisplayName = "RGN Ramdom Number Generator";
                    frng.ControlType = typeof(ServiceSecurityRNGViewControl);
                    frng.ViewType    = typeof(ServiceSecurityRNGFormView);
                    this.ServiceRNGNode.ViewDescriptions.Add(frng);
                    this.ServiceRNGNode.ViewDescriptions.DefaultIndex = 0;

                    // RSA
                    this.ServiceRSANode = new ServiceSecurityRSAScopeNode();
                    FormViewDescription frsa = new FormViewDescription();
                    frsa.DisplayName = "RSA Key Generator";
                    frsa.ControlType = typeof(ServiceSecurityRSAViewControl);
                    frsa.ViewType    = typeof(ServiceSecurityRSAFormView);
                    this.ServiceRSANode.ViewDescriptions.Add(frsa);
                    this.ServiceRSANode.ViewDescriptions.DefaultIndex = 0;

                    // RSA CUST
                    this.ServiceRSAXNode = new ServiceSecurityRSAXScopeNode();
                    FormViewDescription frsax = new FormViewDescription();
                    frsax.DisplayName = "RSA Extended Key Generator";
                    frsax.ControlType = typeof(ServiceSecurityRSAXViewControl);
                    frsax.ViewType    = typeof(ServiceSecurityRSAXFormView);
                    this.ServiceRSAXNode.ViewDescriptions.Add(frsax);
                    this.ServiceRSAXNode.ViewDescriptions.DefaultIndex = 0;

                    // Providers Scope
                    this.ServiceProvidersNode = new ServiceProvidersScopeNode();
                    FormViewDescription fprov = new FormViewDescription();
                    fprov.DisplayName = "MFA Providers";
                    fprov.ControlType = typeof(ProvidersViewControl);
                    fprov.ViewType    = typeof(ServiceProvidersFormView);
                    this.ServiceProvidersNode.ViewDescriptions.Add(fprov);
                    this.ServiceProvidersNode.ViewDescriptions.DefaultIndex = 0;

                    ManagementService.EnsureService();
                    RuntimeAuthProvider.LoadProviders(ManagementService.Config);

                    IExternalProvider prv0 = RuntimeAuthProvider.GetProviderInstance(PreferredMethod.Code);
                    if (prv0 != null)
                    {
                        // TOTP Scope
                        this.ServiceTOTPNode = new ServiceSecurityScopeNode();
                        FormViewDescription ftotp = new FormViewDescription();
                        ftotp.DisplayName = "MFA Platform TOTP Properties";
                        ftotp.ControlType = typeof(ServiceSecurityViewControl);
                        ftotp.ViewType    = typeof(ServiceSecurityFormView);
                        this.ServiceTOTPNode.ViewDescriptions.Add(ftotp);
                        this.ServiceTOTPNode.ViewDescriptions.DefaultIndex = 0;
                    }

                    IExternalProvider prv1 = RuntimeAuthProvider.GetProviderInstance(PreferredMethod.Email);
                    if (prv1 != null)
                    {
                        // SMTP Scope
                        this.ServiceSMTPNode = new ServiceSMTPScopeNode();
                        FormViewDescription fsmtp = new FormViewDescription();
                        fsmtp.DisplayName = "MFA Platform SMTP Properties";
                        fsmtp.ControlType = typeof(SMTPViewControl);
                        fsmtp.ViewType    = typeof(ServiceSMTPFormView);
                        this.ServiceSMTPNode.ViewDescriptions.Add(fsmtp);
                        this.ServiceSMTPNode.ViewDescriptions.DefaultIndex = 0;
                    }

                    IExternalProvider prv2 = RuntimeAuthProvider.GetProviderInstance(PreferredMethod.External);
                    if (prv2 != null)
                    {
                        // SMS Scope
                        this.ServiceSMSNode = new ServicePhoneScopeNode();
                        FormViewDescription fsms = new FormViewDescription();
                        fsms.DisplayName = "MFA Platform SMS Properties";
                        fsms.ControlType = typeof(SMSViewControl);
                        fsms.ViewType    = typeof(ServiceSMSFormView);
                        this.ServiceSMSNode.ViewDescriptions.Add(fsms);
                        this.ServiceSMSNode.ViewDescriptions.DefaultIndex = 0;
                    }

                    IExternalProvider prv3 = RuntimeAuthProvider.GetProviderInstance(PreferredMethod.Azure);
                    if (prv3 != null)
                    {
                        // Azure Scope
                        this.ServiceAzureNode = new ServiceAzureScopeNode();
                        FormViewDescription faz = new FormViewDescription();
                        faz.DisplayName = "MFA Platform SMS Properties";
                        faz.ControlType = typeof(AzureViewControl);
                        faz.ViewType    = typeof(ServiceAzureFormView);
                        this.ServiceAzureNode.ViewDescriptions.Add(faz);
                        this.ServiceAzureNode.ViewDescriptions.DefaultIndex = 0;
                    }
                }

                // Users Scope
                this.UsersNode = new UsersScopeNode();
                FormViewDescription fvu = new FormViewDescription();
                fvu.DisplayName = "MFA Platform Users";
                fvu.ControlType = typeof(UsersListView);
                fvu.ViewType    = typeof(UsersFormView);
                this.UsersNode.ViewDescriptions.Add(fvu);
                this.UsersNode.ViewDescriptions.DefaultIndex = 0;

                if (IsPrimary)
                {
                    this.RootNode.Children.Add(this.ServiceNode);
                    this.RootNode.Children.Add(this.ServiceGeneralNode);
                    this.RootNode.Children.Add(this.ServiceADDSNode);
                    this.RootNode.Children.Add(this.ServiceSQLNode);

                    this.RootNode.Children.Add(this.ServiceSecurityNode);
                    this.ServiceSecurityNode.Children.Add(this.ServiceRNGNode);
                    this.ServiceSecurityNode.Children.Add(this.ServiceRSANode);
                    this.ServiceSecurityNode.Children.Add(this.ServiceRSAXNode);

                    this.RootNode.Children.Add(this.ServiceProvidersNode);
                    if (this.ServiceTOTPNode != null)
                    {
                        this.ServiceProvidersNode.Children.Add(this.ServiceTOTPNode);
                    }
                    if (this.ServiceSMTPNode != null)
                    {
                        this.ServiceProvidersNode.Children.Add(this.ServiceSMTPNode);
                    }
                    if (this.ServiceSMSNode != null)
                    {
                        this.ServiceProvidersNode.Children.Add(this.ServiceSMSNode);
                    }
                    if (this.ServiceAzureNode != null)
                    {
                        this.ServiceProvidersNode.Children.Add(this.ServiceAzureNode);
                    }
                }
                this.RootNode.Children.Add(this.UsersNode);

                this.IsModified = true;
                this.SmallImages.Add(Neos.IdentityServer.Console.Resources.Neos_IdentityServer_Console_Snapin.folder16, Color.Black);
                this.LargeImages.Add(Neos.IdentityServer.Console.Resources.Neos_IdentityServer_Console_Snapin.folder32, Color.Black);
            }
            else
            {
                RefreshUI();
            }
        }
Exemple #2
0
        /// <summary>
        /// BuildNodes method
        /// </summary>
        private void BuildNodes(bool doall = true)
        {
            if (doall)
            {
                this.RootNode = new RootScopeNode();
                FormViewDescription fvr = new FormViewDescription();
                fvr.DisplayName = "MFA Platform";
                fvr.ControlType = typeof(RootViewControl);
                fvr.ViewType    = typeof(RootFormView);
                this.RootNode.ViewDescriptions.Add(fvr);
                this.RootNode.ViewDescriptions.DefaultIndex = 0;

                if (IsPrimary)
                {
                    // Service Node
                    this.ServiceNode = new ServiceScopeNode();
                    FormViewDescription fvc = new FormViewDescription();
                    fvc.DisplayName = "MFA Platform Service";
                    fvc.ControlType = typeof(ServiceViewControl);
                    fvc.ViewType    = typeof(ServiceFormView);
                    this.ServiceNode.ViewDescriptions.Add(fvc);
                    this.ServiceNode.ViewDescriptions.DefaultIndex = 0;

                    // General Scope
                    this.ServiceGeneralNode = new ServiceGeneralScopeNode();
                    FormViewDescription fvs = new FormViewDescription();
                    fvs.DisplayName = "MFA Platform General Properties";
                    fvs.ControlType = typeof(GeneralViewControl);
                    fvs.ViewType    = typeof(GeneralFormView);
                    this.ServiceGeneralNode.ViewDescriptions.Add(fvs);
                    this.ServiceGeneralNode.ViewDescriptions.DefaultIndex = 0;

                    // Storage
                    this.ServiceStorageNode = new ServiceStorageScopeNode();
                    FormViewDescription fstore = new FormViewDescription();
                    fstore.DisplayName = "MFA Platform Storage Properties";
                    fstore.ControlType = typeof(StorageViewControl);
                    fstore.ViewType    = typeof(ServiceStoreFormView);
                    this.ServiceStorageNode.ViewDescriptions.Add(fstore);
                    this.ServiceStorageNode.ViewDescriptions.DefaultIndex = 0;

                    // ADDS Scope
                    this.ServiceADDSNode = new ServiceADDSScopeNode();
                    FormViewDescription fadds = new FormViewDescription();
                    fadds.DisplayName = "MFA Platform Active Directory Properties";
                    fadds.ControlType = typeof(ADDSViewControl);
                    fadds.ViewType    = typeof(ServiceADDSFormView);
                    this.ServiceADDSNode.ViewDescriptions.Add(fadds);
                    this.ServiceADDSNode.ViewDescriptions.DefaultIndex = 0;

                    // SQL Scope
                    this.ServiceSQLNode = new ServiceSQLScopeNode();
                    FormViewDescription fsql = new FormViewDescription();
                    fsql.DisplayName = "MFA Platform SQL Server Properties";
                    fsql.ControlType = typeof(SQLViewControl);
                    fsql.ViewType    = typeof(ServiceSQLFormView);
                    this.ServiceSQLNode.ViewDescriptions.Add(fsql);
                    this.ServiceSQLNode.ViewDescriptions.DefaultIndex = 0;

                    // Custom Storage Scope
                    this.ServiceCustomStorageNode = new ServiceCustomStorageScopeNode();
                    FormViewDescription cust = new FormViewDescription();
                    cust.DisplayName = "MFA Custom Storage Properties";
                    cust.ControlType = typeof(CustomStoreViewControl);
                    cust.ViewType    = typeof(ServiceCustomStoreFormView);
                    this.ServiceCustomStorageNode.ViewDescriptions.Add(cust);
                    this.ServiceCustomStorageNode.ViewDescriptions.DefaultIndex = 0;

                    // Security Scope
                    this.ServiceSecurityNode = new ServiceSecurityRootScopeNode();
                    FormViewDescription fsec = new FormViewDescription();
                    fsec.DisplayName = "Security Features";
                    fsec.ControlType = typeof(ServiceSecurityRootViewControl);
                    fsec.ViewType    = typeof(ServiceSecurityRootFormView);
                    this.ServiceSecurityNode.ViewDescriptions.Add(fsec);
                    this.ServiceSecurityNode.ViewDescriptions.DefaultIndex = 0;

                    // RNG
                    this.ServiceRNGNode = new ServiceSecurityRNGScopeNode();
                    FormViewDescription frng = new FormViewDescription();
                    frng.DisplayName = "Encoded Keys RGN ";
                    frng.ControlType = typeof(ServiceSecurityRNGViewControl);
                    frng.ViewType    = typeof(ServiceSecurityRNGFormView);
                    this.ServiceRNGNode.ViewDescriptions.Add(frng);
                    this.ServiceRNGNode.ViewDescriptions.DefaultIndex = 0;

                    // AES
                    this.ServiceAESNode = new ServiceSecurityAESScopeNode();
                    FormViewDescription faes = new FormViewDescription();
                    faes.DisplayName = "Symmetric Keys AES";
                    faes.ControlType = typeof(ServiceSecurityAESViewControl);
                    faes.ViewType    = typeof(ServiceSecurityAESFormView);
                    this.ServiceAESNode.ViewDescriptions.Add(faes);
                    this.ServiceAESNode.ViewDescriptions.DefaultIndex = 0;

                    // RSA
                    this.ServiceRSANode = new ServiceSecurityRSAScopeNode();
                    FormViewDescription frsa = new FormViewDescription();
                    frsa.DisplayName = "Asymmetric Keys RSA ";
                    frsa.ControlType = typeof(ServiceSecurityRSAViewControl);
                    frsa.ViewType    = typeof(ServiceSecurityRSAFormView);
                    this.ServiceRSANode.ViewDescriptions.Add(frsa);
                    this.ServiceRSANode.ViewDescriptions.DefaultIndex = 0;

                    // Custom
                    this.ServiceCustomSecurityNode = new ServiceCustomSecurityScopeNode();
                    FormViewDescription fcust = new FormViewDescription();
                    fcust.DisplayName = "Custom Keys";
                    fcust.ControlType = typeof(SecurityCustomViewControl);
                    fcust.ViewType    = typeof(ServiceSecurityCustomFormView);
                    this.ServiceCustomSecurityNode.ViewDescriptions.Add(fcust);
                    this.ServiceCustomSecurityNode.ViewDescriptions.DefaultIndex = 0;

                    // WebAuthN
                    this.ServiceWebAuthNNode = new ServiceSecurityWebAuthNScopeNode();
                    FormViewDescription frweb = new FormViewDescription();
                    frweb.DisplayName = "WebAuthN Credentials";
                    frweb.ControlType = typeof(ServiceSecurityWebAuthNViewControl);
                    frweb.ViewType    = typeof(ServiceSecurityWebAuthNFormView);
                    this.ServiceWebAuthNNode.ViewDescriptions.Add(frweb);
                    this.ServiceWebAuthNNode.ViewDescriptions.DefaultIndex = 0;

                    // Providers Scope
                    this.ServiceProvidersNode = new ServiceProvidersScopeNode();
                    FormViewDescription fprov = new FormViewDescription();
                    fprov.DisplayName = "MFA Providers";
                    fprov.ControlType = typeof(ProvidersViewControl);
                    fprov.ViewType    = typeof(ServiceProvidersFormView);
                    this.ServiceProvidersNode.ViewDescriptions.Add(fprov);
                    this.ServiceProvidersNode.ViewDescriptions.DefaultIndex = 0;

                    ManagementService.EnsureService();
                    RuntimeAuthProvider.LoadProviders(ManagementService.Config);

                    IExternalProvider prv0 = RuntimeAuthProvider.GetProviderInstance(PreferredMethod.Code);
                    if (prv0 != null)
                    {
                        // TOTP Scope
                        this.ServiceTOTPNode = new ServiceTOTPScopeNode();
                        FormViewDescription ftotp = new FormViewDescription();
                        ftotp.DisplayName = "MFA Platform TOTP Properties";
                        ftotp.ControlType = typeof(ServiceTOTPViewControl);
                        ftotp.ViewType    = typeof(ServiceTOTPFormView);
                        this.ServiceTOTPNode.ViewDescriptions.Add(ftotp);
                        this.ServiceTOTPNode.ViewDescriptions.DefaultIndex = 0;
                    }

                    IExternalProvider prv4 = RuntimeAuthProvider.GetProviderInstance(PreferredMethod.Biometrics);
                    if (prv4 != null)
                    {
                        // Biometrics Scope
                        this.ServiceBiometricsNode = new ServiceBiometricsScopeNode();
                        FormViewDescription fbio = new FormViewDescription();
                        fbio.DisplayName = "MFA Platform Biometrics Properties";
                        fbio.ControlType = typeof(ServiceBiometricsViewControl);
                        fbio.ViewType    = typeof(ServiceBiometricsFormView);
                        this.ServiceBiometricsNode.ViewDescriptions.Add(fbio);
                        this.ServiceBiometricsNode.ViewDescriptions.DefaultIndex = 0;
                    }

                    IExternalProvider prv1 = RuntimeAuthProvider.GetProviderInstance(PreferredMethod.Email);
                    if (prv1 != null)
                    {
                        // SMTP Scope
                        this.ServiceSMTPNode = new ServiceSMTPScopeNode();
                        FormViewDescription fsmtp = new FormViewDescription();
                        fsmtp.DisplayName = "MFA Platform SMTP Properties";
                        fsmtp.ControlType = typeof(SMTPViewControl);
                        fsmtp.ViewType    = typeof(ServiceSMTPFormView);
                        this.ServiceSMTPNode.ViewDescriptions.Add(fsmtp);
                        this.ServiceSMTPNode.ViewDescriptions.DefaultIndex = 0;
                    }

                    IExternalProvider prv2 = RuntimeAuthProvider.GetProviderInstance(PreferredMethod.External);
                    if (prv2 != null)
                    {
                        // SMS Scope
                        this.ServiceSMSNode = new ServicePhoneScopeNode();
                        FormViewDescription fsms = new FormViewDescription();
                        fsms.DisplayName = "MFA Platform SMS Properties";
                        fsms.ControlType = typeof(SMSViewControl);
                        fsms.ViewType    = typeof(ServiceSMSFormView);
                        this.ServiceSMSNode.ViewDescriptions.Add(fsms);
                        this.ServiceSMSNode.ViewDescriptions.DefaultIndex = 0;
                    }

                    IExternalProvider prv3 = RuntimeAuthProvider.GetProviderInstance(PreferredMethod.Azure);
                    if (prv3 != null)
                    {
                        // Azure Scope
                        this.ServiceAzureNode = new ServiceAzureScopeNode();
                        FormViewDescription faz = new FormViewDescription();
                        faz.DisplayName = "MFA Platform SMS Properties";
                        faz.ControlType = typeof(AzureViewControl);
                        faz.ViewType    = typeof(ServiceAzureFormView);
                        this.ServiceAzureNode.ViewDescriptions.Add(faz);
                        this.ServiceAzureNode.ViewDescriptions.DefaultIndex = 0;
                    }
                }

                // Users Scope
                this.UsersNode = new UsersScopeNode();
                FormViewDescription fvu = new FormViewDescription();
                fvu.DisplayName = "MFA Platform Users";
                fvu.ControlType = typeof(UsersListView);
                fvu.ViewType    = typeof(UsersFormView);
                this.UsersNode.ViewDescriptions.Add(fvu);
                this.UsersNode.ViewDescriptions.DefaultIndex = 0;


                if (IsPrimary)
                {
                    this.RootNode.Children.Add(this.ServiceNode);
                    this.RootNode.Children.Add(this.ServiceGeneralNode);

                    this.RootNode.Children.Add(this.ServiceSecurityNode);
                    this.ServiceSecurityNode.Children.Add(this.ServiceRNGNode);
                    this.ServiceSecurityNode.Children.Add(this.ServiceAESNode);
                    this.ServiceSecurityNode.Children.Add(this.ServiceRSANode);
                    this.ServiceSecurityNode.Children.Add(this.ServiceWebAuthNNode);
                    this.ServiceSecurityNode.Children.Add(this.ServiceCustomSecurityNode);

                    this.RootNode.Children.Add(this.ServiceStorageNode);
                    this.ServiceStorageNode.Children.Add(this.ServiceADDSNode);
                    this.ServiceStorageNode.Children.Add(this.ServiceSQLNode);
                    this.ServiceStorageNode.Children.Add(this.ServiceCustomStorageNode);

                    this.RootNode.Children.Add(this.ServiceProvidersNode);
                    if (this.ServiceTOTPNode != null)
                    {
                        this.ServiceProvidersNode.Children.Add(this.ServiceTOTPNode);
                    }
                    if (this.ServiceBiometricsNode != null)
                    {
                        this.ServiceProvidersNode.Children.Add(this.ServiceBiometricsNode);
                    }
                    if (this.ServiceSMTPNode != null)
                    {
                        this.ServiceProvidersNode.Children.Add(this.ServiceSMTPNode);
                    }
                    if (this.ServiceSMSNode != null)
                    {
                        this.ServiceProvidersNode.Children.Add(this.ServiceSMSNode);
                    }
                    if (this.ServiceAzureNode != null)
                    {
                        this.ServiceProvidersNode.Children.Add(this.ServiceAzureNode);
                    }
                }
                this.RootNode.Children.Add(this.UsersNode);

                this.IsModified = true;
                this.SmallImages.Add(Neos.IdentityServer.Console.Resources.Neos_IdentityServer_Console_Snapin.folder16, Color.Black);
                this.LargeImages.Add(Neos.IdentityServer.Console.Resources.Neos_IdentityServer_Console_Snapin.folder32, Color.Black);
            }
            else
            {
                RefreshUI();
            }
        }