You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@guacamole.apache.org by GitBox <gi...@apache.org> on 2022/09/26 18:47:30 UTC

[GitHub] [guacamole-client] mike-jumper opened a new pull request, #762: GUACAMOLE-990: Ensure internal errors during auth reach global error handling/logging.

mike-jumper opened a new pull request, #762:
URL: https://github.com/apache/guacamole-client/pull/762

   The recent changes adding support for automatically banning IP addresses that repeatedly fail to authenticate (#758) have resulted in the details of internal errors being omitted from the Tomcat logs, instead being logged as “User authentication was aborted”.
   
   For example, if PostgreSQL is being used but the database server has not been started, the following is logged:
   
   ```
   12:12:59.935 [http-nio-8080-exec-2] WARN  o.a.g.e.AuthenticationProviderFacade - The "postgresql" authentication provider has encountered an internal error which will halt the authentication process. If this is unexpected or you are the developer of this authentication provider, you may wish to enable debug-level logging. If this is expected and you wish to ignore such failures in the future, please set "skip-if-unavailable: postgresql" within your guacamole.properties.
   12:12:59.949 [http-nio-8080-exec-2] ERROR o.a.g.rest.RESTExceptionMapper - Request could not be processed: User authentication was aborted.
   ```
   
   These changes rethrow the underlying cause when authentication fails due to an unchecked internal error. For other errors (subclasses of `GuacamoleException`), the original underlying exception is unwrapped and rethrown as before.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@guacamole.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [guacamole-client] jmuehlner commented on a diff in pull request #762: GUACAMOLE-990: Ensure internal errors during auth reach global error handling/logging.

Posted by GitBox <gi...@apache.org>.
jmuehlner commented on code in PR #762:
URL: https://github.com/apache/guacamole-client/pull/762#discussion_r982785216


##########
guacamole/src/main/java/org/apache/guacamole/rest/auth/GuacamoleAuthenticationProcessException.java:
##########
@@ -146,6 +146,38 @@ public GuacamoleException getCauseAsGuacamoleException() {
         return guacCause;
     }
 
+    /**
+     * Rethrows the original GuacamoleException wrapped within this
+     * GuacamoleAuthenticationProcessException. If there is no such exception,
+     * and the cause of this failure is an unchecked RuntimeException or Error,
+     * that unchecked exception/error is rethrown as-is.
+     *
+     * @throws GuacamoleException
+     *     If the underlying cause of this exception is a checked
+     *     GuacamoleException subclass.
+     *
+     * @throws RuntimeException
+     *     If the underlying cause of this exception is an unchecked
+     *     RuntimeException.
+     *
+     * @throws Error
+     *     If the underlying cause of this exception is an unchecked Error.
+     */
+    public void rethrowCause() throws GuacamoleException, RuntimeException, Error {
+
+        // Rethrow any unchecked exceptions/errors as-is
+        Throwable cause = getCause();
+        if (cause instanceof RuntimeException)
+            throw (RuntimeException) cause;

Review Comment:
   Ah gotcha. Wasn't sure if Java would automatically do that but I guess not 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@guacamole.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [guacamole-client] jmuehlner commented on a diff in pull request #762: GUACAMOLE-990: Ensure internal errors during auth reach global error handling/logging.

Posted by GitBox <gi...@apache.org>.
jmuehlner commented on code in PR #762:
URL: https://github.com/apache/guacamole-client/pull/762#discussion_r982722773


##########
guacamole/src/main/java/org/apache/guacamole/rest/auth/GuacamoleAuthenticationProcessException.java:
##########
@@ -146,6 +146,38 @@ public GuacamoleException getCauseAsGuacamoleException() {
         return guacCause;
     }
 
+    /**
+     * Rethrows the original GuacamoleException wrapped within this
+     * GuacamoleAuthenticationProcessException. If there is no such exception,
+     * and the cause of this failure is an unchecked RuntimeException or Error,
+     * that unchecked exception/error is rethrown as-is.
+     *
+     * @throws GuacamoleException
+     *     If the underlying cause of this exception is a checked
+     *     GuacamoleException subclass.
+     *
+     * @throws RuntimeException
+     *     If the underlying cause of this exception is an unchecked
+     *     RuntimeException.
+     *
+     * @throws Error
+     *     If the underlying cause of this exception is an unchecked Error.
+     */
+    public void rethrowCause() throws GuacamoleException, RuntimeException, Error {
+
+        // Rethrow any unchecked exceptions/errors as-is
+        Throwable cause = getCause();
+        if (cause instanceof RuntimeException)
+            throw (RuntimeException) cause;

Review Comment:
   What's the benefit of casting the exception here?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@guacamole.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [guacamole-client] mike-jumper commented on a diff in pull request #762: GUACAMOLE-990: Ensure internal errors during auth reach global error handling/logging.

Posted by GitBox <gi...@apache.org>.
mike-jumper commented on code in PR #762:
URL: https://github.com/apache/guacamole-client/pull/762#discussion_r982786158


##########
guacamole/src/main/java/org/apache/guacamole/rest/auth/GuacamoleAuthenticationProcessException.java:
##########
@@ -146,6 +146,38 @@ public GuacamoleException getCauseAsGuacamoleException() {
         return guacCause;
     }
 
+    /**
+     * Rethrows the original GuacamoleException wrapped within this
+     * GuacamoleAuthenticationProcessException. If there is no such exception,
+     * and the cause of this failure is an unchecked RuntimeException or Error,
+     * that unchecked exception/error is rethrown as-is.
+     *
+     * @throws GuacamoleException
+     *     If the underlying cause of this exception is a checked
+     *     GuacamoleException subclass.
+     *
+     * @throws RuntimeException
+     *     If the underlying cause of this exception is an unchecked
+     *     RuntimeException.
+     *
+     * @throws Error
+     *     If the underlying cause of this exception is an unchecked Error.
+     */
+    public void rethrowCause() throws GuacamoleException, RuntimeException, Error {
+
+        // Rethrow any unchecked exceptions/errors as-is
+        Throwable cause = getCause();
+        if (cause instanceof RuntimeException)
+            throw (RuntimeException) cause;

Review Comment:
   Yep, it needs some handholding here.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@guacamole.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [guacamole-client] jmuehlner merged pull request #762: GUACAMOLE-990: Ensure internal errors during auth reach global error handling/logging.

Posted by GitBox <gi...@apache.org>.
jmuehlner merged PR #762:
URL: https://github.com/apache/guacamole-client/pull/762


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@guacamole.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [guacamole-client] mike-jumper commented on a diff in pull request #762: GUACAMOLE-990: Ensure internal errors during auth reach global error handling/logging.

Posted by GitBox <gi...@apache.org>.
mike-jumper commented on code in PR #762:
URL: https://github.com/apache/guacamole-client/pull/762#discussion_r982784375


##########
guacamole/src/main/java/org/apache/guacamole/rest/auth/GuacamoleAuthenticationProcessException.java:
##########
@@ -146,6 +146,38 @@ public GuacamoleException getCauseAsGuacamoleException() {
         return guacCause;
     }
 
+    /**
+     * Rethrows the original GuacamoleException wrapped within this
+     * GuacamoleAuthenticationProcessException. If there is no such exception,
+     * and the cause of this failure is an unchecked RuntimeException or Error,
+     * that unchecked exception/error is rethrown as-is.
+     *
+     * @throws GuacamoleException
+     *     If the underlying cause of this exception is a checked
+     *     GuacamoleException subclass.
+     *
+     * @throws RuntimeException
+     *     If the underlying cause of this exception is an unchecked
+     *     RuntimeException.
+     *
+     * @throws Error
+     *     If the underlying cause of this exception is an unchecked Error.
+     */
+    public void rethrowCause() throws GuacamoleException, RuntimeException, Error {
+
+        // Rethrow any unchecked exceptions/errors as-is
+        Throwable cause = getCause();
+        if (cause instanceof RuntimeException)
+            throw (RuntimeException) cause;

Review Comment:
   It's otherwise just a `Throwable`, which is checked and would need to be explicitly declared and handled by the caller.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@guacamole.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org