private boolean checkRequestGeoLocation(final HttpServletRequest httpServletRequest,
                                            final String clientIp, final String mfaMethod,
                                            final String pattern) throws Throwable {
        if (this.geoLocationService == null) {
            LOGGER.trace("No geolocation service is defined");
            return false;
        }

        val location = HttpRequestUtils.getHttpServletRequestGeoLocation(httpServletRequest);
        val loc = this.geoLocationService.locate(clientIp, location);
        if (loc == null) {
            LOGGER.trace("No geolocation response is provided");
            return false;
        }

        val address = loc.build();
        if (RegexUtils.find(pattern, address)) {
            LOGGER.debug("Current address [{}] at [{}] matches the provided pattern [{}] for "
                    + "adaptive authentication and is required to use [{}]",
                address, clientIp, pattern, mfaMethod);
            return true;
        }
        return false;
    }
This is {@link AdaptiveMultifactorAuthenticationTrigger}.

@author Misagh Moayyed
@since 6.0.0
core/cas-server-core-authentication-mfa-api/src/main/java/org/apereo/cas/authentication/mfa/trigger/AdaptiveMultifactorAuthenticationTrigger.java