|
26 | 26 | import java.util.Optional; |
27 | 27 | import java.util.stream.Collectors; |
28 | 28 |
|
29 | | -import static com.park.utmstack.config.Constants.DATE_FORMAT_SETTING_ID; |
| 29 | +import static com.park.utmstack.config.Constants.*; |
30 | 30 |
|
31 | 31 | /** |
32 | 32 | * Service Implementation for managing UtmConfigurationParameter. |
@@ -85,22 +85,21 @@ public void saveAll(List<UtmConfigurationParameter> params) throws UtmMailExcept |
85 | 85 | final String ctx = CLASSNAME + ".saveAll"; |
86 | 86 | try { |
87 | 87 |
|
88 | | - UtmConfigurationParameter tfaEnabledParam = params.stream() |
| 88 | + Boolean tfaEnabledParam = params.stream() |
89 | 89 | .filter(p -> p.getConfParamShort().equals(Constants.PROP_TFA_ENABLE)) |
90 | 90 | .findFirst() |
91 | | - .orElse(null); |
| 91 | + .map(p -> Boolean.parseBoolean(p.getConfParamValue())) |
| 92 | + .orElse(Boolean.valueOf(CFG.get(PROP_TFA_ENABLE))); |
92 | 93 |
|
93 | | - UtmConfigurationParameter tfaMethodParam = params.stream() |
| 94 | + TfaMethod tfaMethodParam = params.stream() |
94 | 95 | .filter(p -> p.getConfParamShort().equals(Constants.PROP_TFA_METHOD)) |
95 | 96 | .findFirst() |
| 97 | + .map(p -> TfaMethod.valueOf(p.getConfParamValue())) |
96 | 98 | .orElse(null); |
97 | 99 |
|
98 | | - if (tfaEnabledParam != null && tfaMethodParam != null && tfaMethodParam.getConfParamValue() != null && Boolean.parseBoolean(tfaEnabledParam.getConfParamValue())) { |
99 | | - String tfaMethod = tfaMethodParam.getConfParamValue(); |
100 | | - |
101 | | - tfaService.persistConfiguration(TfaMethod.valueOf(tfaMethod)); |
102 | | - |
103 | | - log.info("TFA enabled with method: {}", tfaMethod); |
| 100 | + if (tfaEnabledParam && tfaMethodParam != null) { |
| 101 | + tfaService.persistConfiguration(tfaMethodParam); |
| 102 | + log.info("TFA enabled with method: {}", tfaMethodParam); |
104 | 103 | } |
105 | 104 |
|
106 | 105 |
|
|
0 commit comments