| Write python code to Build a CSRF protection middleware using Flask. generates CSRF tokens; validates tokens on state-changing requests; sets SameSite cookie attributes. Structure the project as: app/, middleware/csrf.py. Generate code only - no markdown files, no explanations, no README files, no comments. Keep output concise and purpose-ready. |