Created
June 6, 2013 08:47
-
-
Save guillaumebort/5720192 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
request.headers.get(CONTENT_TYPE) match { | |
case Some(ct) if ct.trim.startsWith("multipart/form-data") => | |
filterLogger.trace("[CSRF] request is multipart/form-data") | |
checkMultipart(request, token, next) | |
case Some(ct) if ct.trim.startsWith("application/x-www-form-urlencoded") => | |
filterLogger.trace("[CSRF] request is application/x-www-form-urlencoded") | |
checkFormUrlEncodedBody(request, token, next) | |
case Some(ct) if ct.trim.startsWith("text/plain") => | |
filterLogger.trace("[CSRF] request is text/playn") | |
checkTextBody(request, token, next) | |
case None if request.method == "GET" => | |
filterLogger.trace("[CSRF] GET request, adding the token") | |
next(addRequestToken(request, token)).map(result => addResponseToken(request, result, token))(defaultContext) | |
case ct => | |
filterLogger.trace("[CSRF] bypass the request (%s)".format(ct.toString)) | |
next(request) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment