2022-06-08 21:13:22 -04:00
|
|
|
package auth;
|
|
|
|
|
2023-12-06 11:02:42 +05:30
|
|
|
/** Currently, this config enables or disable native user authentication. */
|
2022-06-08 21:13:22 -04:00
|
|
|
public class NativeAuthenticationConfigs {
|
|
|
|
|
|
|
|
public static final String NATIVE_AUTHENTICATION_ENABLED_CONFIG_PATH = "auth.native.enabled";
|
2023-12-06 11:02:42 +05:30
|
|
|
public static final String NATIVE_AUTHENTICATION_ENFORCE_VALID_EMAIL_ENABLED_CONFIG_PATH =
|
|
|
|
"auth.native.signUp.enforceValidEmail";
|
2022-06-08 21:13:22 -04:00
|
|
|
|
2024-10-28 09:05:16 -05:00
|
|
|
private Boolean isEnabled = true;
|
|
|
|
private Boolean isEnforceValidEmailEnabled = true;
|
2022-06-08 21:13:22 -04:00
|
|
|
|
|
|
|
public NativeAuthenticationConfigs(final com.typesafe.config.Config configs) {
|
2023-11-14 14:06:33 -06:00
|
|
|
if (configs.hasPath(NATIVE_AUTHENTICATION_ENABLED_CONFIG_PATH)) {
|
2024-10-28 09:05:16 -05:00
|
|
|
isEnabled =
|
2023-12-06 11:02:42 +05:30
|
|
|
Boolean.parseBoolean(
|
|
|
|
configs.getValue(NATIVE_AUTHENTICATION_ENABLED_CONFIG_PATH).toString());
|
2023-11-14 14:06:33 -06:00
|
|
|
}
|
|
|
|
if (configs.hasPath(NATIVE_AUTHENTICATION_ENFORCE_VALID_EMAIL_ENABLED_CONFIG_PATH)) {
|
2024-10-28 09:05:16 -05:00
|
|
|
isEnforceValidEmailEnabled =
|
2023-12-06 11:02:42 +05:30
|
|
|
Boolean.parseBoolean(
|
|
|
|
configs
|
|
|
|
.getValue(NATIVE_AUTHENTICATION_ENFORCE_VALID_EMAIL_ENABLED_CONFIG_PATH)
|
|
|
|
.toString());
|
2022-06-08 21:13:22 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public boolean isNativeAuthenticationEnabled() {
|
2024-10-28 09:05:16 -05:00
|
|
|
return isEnabled;
|
2022-06-08 21:13:22 -04:00
|
|
|
}
|
2023-11-14 14:06:33 -06:00
|
|
|
|
|
|
|
public boolean isEnforceValidEmailEnabled() {
|
2024-10-28 09:05:16 -05:00
|
|
|
return isEnforceValidEmailEnabled;
|
2023-11-14 14:06:33 -06:00
|
|
|
}
|
2022-06-08 21:13:22 -04:00
|
|
|
}
|