public boolean isAuthenticationAllowed(Credentials credentials) {

        // Pull list of all trusted networks
        Collection<String> trustedNetworks;
        try {
            trustedNetworks = confService.getTrustedNetworks();
        }

        // Deny all requests if restrictions cannot be parsed
        catch (GuacamoleException e) {
            logger.warn("Authentication request from \"{}\" is DENIED due to parse error: {}", credentials.getRemoteAddress(), e.getMessage());
            logger.debug("Error parsing authentication request restrictions from guacamole.properties.", e);
            return false;
        }

        // All requests are allowed if no restrictions are defined
        if (trustedNetworks.isEmpty()) {
            logger.debug("Authentication request from \"{}\" is ALLOWED (no restrictions).", credentials.getRemoteAddress());
            return true;
        }

        // Otherwise ensure that the remote address is part of a trusted network
        for (String network : trustedNetworks) {

            // Request is allowed if any subnet matches
            if (new IPAddressString(network).contains(new IPAddressString(credentials.getRemoteAddress()))) {
                logger.debug("Authentication request from \"{}\" is ALLOWED (matched subnet).", credentials.getRemoteAddress());
                return true;
            }

        }

        // Otherwise request is denied - no subnets matched
        logger.debug("Authentication request from \"{}\" is DENIED (did not match subnet).", credentials.getRemoteAddress());
        return false;

    }
Returns whether the given credentials can be used for authentication,
taking into account restrictions specified within guacamole.properties.

@param credentials
    The credentials of the authentication request to test.

@return
    true if the given credentials come from a trusted source and can be
    used for authentication, false otherwise.
extensions/guacamole-auth-json/src/main/java/org/apache/guacamole/auth/json/RequestValidationService.java