public static void verifyHostRestrictions(Restrictable restrictable,
            String remoteAddress) throws GuacamoleException {
        
        // Verify time-based restrictions specific to this connection.
        String allowedHostsString = restrictable.getAttributes().get(Restrictable.RESTRICT_HOSTS_ALLOWED_ATTRIBUTE_NAME);
        String deniedHostsString = restrictable.getAttributes().get(Restrictable.RESTRICT_HOSTS_DENIED_ATTRIBUTE_NAME);
        RestrictionType hostRestrictionResult = allowedByHostRestrictions(allowedHostsString, deniedHostsString, remoteAddress);
        
        // If the host is not allowed
        if (!hostRestrictionResult.isAllowed())
            throw new TranslatableGuacamoleSecurityException(
                    "Use of this connection is not allowed from this remote host: \"" + remoteAddress + "\".", 
                    "RESTRICT.ERROR_CONNECTION_NOT_ALLOWED_NOW"
            );
        
    }
Verify the host-based restrictions of the Connection, throwing an
exception if the Connection should be allowed from the host from which
the user is logged in.

@param restrictable
    The Restrictable object that should be verified against host restrictions.

@param remoteAddress
    The remote address of the client from which the current user is
    logged in.

@throws GuacamoleException 
    If the connection should not be allowed from the remote host from
    which the user is logged in.
extensions/guacamole-auth-restrict/src/main/java/org/apache/guacamole/auth/restrict/RestrictionVerificationService.java