Merge pull request #1124 from mrkkrp/master
Fix references to ‘Yesod.Core.Handler’
This commit is contained in:
commit
bde5a69914
@ -427,7 +427,7 @@ defaultCsrfCheckMiddleware handler = do
|
|||||||
-- | Looks up the CSRF token from the request headers or POST parameters. If the value doesn't match the token stored in the session,
|
-- | Looks up the CSRF token from the request headers or POST parameters. If the value doesn't match the token stored in the session,
|
||||||
-- this function throws a 'PermissionDenied' error.
|
-- this function throws a 'PermissionDenied' error.
|
||||||
--
|
--
|
||||||
-- For details, see the "AJAX CSRF protection" section of 'Yesod.Core.Handler'.
|
-- For details, see the "AJAX CSRF protection" section of "Yesod.Core.Handler".
|
||||||
--
|
--
|
||||||
-- Since 1.4.14
|
-- Since 1.4.14
|
||||||
csrfCheckMiddleware :: Yesod site
|
csrfCheckMiddleware :: Yesod site
|
||||||
@ -449,15 +449,15 @@ defaultCsrfSetCookieMiddleware handler = csrfSetCookieMiddleware handler (def {
|
|||||||
|
|
||||||
-- | Takes a 'SetCookie' and overrides its value with a CSRF token, then sets the cookie. See 'setCsrfCookieWithCookie'.
|
-- | Takes a 'SetCookie' and overrides its value with a CSRF token, then sets the cookie. See 'setCsrfCookieWithCookie'.
|
||||||
--
|
--
|
||||||
-- For details, see the "AJAX CSRF protection" section of 'Yesod.Core.Handler'.
|
-- For details, see the "AJAX CSRF protection" section of "Yesod.Core.Handler".
|
||||||
--
|
--
|
||||||
-- Since 1.4.14
|
-- Since 1.4.14
|
||||||
csrfSetCookieMiddleware :: Yesod site => HandlerT site IO res -> SetCookie -> HandlerT site IO res
|
csrfSetCookieMiddleware :: Yesod site => HandlerT site IO res -> SetCookie -> HandlerT site IO res
|
||||||
csrfSetCookieMiddleware handler cookie = setCsrfCookieWithCookie cookie >> handler
|
csrfSetCookieMiddleware handler cookie = setCsrfCookieWithCookie cookie >> handler
|
||||||
|
|
||||||
-- | Calls 'defaultCsrfSetCookieMiddleware' and 'defaultCsrfCheckMiddleware'. Use this midle
|
-- | Calls 'defaultCsrfSetCookieMiddleware' and 'defaultCsrfCheckMiddleware'.
|
||||||
--
|
--
|
||||||
-- For details, see the "AJAX CSRF protection" section of 'Yesod.Core.Handler'.
|
-- For details, see the "AJAX CSRF protection" section of "Yesod.Core.Handler".
|
||||||
--
|
--
|
||||||
-- Since 1.4.14
|
-- Since 1.4.14
|
||||||
defaultCsrfMiddleware :: Yesod site => HandlerT site IO res -> HandlerT site IO res
|
defaultCsrfMiddleware :: Yesod site => HandlerT site IO res -> HandlerT site IO res
|
||||||
|
|||||||
@ -1315,7 +1315,7 @@ stripHandlerT (HandlerT f) getSub toMaster newRoute = HandlerT $ \hd -> do
|
|||||||
--
|
--
|
||||||
-- (2) Yesod can store the CSRF token in a cookie which is accessible by Javascript. Requests made by Javascript can lookup this cookie and add it as a header to requests. The server then checks the token in the header against the one in the encrypted session.
|
-- (2) Yesod can store the CSRF token in a cookie which is accessible by Javascript. Requests made by Javascript can lookup this cookie and add it as a header to requests. The server then checks the token in the header against the one in the encrypted session.
|
||||||
--
|
--
|
||||||
-- The form-based approach has the advantage of working for users with Javascript disabled, while adding the token to the headers with Javascript allows things like submitting JSON or binary data in AJAX requests. Yesod supports checking for a CSRF token in either the POST parameters of the form ('checkCsrfHeaderNamed'), the headers ('checkCsrfHeaderNamed'), or both options ('checkCsrfHeaderOrParam').
|
-- The form-based approach has the advantage of working for users with Javascript disabled, while adding the token to the headers with Javascript allows things like submitting JSON or binary data in AJAX requests. Yesod supports checking for a CSRF token in either the POST parameters of the form ('checkCsrfParamNamed'), the headers ('checkCsrfHeaderNamed'), or both options ('checkCsrfHeaderOrParam').
|
||||||
--
|
--
|
||||||
-- The easiest way to check both sources is to add the 'defaultCsrfMiddleware' to your Yesod Middleware.
|
-- The easiest way to check both sources is to add the 'defaultCsrfMiddleware' to your Yesod Middleware.
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user