diff --git a/extensions/guacamole-auth-duo/src/main/java/org/apache/guacamole/auth/duo/UserVerificationService.java b/extensions/guacamole-auth-duo/src/main/java/org/apache/guacamole/auth/duo/UserVerificationService.java index 777c96bd2..abcb48605 100644 --- a/extensions/guacamole-auth-duo/src/main/java/org/apache/guacamole/auth/duo/UserVerificationService.java +++ b/extensions/guacamole-auth-duo/src/main/java/org/apache/guacamole/auth/duo/UserVerificationService.java @@ -22,16 +22,16 @@ package org.apache.guacamole.auth.duo; import com.google.inject.Inject; import java.util.Collections; import javax.servlet.http.HttpServletRequest; -import org.apache.guacamole.GuacamoleClientException; import org.apache.guacamole.GuacamoleException; import org.apache.guacamole.auth.duo.api.DuoService; import org.apache.guacamole.auth.duo.conf.ConfigurationService; import org.apache.guacamole.auth.duo.form.DuoSignedResponseField; import org.apache.guacamole.form.Field; +import org.apache.guacamole.language.TranslatableGuacamoleClientException; +import org.apache.guacamole.language.TranslatableGuacamoleInsufficientCredentialsException; import org.apache.guacamole.net.auth.AuthenticatedUser; import org.apache.guacamole.net.auth.Credentials; import org.apache.guacamole.net.auth.credentials.CredentialsInfo; -import org.apache.guacamole.net.auth.credentials.GuacamoleInsufficientCredentialsException; /** * Service for verifying the identity of a user against Duo. @@ -95,14 +95,18 @@ public class UserVerificationService { Collections.singletonList(signedResponseField)); // Request additional credentials - throw new GuacamoleInsufficientCredentialsException( - "LOGIN.INFO_DUO_AUTH_REQUIRED", expectedCredentials); + throw new TranslatableGuacamoleInsufficientCredentialsException( + "Verification using Duo is required before authentication " + + "can continue.", "LOGIN.INFO_DUO_AUTH_REQUIRED", + expectedCredentials); } // If signed response does not verify this user's identity, abort auth if (!duoService.isValidSignedResponse(authenticatedUser, signedResponse)) - throw new GuacamoleClientException("LOGIN.INFO_DUO_VALIDATION_CODE_INCORRECT"); + throw new TranslatableGuacamoleClientException("Provided Duo " + + "validation code is incorrect.", + "LOGIN.INFO_DUO_VALIDATION_CODE_INCORRECT"); } diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/JDBCAuthenticationProviderService.java b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/JDBCAuthenticationProviderService.java index ff605b984..646bf20d3 100644 --- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/JDBCAuthenticationProviderService.java +++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/JDBCAuthenticationProviderService.java @@ -21,7 +21,6 @@ package org.apache.guacamole.auth.jdbc; import com.google.inject.Inject; import com.google.inject.Provider; -import org.apache.guacamole.GuacamoleClientException; import org.apache.guacamole.GuacamoleException; import org.apache.guacamole.auth.jdbc.security.PasswordPolicyService; import org.apache.guacamole.auth.jdbc.sharing.user.SharedAuthenticatedUser; @@ -29,6 +28,7 @@ import org.apache.guacamole.auth.jdbc.user.ModeledAuthenticatedUser; import org.apache.guacamole.auth.jdbc.user.ModeledUser; import org.apache.guacamole.auth.jdbc.user.ModeledUserContext; import org.apache.guacamole.auth.jdbc.user.UserService; +import org.apache.guacamole.language.TranslatableGuacamoleClientException; import org.apache.guacamole.net.auth.AuthenticatedUser; import org.apache.guacamole.net.auth.AuthenticationProvider; import org.apache.guacamole.net.auth.Credentials; @@ -104,11 +104,15 @@ public class JDBCAuthenticationProviderService implements AuthenticationProvider // Verify user account is still valid as of today if (!user.isAccountValid()) - throw new GuacamoleClientException("LOGIN.ERROR_NOT_VALID"); + throw new TranslatableGuacamoleClientException("User " + + "account is no longer valid.", + "LOGIN.ERROR_NOT_VALID"); // Verify user account is allowed to be used at the current time if (!user.isAccountAccessible()) - throw new GuacamoleClientException("LOGIN.ERROR_NOT_ACCESSIBLE"); + throw new TranslatableGuacamoleClientException("User " + + "account may not be used at this time.", + "LOGIN.ERROR_NOT_ACCESSIBLE"); } diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/user/UserService.java b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/user/UserService.java index 0cfe90067..a68f08237 100644 --- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/user/UserService.java +++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/user/UserService.java @@ -46,12 +46,13 @@ import org.apache.guacamole.auth.jdbc.security.PasswordEncryptionService; import org.apache.guacamole.auth.jdbc.security.PasswordPolicyService; import org.apache.guacamole.form.Field; import org.apache.guacamole.form.PasswordField; +import org.apache.guacamole.language.TranslatableGuacamoleClientException; +import org.apache.guacamole.language.TranslatableGuacamoleInsufficientCredentialsException; import org.apache.guacamole.net.auth.ActivityRecord; import org.apache.guacamole.net.auth.AuthenticatedUser; import org.apache.guacamole.net.auth.AuthenticationProvider; import org.apache.guacamole.net.auth.User; import org.apache.guacamole.net.auth.credentials.CredentialsInfo; -import org.apache.guacamole.net.auth.credentials.GuacamoleInsufficientCredentialsException; import org.apache.guacamole.net.auth.permission.ObjectPermission; import org.apache.guacamole.net.auth.permission.ObjectPermissionSet; import org.apache.guacamole.net.auth.permission.SystemPermission; @@ -494,20 +495,25 @@ public class UserService extends ModeledDirectoryObjectServicesingletonList(field) )); } // Otherwise simply request the user's authentication code - throw new GuacamoleInsufficientCredentialsException( - "TOTP.INFO_CODE_REQUIRED", new CredentialsInfo( + throw new TranslatableGuacamoleInsufficientCredentialsException( + "A TOTP authentication code is required before login can " + + "continue", "TOTP.INFO_CODE_REQUIRED", new CredentialsInfo( Collections.singletonList(field) )); @@ -291,7 +294,8 @@ public class UserVerificationService { } // Provided code is not valid - throw new GuacamoleClientException("TOTP.INFO_VERIFICATION_FAILED"); + throw new TranslatableGuacamoleClientException("Provided TOTP code " + + "is not valid.", "TOTP.INFO_VERIFICATION_FAILED"); }