@Test public void testRaw() { SecurityMarkerFilter mkt = new SecurityMarkerFilter(); mkt.setContext(loggerContext); mkt.start(); assertTrue(mkt.isStarted()); ILoggingEvent nulEvent = new LoggingEvent(); assertEquals(FilterReply.DENY, mkt.decide(nulEvent)); LoggingEvent confidentialEvent = new LoggingEvent(); confidentialEvent.setMarker(SecurityMarkers.SECURITY_SUCCESS); assertEquals(FilterReply.NEUTRAL, mkt.decide(confidentialEvent)); LoggingEvent restrictedEvent = new LoggingEvent(); restrictedEvent.setMarker(SecurityMarkers.SECURITY_FAILURE); assertEquals(FilterReply.NEUTRAL, mkt.decide(restrictedEvent)); LoggingEvent secretEvent = new LoggingEvent(); secretEvent.setMarker(SecurityMarkers.SECURITY_AUDIT); assertEquals(FilterReply.NEUTRAL, mkt.decide(secretEvent)); }
public FilterReply decide(ILoggingEvent event) { if (!isStarted()) { return FilterReply.NEUTRAL; } Marker eventMarker = event.getMarker(); if (eventMarker == null) { return FilterReply.DENY; } if (eventMarker.hasReferences()) { for (Marker marker : markersToMatch) { if (eventMarker.contains(marker)) { return acceptAll ? FilterReply.ACCEPT : FilterReply.NEUTRAL; } } } else { if (markersToMatch.contains(eventMarker)) { return acceptAll ? FilterReply.ACCEPT : FilterReply.NEUTRAL; } } return FilterReply.DENY; }
SecurityMarkerFilter extends AbstractMatcherFilter<ILoggingEvent> { public FilterReply decide(ILoggingEvent event) { if (!isStarted()) { return FilterReply.NEUTRAL; } Marker eventMarker = event.getMarker(); if (eventMarker == null) { return FilterReply.DENY; } if (eventMarker.hasReferences()) { for (Marker marker : markersToMatch) { if (eventMarker.contains(marker)) { return acceptAll ? FilterReply.ACCEPT : FilterReply.NEUTRAL; } } } else { if (markersToMatch.contains(eventMarker)) { return acceptAll ? FilterReply.ACCEPT : FilterReply.NEUTRAL; } } return FilterReply.DENY; } }
SecurityMarkerFilter extends AbstractMatcherFilter<ILoggingEvent> { public FilterReply decide(ILoggingEvent event) { if (!isStarted()) { return FilterReply.NEUTRAL; } Marker eventMarker = event.getMarker(); if (eventMarker == null) { return FilterReply.DENY; } if (eventMarker.hasReferences()) { for (Marker marker : markersToMatch) { if (eventMarker.contains(marker)) { return acceptAll ? FilterReply.ACCEPT : FilterReply.NEUTRAL; } } } else { if (markersToMatch.contains(eventMarker)) { return acceptAll ? FilterReply.ACCEPT : FilterReply.NEUTRAL; } } return FilterReply.DENY; }  }
SecurityMarkerFilter extends AbstractMatcherFilter<ILoggingEvent> { public FilterReply decide(ILoggingEvent event) { if (!isStarted()) { return FilterReply.NEUTRAL; } Marker eventMarker = event.getMarker(); if (eventMarker == null) { return FilterReply.DENY; } if (eventMarker.hasReferences()) { for (Marker marker : markersToMatch) { if (eventMarker.contains(marker)) { return acceptAll ? FilterReply.ACCEPT : FilterReply.NEUTRAL; } } } else { if (markersToMatch.contains(eventMarker)) { return acceptAll ? FilterReply.ACCEPT : FilterReply.NEUTRAL; } } return FilterReply.DENY; }  FilterReply decide(ILoggingEvent event); void setAcceptAll(String input); }
SecurityMarkerFilter extends AbstractMatcherFilter<ILoggingEvent> { public FilterReply decide(ILoggingEvent event) { if (!isStarted()) { return FilterReply.NEUTRAL; } Marker eventMarker = event.getMarker(); if (eventMarker == null) { return FilterReply.DENY; } if (eventMarker.hasReferences()) { for (Marker marker : markersToMatch) { if (eventMarker.contains(marker)) { return acceptAll ? FilterReply.ACCEPT : FilterReply.NEUTRAL; } } } else { if (markersToMatch.contains(eventMarker)) { return acceptAll ? FilterReply.ACCEPT : FilterReply.NEUTRAL; } } return FilterReply.DENY; }  FilterReply decide(ILoggingEvent event); void setAcceptAll(String input); static final List<Marker> markersToMatch; }