use of org.apereo.cas.authentication.adaptive.geo.GeoLocationResponse in project cas by apereo.
the class AdaptiveMultifactorAuthenticationPolicyEventResolver method checkRequestGeoLocation.
private boolean checkRequestGeoLocation(final String clientIp, final String mfaMethod, final String pattern) {
if (this.geoLocationService != null) {
final GeoLocationRequest location = WebUtils.getHttpServletRequestGeoLocation();
final GeoLocationResponse loc = this.geoLocationService.locate(clientIp, location);
if (loc != null) {
final String address = loc.build();
if (address.matches(pattern)) {
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;
}
Aggregations