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(7863)
Learning SQL by Alan Beaulieu(5428)
Weapons of Math Destruction by Cathy O'Neil(5050)
Big Data Analysis with Python by Ivan Marin(3104)
Blockchain Basics by Daniel Drescher(2899)
Building Statistical Models in Python by Huy Hoang Nguyen & Paul N Adams & Stuart J Miller(2661)
Azure Data and AI Architect Handbook by Olivier Mertens & Breght Van Baelen(2630)
Serverless Machine Learning with Amazon Redshift ML by Debu Panda & Phil Bates & Bhanu Pittampally & Sumeet Joshi(2565)
Hands-On Machine Learning for Algorithmic Trading by Stefan Jansen(2545)
Pandas Cookbook by Theodore Petrou(2509)
Mastering Python for Finance by Unknown(2494)
Data Wrangling on AWS by Navnit Shukla | Sankar M | Sam Palani(2346)
How The Mind Works by Steven Pinker(2224)
Driving Data Quality with Data Contracts by Andrew Jones(2211)
Data Engineering with dbt by Roberto Zagni(2170)
Building Machine Learning Systems with Python by Richert Willi Coelho Luis Pedro(2061)
Network Science with Python and NetworkX Quick Start Guide by Edward L. Platt(2010)
Machine Learning Model Serving Patterns and Best Practices by Md Johirul Islam(2008)
Python Natural Language Processing by Jalaj Thanaki(1896)