package ninja;

import ninja.utils.NinjaConstant;

import com.google.inject.Inject;

/**
 * 
 * @author svenkubiak
 *
 */
public class AuthenticityFilter implements Filter {
    
    private NinjaDefault ninjaDefault;

    @Inject
    public AuthenticityFilter(NinjaDefault ninjaDefault) {
        this.ninjaDefault = ninjaDefault;
    }
    
    @Override
    public Result filter(FilterChain filterChain, Context context) {
        String authenticityToken = context.getParameter(NinjaConstant.AUTHENTICITY_TOKEN);
        if (!context.getSession().getAuthenticityToken().equals(authenticityToken)) {
            return ninjaDefault.getForbiddenResult(context);
        }
        
        return filterChain.next(context);
    }
}
@@ -76,16 +76,73 @@
 .Inject;
+%0Aimport org.slf4j.Logger;%0Aimport org.slf4j.LoggerFactory;
 %0A%0A/**%0A *
@@ -228,20 +228,22 @@
 r %7B%0A    
-%0A   
+static
  private
@@ -247,33 +247,115 @@
 ate 
-NinjaDefault ninjaDefault
+final Logger logger = LoggerFactory.getLogger(AuthenticityFilter.class);%0A    %0A    private final Ninja ninja
 ;%0A%0A 
@@ -404,28 +404,14 @@
 inja
-Default ninjaDefault
+ ninja
 ) %7B%0A
@@ -432,23 +432,16 @@
 inja
-Default
  = ninja
 Defa
@@ -436,23 +436,16 @@
  = ninja
-Default
 ;%0A    %7D%0A
@@ -623,16 +623,25 @@
 TOKEN);%0A
+        %0A
         
@@ -714,24 +714,136 @@
 tyToken)) %7B%0A
+            logger.warn(%22Authenticity token mismatch. Request from %7B%7D is forbidden!%22, context.getRemoteAddr());%0A
             
@@ -858,15 +858,8 @@
 inja
-Default
 .get

Use Ninja not NinjaDefault. Log filtered authenticity requests.