Skip to content

Commit

Permalink
Merge pull request #28333 from kdnakt/fix-csrf-doc
Browse files Browse the repository at this point in the history
Fix sample code in csrf project
  • Loading branch information
gsmet authored Oct 1, 2022
2 parents 5841fa1 + 931015f commit 51be68c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions docs/src/main/asciidoc/security-csrf-prevention.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public class UserNameResource {
@Path("/csrfTokenForm")
@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
@Produces(MediaType.TEXT_PLAIN)
public String postCsrfTokenForm(@FormParam("name") String name) {
public String postCsrfTokenForm(@FormParam("name") String userName) {
return userName; <3>
}
}
Expand All @@ -123,7 +123,7 @@ quarkus.csrf-reactive.form-field-name=csrftoken
quarkus.csrf-reactive.cookie-name=csrftoken
----

Note that the CSRF filter has to read the input stream in order to verify the token and then re-create the stream for the application code to read it as well. The filter performs this work on an event loop thread so for small form payloads, such as the one shown in the example above, it will have negligible peformance side-effects. However if you deal with large form payloads then it is recommended to compare the CSRF form field and cookie values in the application code:
Note that the CSRF filter has to read the input stream in order to verify the token and then re-create the stream for the application code to read it as well. The filter performs this work on an event loop thread so for small form payloads, such as the one shown in the example above, it will have negligible performance side-effects. However if you deal with large form payloads then it is recommended to compare the CSRF form field and cookie values in the application code:

[source,java]
----
Expand Down

0 comments on commit 51be68c

Please sign in to comment.