A servlet request attribute is a named value attached to an HTTP request so filters and other processing components can retrieve it. Spring Security's CsrfFilter stores a CsrfToken under the _csrf attribute. section 9.1
The attribute supports a practical CSRF-token flow:
- A custom servlet Filter retrieves _csrf with request.getAttribute("_csrf"). section 9.1
- The retrieved CsrfToken exposes its string value through getToken(). section 9.1
- Registering the custom filter after CsrfFilter ensures the attribute has been deposited before retrieval. section 9.1
Logging a CSRF token
A CsrfTokenLogger obtains the _csrf request attribute, casts it to CsrfToken, logs getToken(), and continues the filter chain. A GET request can expose the token for testing; a POST without it receives HTTP 403. section 9.1

