code: private AuthenticatedUser authenticateUser(Credentials credentials)
          throws GuacamoleException {
  
          GuacamoleCredentialsException authFailure = null;
  
          // Attempt authentication against each AuthenticationProvider
          for (AuthenticationProvider authProvider : authProviders) {
  
              // Attempt authentication
              try {
                  AuthenticatedUser authenticatedUser = authProvider.authenticateUser(credentials);
                  if (authenticatedUser != null)
                      return authenticatedUser;
              }
  
              // First failure takes priority for now
              catch (GuacamoleCredentialsException e) {
                  if (authFailure == null)
                      authFailure = e;
              }
  
          }
  
          // If a specific failure occured, rethrow that
          if (authFailure != null)
              throw authFailure;
  
          // Otherwise, request standard username/password
          throw new GuacamoleInvalidCredentialsException(
              "Permission Denied.",
              CredentialsInfo.USERNAME_PASSWORD
          );
  
      }
docs: Attempts authentication against all AuthenticationProviders, in order,
  using the provided credentials. The first authentication failure takes
  priority, but remaining AuthenticationProviders are attempted. If any
  AuthenticationProvider succeeds, the resulting AuthenticatedUser is
  returned, and no further AuthenticationProviders are tried.
  
  @param credentials
  The credentials to use for authentication.
  
  @return
  The AuthenticatedUser given by the highest-priority
  AuthenticationProvider for which the given credentials are valid.
  
  @throws GuacamoleException
  If the given credentials are not valid for any
  AuthenticationProvider, or if an error occurs while authenticating
  the user.