use of org.apereo.cas.support.events.dao.CasEvent in project cas by apereo.
the class IpAddressAuthenticationRequestRiskCalculator method calculateScore.
@Override
protected BigDecimal calculateScore(final HttpServletRequest request, final Authentication authentication, final RegisteredService service, final Supplier<Stream<? extends CasEvent>> events) {
val remoteAddr = ClientInfoHolder.getClientInfo().getClientIpAddress();
LOGGER.debug("Filtering authentication events for ip address [{}]", remoteAddr);
val count = events.get().filter(e -> e.getClientIpAddress().equalsIgnoreCase(remoteAddr)).count();
LOGGER.debug("Total authentication events found for [{}]: [{}]", remoteAddr, count);
return calculateScoreBasedOnEventsCount(authentication, events, count);
}
use of org.apereo.cas.support.events.dao.CasEvent in project cas by apereo.
the class UserAgentAuthenticationRequestRiskCalculator method calculateScore.
@Override
protected BigDecimal calculateScore(final HttpServletRequest request, final Authentication authentication, final RegisteredService service, final Supplier<Stream<? extends CasEvent>> events) {
val agent = HttpRequestUtils.getHttpServletRequestUserAgent(request);
LOGGER.debug("Filtering authentication events for user agent [{}]", agent);
val count = events.get().filter(e -> StringUtils.isNotBlank(e.getAgent())).filter(e -> e.getAgent().equalsIgnoreCase(agent)).count();
LOGGER.debug("Total authentication events found for [{}]: [{}]", agent, count);
return calculateScoreBasedOnEventsCount(authentication, events, count);
}
use of org.apereo.cas.support.events.dao.CasEvent in project cas by apereo.
the class MongoDbCasEventRepository method getEventsOfType.
@Override
public Stream<? extends CasEvent> getEventsOfType(final String type) {
val query = new Query();
query.addCriteria(Criteria.where(TYPE_PARAM).is(type));
return this.mongoTemplate.stream(query, CasEvent.class, this.collectionName).stream();
}
use of org.apereo.cas.support.events.dao.CasEvent in project cas by apereo.
the class MongoDbCasEventRepository method getEventsOfType.
@Override
public Stream<? extends CasEvent> getEventsOfType(final String type, final ZonedDateTime dateTime) {
val query = new Query();
query.addCriteria(Criteria.where(TYPE_PARAM).is(type).and(CREATION_TIME_PARAM).gte(dateTime.toString()));
return this.mongoTemplate.stream(query, CasEvent.class, this.collectionName).stream();
}
Aggregations