From 28c478815c717434e4e84d34a0073252c5a51c94 Mon Sep 17 00:00:00 2001 From: Pasindu Yeshan Date: Fri, 13 Dec 2024 14:59:57 +0530 Subject: [PATCH] Refactor the code. --- .../identity/password/expiry/util/PasswordPolicyUtils.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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()); } /**