diff --git a/framework/common/src/main/java/org/apache/ofbiz/common/authentication/AuthHelper.java b/framework/common/src/main/java/org/apache/ofbiz/common/authentication/AuthHelper.java index 2e93b1a799..d1cb54043f 100644 --- a/framework/common/src/main/java/org/apache/ofbiz/common/authentication/AuthHelper.java +++ b/framework/common/src/main/java/org/apache/ofbiz/common/authentication/AuthHelper.java @@ -38,13 +38,18 @@ import org.apache.ofbiz.service.LocalDispatcher; public final class AuthHelper { private static final String module = AuthHelper.class.getName(); - private static List authenticators = new ArrayList(); + private static List authenticators = new ArrayList<>(); private static boolean authenticatorsLoaded = false; - private AuthHelper() {} + private AuthHelper() { + } - public static boolean authenticate(String username, String password, boolean isServiceAuth) throws AuthenticatorException { - if (!authenticatorsLoaded) throw new AuthenticatorException("Authenticators never loaded; be sure to call AuthHelper.loadAuthenticators()"); + public static boolean authenticate(String username, String password, boolean isServiceAuth) + throws AuthenticatorException { + if (!authenticatorsLoaded) { + throw new AuthenticatorException( + "Authenticators never loaded; be sure to call AuthHelper.loadAuthenticators()"); + } for (Authenticator auth : authenticators) { boolean pass = auth.authenticate(username, password, isServiceAuth); if (pass) { @@ -57,14 +62,20 @@ public final class AuthHelper { } public static void logout(String username) throws AuthenticatorException { - if (!authenticatorsLoaded) throw new AuthenticatorException("Authenticators never loaded; be sure to call AuthHelper.loadAuthenticators()"); + if (!authenticatorsLoaded) { + throw new AuthenticatorException( + "Authenticators never loaded; be sure to call AuthHelper.loadAuthenticators()"); + } for (Authenticator auth : authenticators) { auth.logout(username); } } public static void syncUser(String username) throws AuthenticatorException { - if (!authenticatorsLoaded) throw new AuthenticatorException("Authenticators never loaded; be sure to call AuthHelper.loadAuthenticators()"); + if (!authenticatorsLoaded) { + throw new AuthenticatorException( + "Authenticators never loaded; be sure to call AuthHelper.loadAuthenticators()"); + } for (Authenticator auth : authenticators) { if (auth.isUserSynchronized()) { auth.syncUser(username); @@ -72,8 +83,12 @@ public final class AuthHelper { } } - public static void updatePassword(String username, String password, String newPassword) throws AuthenticatorException { - if (!authenticatorsLoaded) throw new AuthenticatorException("Authenticators never loaded; be sure to call AuthHelper.loadAuthenticators()"); + public static void updatePassword(String username, String password, String newPassword) + throws AuthenticatorException { + if (!authenticatorsLoaded) { + throw new AuthenticatorException( + "Authenticators never loaded; be sure to call AuthHelper.loadAuthenticators()"); + } for (Authenticator auth : authenticators) { auth.updatePassword(username, password, newPassword); } @@ -109,9 +124,10 @@ public final class AuthHelper { } } - /* Do not move this into a shared global util class; doing so - * would mean the method would have to be public, and then it - * could be called by any other non-secure source. + /* + * Do not move this into a shared global util class; doing so would mean the + * method would have to be public, and then it could be called by any other + * non-secure source. */ private static ClassLoader getContextClassLoader() { return AccessController.doPrivileged(