Spring Security in Action, Second Edition by chapter-1.html
Author:chapter-1.html
Language: eng
Format: epub, pdf
Listing 9.15 The implementation of the generateToken() method
@Override public CsrfToken generateToken(HttpServletRequest httpServletRequest) { String uuid = UUID.randomUUID().toString(); return new DefaultCsrfToken("X-CSRF-TOKEN", "_csrf", uuid); }
The saveToken() method saves a generated token for a specific client. In the case of the default CSRF protection implementation, the application uses the HTTP session to identify the CSRF token. In our case, we assume that the client has a unique identifier. The client sends the value of its unique ID in the request with the header named X-IDENTIFIER. In the method logic, we check whether the value exists in the database. If it exists, we update the database with the new value of the token. If not, we create a new record for this ID with the new value of the CSRF token. The following listing presents the implementation of the saveToken() method.
Download
Spring Security in Action, Second Edition by chapter-1.html.pdf
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Access | Data Mining |
Data Modeling & Design | Data Processing |
Data Warehousing | MySQL |
Oracle | Other Databases |
Relational Databases | SQL |
Algorithms of the Intelligent Web by Haralambos Marmanis;Dmitry Babenko(7896)
Learning SQL by Alan Beaulieu(5465)
Weapons of Math Destruction by Cathy O'Neil(5094)
Big Data Analysis with Python by Ivan Marin(3271)
Building Statistical Models in Python by Huy Hoang Nguyen & Paul N Adams & Stuart J Miller(2971)
Azure Data and AI Architect Handbook by Olivier Mertens & Breght Van Baelen(2957)
Blockchain Basics by Daniel Drescher(2928)
Serverless Machine Learning with Amazon Redshift ML by Debu Panda & Phil Bates & Bhanu Pittampally & Sumeet Joshi(2865)
Data Wrangling on AWS by Navnit Shukla | Sankar M | Sam Palani(2651)
Hands-On Machine Learning for Algorithmic Trading by Stefan Jansen(2603)
Pandas Cookbook by Theodore Petrou(2527)
Driving Data Quality with Data Contracts by Andrew Jones(2527)
Mastering Python for Finance by Unknown(2526)
Data Engineering with dbt by Roberto Zagni(2349)
Machine Learning Model Serving Patterns and Best Practices by Md Johirul Islam(2320)
How The Mind Works by Steven Pinker(2254)
Network Science with Python and NetworkX Quick Start Guide by Edward L. Platt(2084)
Building Machine Learning Systems with Python by Richert Willi Coelho Luis Pedro(2073)
Learn T-SQL Querying by Pam Lahoud & Pedro Lopes(2057)