예제 #1
0
        /// <summary>
        /// SetTemplate method implmentation
        /// </summary>
        public void SetTemplate(PSHost host, FlatTemplateMode mode)
        {
            ManagementService.Initialize(true);
            MFAConfig cfg = ManagementService.Config;

            switch (mode)
            {
            case FlatTemplateMode.Free:
                cfg.UserFeatures = (UserFeaturesOptions.BypassDisabled | UserFeaturesOptions.BypassUnRegistered | UserFeaturesOptions.AllowManageOptions | UserFeaturesOptions.AllowChangePassword);
                break;

            case FlatTemplateMode.Open:
                cfg.UserFeatures = (UserFeaturesOptions.BypassDisabled | UserFeaturesOptions.AllowUnRegistered | UserFeaturesOptions.AllowManageOptions | UserFeaturesOptions.AllowChangePassword);
                break;

            case FlatTemplateMode.Default:
                cfg.UserFeatures = (UserFeaturesOptions.AllowDisabled | UserFeaturesOptions.AllowUnRegistered | UserFeaturesOptions.AllowManageOptions | UserFeaturesOptions.AllowChangePassword);
                break;

            case FlatTemplateMode.Managed:
                cfg.UserFeatures = (UserFeaturesOptions.BypassDisabled | UserFeaturesOptions.AllowUnRegistered | UserFeaturesOptions.AllowProvideInformations | UserFeaturesOptions.AllowChangePassword);
                break;

            case FlatTemplateMode.Strict:
                cfg.UserFeatures = (UserFeaturesOptions.AllowProvideInformations);
                break;

            case FlatTemplateMode.Administrative:
                cfg.UserFeatures = (UserFeaturesOptions.AdministrativeMode);
                break;
            }
            ManagementService.ADFSManager.WriteConfiguration(host);
        }
예제 #2
0
        /// <summary>
        /// SetPolicyTemplate method implmentation
        /// </summary>
        public void SetPolicyTemplate(PSHost host, FlatTemplateMode mode)
        {
            ManagementService.Initialize(true);
            MFAConfig        cfg = ManagementService.Config;
            UserTemplateMode md  = (UserTemplateMode)mode;

            cfg.UserFeatures = cfg.UserFeatures.SetPolicyTemplate(md);
            ManagementService.ADFSManager.WriteConfiguration(host);
        }
        /// <summary>
        /// SetPolicyTemplate method implmentation
        /// </summary>
        public void SetPolicyTemplate(PSHost host, FlatTemplateMode mode)
        {
            ManagementService.Initialize(true);
            MFAConfig        cfg = ManagementService.Config;
            UserTemplateMode md  = (UserTemplateMode)mode;

            cfg.UserFeatures = cfg.UserFeatures.SetPolicyTemplate(md);
            if (md != UserTemplateMode.Administrative)
            {
                cfg.KeepMySelectedOptionOn = true;
            }
            else
            {
                cfg.KeepMySelectedOptionOn = false;
            }
            ManagementService.ADFSManager.WriteConfiguration(host);
        }