diff --git a/components/org.wso2.carbon.identity.password.expiry/src/main/java/org/wso2/carbon/identity/password/expiry/util/PasswordPolicyUtils.java b/components/org.wso2.carbon.identity.password.expiry/src/main/java/org/wso2/carbon/identity/password/expiry/util/PasswordPolicyUtils.java index 169441693..6d1a99866 100644 --- a/components/org.wso2.carbon.identity.password.expiry/src/main/java/org/wso2/carbon/identity/password/expiry/util/PasswordPolicyUtils.java +++ b/components/org.wso2.carbon.identity.password.expiry/src/main/java/org/wso2/carbon/identity/password/expiry/util/PasswordPolicyUtils.java @@ -407,10 +407,12 @@ public static Optional getUserPasswordExpiryTime(String tenantDomain, private static List filterApplicableExpiryRules(List passwordExpiryRules, boolean skipIfNoApplicableRules) { + if (!skipIfNoApplicableRules) { + return passwordExpiryRules; + } // If the default behavior is to skip the password expiry, rules with skip logic are not required. return passwordExpiryRules.stream().filter( - rule -> !skipIfNoApplicableRules || !PasswordExpiryRuleOperatorEnum.NE.equals(rule.getOperator())) - .collect(Collectors.toList()); + rule -> !PasswordExpiryRuleOperatorEnum.NE.equals(rule.getOperator())).collect(Collectors.toList()); } /**