0

我已经详细研究了所有已添加到最新 WSO2 身份服务器 (5.7.0) 的密码策略选项。虽然比一年前的版本有了很大的改进,但我的客户仍然对一个问题不满意。使用密码策略验证器,看起来我们可以强制用户每隔几天更改一次密码,并且使用现在的默认策略选项可以根据我们的喜好强制执行任意数量的密码历史记录要求。然而,历史选项可以通过一个确定的用户简单地更改他的密码,在一个设置中快速老化他的密码所需的次数来克服 - 除非有一个要求的“最小密码年龄”会阻止他们这样做。History、Patterns 和 Password Authenticator 中的所有可用选项均未解决此问题。https://docs.microsoft.com/en-us/windows/security/threat-protection/security-policy-settings/minimum-password-age

有没有办法我现在也可以在 WSO2 IS 中设置最低年龄?如果不是,这不应该作为密码策略包含在历史选项中吗?

4

1 回答 1

2

WSO2 IS 产品目前不提供此功能,但我们可以使用核心用户管理系统中可用的扩展轻松满足此要求。可用的密码历史功能具有更改密码日期时间的历史记录,我们可以使用这些数据来强制执行此要求。

  • 创建一个新的身份连接器以配置最短密码期限和抽象事件处理程序以在密码更改事件期间强制验证。

    公共类 PasswordMinAgeValidationHandler 扩展 AbstractEventHandler 实现 IdentityConnectorConfig {

    private static final Log log = LogFactory.getLog(PasswordMinAgeValidationHandler.class);
    
    @Override
    public void handleEvent(Event event) throws IdentityEventException {
    
        // Validate the password age with min age configured
    }
    
    @Override
    public String getName() {
        return "passwordMinAge";
    }
    
    @Override
    public String getFriendlyName() {
        return "Password Minimum Age";
    }
    
    @Override
    public String getCategory() {
        return "Password Policies";
    }
    
    @Override
    public Map<String, String> getPropertyNameMapping() {
        Map<String, String> nameMapping = new HashMap<>();
        nameMapping.put(PasswordMinAgeConstants.PM_MIN_AGE_ENABLE, "Enable Password Minimum Age Feature");
        nameMapping.put(PasswordMinAgeConstants.PW_MIN_AGE_COUNT, "Password Minimum Age (Days)");
        return nameMapping;
    }
    
    @Override
    public void init(InitConfig configuration) throws IdentityRuntimeException {
        super.init(configuration);
        IdentityPasswordMinAgeServiceDataHolder.getInstance().getBundleContext().registerService
                (IdentityConnectorConfig.class.getName(), this, null);
    }
    
    public Properties getDefaultPropertyValues(String tenantDomain) throws IdentityGovernanceException {
    
        Map<String, String> defaultProperties = new HashMap<>();
        defaultProperties.put(PasswordMinAgeConstants.PM_MIN_AGE_ENABLE, configs.getModuleProperties()
                .getProperty(PasswordMinAgeConstants.PM_MIN_AGE_ENABLE));
        defaultProperties.put(PasswordMinAgeConstants.PW_MIN_AGE_COUNT, configs.getModuleProperties()
                .getProperty(PasswordMinAgeConstants.PM_MIN_AGE_ENABLE));
        Properties properties = new Properties();
        properties.putAll(defaultProperties);
        return properties;
    }
    

    }

  • 使此类成为OSGi 包并将 PasswordMinAgeValidationHandler 注册为 AbstractEventHandler

    protected void activate(ComponentContext context) {
       try {
        BundleContext bundleContext = context.getBundleContext();
        IdentityPasswordMinAgeServiceDataHolder.getInstance().setBundleContext(bundleContext);
    
        PasswordMinAgeValidationHandler handler = new PasswordMinAgeValidationHandler();
        context.getBundleContext().registerService(AbstractEventHandler.class.getName(), handler, null);
    
    
    } catch (Exception e) {
        log.error("Error while activating identity governance password min age component.", e);
    }
    

    }

  • 在 IS_HOME/repository/components/dropins 中部署 jar
  • 在 IS_HOME/repository/conf/identity/identity-event.properties 中添加如下配置

    module.name.13=passwordMinAge passwordMinAge.subscription.1=PRE_UPDATE_CREDENTIAL passwordMinAge.subscription.2=PRE_UPDATE_CREDENTIAL_BY_ADMIN passwordMinAge.enable=false passwordMinAge.count=5

  • 重启 IS 服务器

  • 在 Resident Identity Provider 配置 -> 密码策略中,同时启用Password HistoryPassword Minimum Age功能。

在此处输入图像描述

在这里你可以找到完整的源代码

于 2018-12-08T18:02:52.360 回答