🔐 Understanding "BCryptPasswordEncoder" Internals in Spring Security 🚀 Today I explored how "BCryptPasswordEncoder" works internally in Spring Security and why it is one of the most trusted ways to store passwords securely. ✅ Key Learnings: • Passwords are never stored in plain text • BCrypt uses random Salt for every password • Same password generates different hashes every time • Uses Cost Factor (Work Factor) to make brute-force attacks slower • One-way hashing algorithm — hashes cannot be reversed 📌 Internal Flow of "encode()": 1️⃣ User enters password 2️⃣ Random Salt is generated 3️⃣ Password + Salt are combined 4️⃣ BCrypt hashing algorithm is applied 5️⃣ Cost factor increases security 6️⃣ Final hash is stored in the database 📌 Internal Flow of "matches()": ✔ Extracts salt and cost from stored hash ✔ Re-hashes entered password ✔ Compares both hashes securely 💡 Recommended Bean Configuration: @Bean public PasswordEncoder passwordEncoder() { return new BCryptPasswordEncoder(); } 🔥 Why BCrypt is Secure? ✔ Salt Protection ✔ Slow Hashing ✔ Brute Force Resistance ✔ Industry Standard ✔ No Plain Text Passwords As a Java & Spring Boot learner, understanding security internals is helping me build more secure applications step by step. 🚀 #Java #SpringBoot #SpringSecurity #BCrypt #BackendDevelopment #JavaDeveloper #Programming #Coding #SoftwareDevelopment #Security #JWT #TechLearning Durgesh Tiwari
BCryptPasswordEncoder Internals in Spring Security Explained
More Relevant Posts
-
🚀 Day 8 of Building a Production-Ready Backend Where Most Security Implementations Fail I configured Spring Security today. And here’s the truth: 👉 Spring Security does NOTHING unless you configure it correctly. 💡 What I did: Defined public vs protected routes Configured Security Filter Chain 🧠 Key learning: Security is explicit, not implicit 🎯 Now the system knows: Which APIs are open Which require authentication #SpringSecurity #Java #BackendDevelopment #Security
To view or add a comment, sign in
-
🚀 My Backend Learning Journey – Spring Security 🔐 Today I explored the fundamentals of Spring Security, one of the most important modules in the Spring ecosystem for building secure applications. 🔹 What I Learned: ✅ Overview of Spring Security It provides authentication and authorization for Java applications Helps protect APIs and web apps from unauthorized access Works seamlessly with Spring Boot projects ✅ CSRF Token (Cross-Site Request Forgery) Protects applications from malicious requests sent without user consent Generates a unique token for each session/request Ensures that only trusted requests are processed by the server 💡 Key Takeaway: Security is not just an add-on, it’s a core part of backend development. Even a simple application needs proper authentication and protection mechanisms. 📌 Next Step: Implementing authentication with JWT and role-based access control. #SpringBoot #SpringSecurity #BackendDevelopment #Java #LearningJourney #WebDevelopment #CSRF
To view or add a comment, sign in
-
A single unsanitized path concatenation can expose your database credentials, API keys, and application source code. That's directory traversal. No complex exploit chains, no zero-days. Just ../../../etc/passwd appended to a file download endpoint. New post on Security Depth covers the mechanics behind path traversal in Java, from encoding tricks that bypass naive validation to zip slip attacks during archive extraction. Vulnerable code first, then the fix. All examples use Java 21 and Spring Boot. 🔗 https://lnkd.in/diByW3wq #AppSec #DirectoryTraversal #JavaSecurity #SpringBoot #OWASP #SecureCoding #ApplicationSecurity
To view or add a comment, sign in
-
🔐 𝗝𝗪𝗧 𝗔𝘂𝘁𝗵𝗲𝗻𝘁𝗶𝗰𝗮𝘁𝗶𝗼𝗻 𝗶𝗻 𝗦𝗽𝗿𝗶𝗻𝗴 𝗦𝗲𝗰𝘂𝗿𝗶𝘁𝘆 In this guide, I break down the key components involved in implementing JWT-based authentication using Spring Security. You’ll learn how the pieces fit together and how to build a secure, stateless authentication flow. Here’s what is covered : 🔸 𝗔𝘂𝘁𝗵𝗲𝗻𝘁𝗶𝗰𝗮𝘁𝗶𝗼𝗻 𝗙𝗶𝗹𝘁𝗲𝗿 : How incoming requests are intercepted and JWTs are validated. 🔸𝗧𝗵𝗲 𝗙𝗶𝗹𝘁𝗲𝗿 𝗖𝗵𝗮𝗶𝗻 : The order of security filters and why it matters for request processing. 🔸𝗔𝘂𝘁𝗵𝗲𝗻𝘁𝗶𝗰𝗮𝘁𝗶𝗼𝗻 𝗣𝗿𝗼𝘃𝗶𝗱𝗲𝗿 : How credentials or tokens are verified and users are authenticated. Whether you’re building a REST API or a modern microservice, understanding these parts is crucial for secure authentication. #SpringBoot #SpringSecurity #JWT #Authentication #RESTAPI #Java #Microservices #APISecurity #WebDevelopment #BackendDevelopment
To view or add a comment, sign in
-
I joined Java application security team in August 2025. Early on, I reviewed a service that worked perfectly. No errors. No complaints. But it was returning slightly more data than it should. Nothing broke. But it exposed more than intended. That’s when it clicked: **Security issues don’t break systems. They quietly expose them.** ------ In the last 8 months, a few things changed how I think: ------ Most vulnerabilities are simple. Not complex attacks — just small assumptions: trusting inputs, overexposing APIs, logging too much. ------ We upgraded to **Java 25**. At first, it felt like a version upgrade. In reality, it meant: fixing vulnerabilities, updating dependencies, and cleaning up insecure code. Because upgrading versions alone doesn’t make systems secure. ------ Same with **Spring Boot**. New releases help — but also bring new changes, shifts, and sometimes new vulnerabilities. Keeping up is continuous, not one-time. ------ AI is also speeding things up. Code gets written faster. But insecure patterns can spread just as fast. Which makes reviewing and understanding code even more important. ------ One more thing I underestimated — logs. Tokens, headers, internal responses… easy to print, easy to forget, risky to keep. ------ Earlier I used to ask: “Does this work?” Now I ask: “Where can this be exposed?” ------ Still early in my journey, but this shift in thinking has mattered more than any tool or framework. ------ Would be interesting to hear — when did security become part of how you build, not just what you check? #Java #Java25 #ApplicationSecurity #CyberSecurity #SecureCoding #SpringBoot #BackendDevelopment #InfoSec #SoftwareEngineering #TechLearning
To view or add a comment, sign in
-
🚀 SpringBoot 🔐 Understanding Security in Web Applications Today I started learning one of the most important topics in backend development — Web Application Security 🚀💻 Every web application must protect critical information like 👇 ✅ User data ✅ Admin data ✅ Payments ✅ Sensitive business information 💡 What is Security? Security means protecting the application from unauthorized users and malicious access. It ensures that only the right users can access the right resources at the right time 🔒 ✨ Why this matters: A secure application protects customer trust, prevents data leaks, and keeps business systems safe. This is the foundation for learning Spring Security, authentication, authorization, JWT, and role-based access control 🔥 Excited to dive deeper into securing REST APIs next 🚀 #SpringBoot #WebSecurity #SpringSecurity #Java #BackendDevelopment #LearningJourney #10000 Coders
To view or add a comment, sign in
-
-
Day 6 of 15 -> Securing your application from scratch is a nightmare. Spring Security does it in minutes. Every application needs security. Authentication Authorization Password encryption Session management CSRF protection, the list never ends. Most developers who try to implement this from scratch spend weeks writing security logic, handling edge cases and debugging vulnerabilities. And even then, one small mistake can expose your entire application. Spring Security changes this completely. It is a powerful, battle tested security framework built right into the Spring ecosystem. You do not build security from scratch. You configure what you need and Spring Security handles the rest. Out of the box you get: ✅ Authentication ✅ Authorization ✅ Password encryption with BCrypt ✅ Session management ✅ CSRF protection ✅ OAuth2 and JWT support ✅ RBAC @Configuration @EnableWebSecurity public class SecurityConfig { @Bean public SecurityFilterChain filterChain(HttpSecurity http) throws Exception { http .authorizeHttpRequests(auth -> auth .requestMatchers("/admin").hasRole("ADMIN") .anyRequest().authenticated() ) .formLogin(); return http.build(); } } A few lines of configuration and your entire application is secured. Certain routes locked to specific roles. Everything else requiring authentication. No custom security logic. No reinventing the wheel. This is what makes Spring Security the gold standard for securing Java applications. Enterprise grade security, available to everyone #SpringBoot #Java #15DayChallenge #SpringSecurity #Authentication #Authorization #BackendDevelopment #JavaDevelopment #LearnToCode
To view or add a comment, sign in
-
-
💡 𝗝𝗮𝘃𝗮/𝐒𝐩𝐫𝐢𝐧𝐠 𝐁𝐨𝐨𝐭 𝗧𝗶𝗽 - 𝗥𝗮𝘁𝗲 𝗟𝗶𝗺𝗶𝘁𝗶𝗻𝗴 🔥 💎 𝗥𝗮𝘁𝗲 𝗟𝗶𝗺𝗶𝘁𝗶𝗻𝗴 𝘄𝗶𝘁𝗵 𝗕𝘂𝗰𝗸𝗲𝘁𝟰𝗷 Did you know Spring Boot supports powerful rate limiting with Bucket4j? Protect your APIs with just a few lines of code. ✅ 𝗪𝗵𝘆 𝗜𝘁 𝗠𝗮𝘁𝘁𝗲𝗿𝘀 Rate limiting protects your APIs from abuse, DDOS attacks, and excessive resource consumption. Bucket4j provides a flexible token bucket algorithm that ensures fair usage and prevents brute-force attempts on sensitive endpoints. ⚡ 𝗧𝘄𝗼 𝗜𝗺𝗽𝗹𝗲𝗺𝗲𝗻𝘁𝗮𝘁𝗶𝗼𝗻 𝗔𝗽𝗽𝗿𝗼𝗮𝗰𝗵𝗲𝘀 ◾ 𝐏𝐫𝐨𝐠𝐫𝐚𝐦𝐦𝐚𝐭𝐢𝐜 𝐀𝐏𝐈 with Bucket4j core library for fine-grained control. ◾ 𝐃𝐞𝐜𝐥𝐚𝐫𝐚𝐭𝐢𝐯𝐞 𝐜𝐨𝐧𝐟𝐢𝐠𝐮𝐫𝐚𝐭𝐢𝐨𝐧 using Spring Boot Starter for rapid setup. ◾ Both support multiple bandwidth limits and custom rejection handlers. ◾ Easy integration with Spring Security and custom filters. 🔥 𝗞𝗲𝘆 𝗙𝗲𝗮𝘁𝘂𝗿𝗲𝘀 𝗼𝗳 𝗕𝘂𝗰𝗸𝗲𝘁𝟰𝗷 ◾ 𝗧𝗼𝗸𝗲𝗻 𝗕𝘂𝗰𝗸𝗲𝘁 𝗔𝗹𝗴𝗼𝗿𝗶𝘁𝗵𝗺: Allows controlled bursts while maintaining average rate. ◾ 𝗜𝗻-𝗠𝗲𝗺𝗼𝗿𝘆 & 𝗗𝗶𝘀𝘁𝗿𝗶𝗯𝘂𝘁𝗲𝗱: Works standalone or with Redis/Hazelcast for multi-server deployments. ◾ 𝗦𝗽𝗿𝗶𝗻𝗴 𝗕𝗼𝗼𝘁 𝗦𝘁𝗮𝗿𝘁𝗲𝗿: Configuration-based setup with YAML, no boilerplate code. ◾ 𝗙𝗹𝗲𝘅𝗶𝗯𝗹𝗲 𝗣𝗮𝗿𝘁𝗶𝘁𝗶𝗼𝗻𝗶𝗻𝗴: Per-endpoint, IP-based, or user-based rate limiting. 🤔 𝗪𝗵𝗶𝗰𝗵 𝗮𝗽𝗽𝗿𝗼𝗮𝗰𝗵 𝗱𝗼 𝘆𝗼𝘂 𝘂𝘀𝗲 𝗳𝗼𝗿 𝗿𝗮𝘁𝗲 𝗹𝗶𝗺𝗶𝘁𝗶𝗻𝗴? #java #springboot #programming #softwareengineering #softwaredevelopment
To view or add a comment, sign in
-
-
🚀 Leveling Up: Understanding Base64 Encoding in Java I’ve been diving into data handling recently and just implemented a classic: Base64 Encoding and Decoding. While it might look like a "secret code," Base64 isn't actually encryption—it’s encoding. It transforms binary data into a readable string format (A-Z, a-z, 0-9, +, /). 💡 Why is this important in real-world projects? In modern development, we use Base64 more often than you might think: API Communications: Sending images or documents via JSON. Authentication: Basic Auth headers often use Base64 to pass credentials. Data Integrity: It ensures that data remains intact when being sent across systems that might otherwise struggle with special characters or binary files. 🔐 The Road Ahead This is a fantastic basic building block. It's the first step toward understanding how data is transformed. However, for actual security, we move toward true Encryption/Decryption methods (like AES or RSA) which involve secret keys and much higher levels of protection. Grateful for the progress today! Onwards to more complex security implementations! 💻✨ #Java #CodingJourney #Base64 #BackendDevelopment #SoftwareEngineering #LearningNeverStops
To view or add a comment, sign in
-
-
🚀 Day 8 of Learning Spring — Spring Security! Today I learned something that genuinely blew my mind 🤯 Just add ONE dependency — and Spring Boot automatically gives you: ✅ A Login Form ✅ Session Management ✅ Logout Functionality Zero extra code. Zero extra effort. That's the power of Spring Security 💥 --- 🛠️ How to set it up? 1️⃣ Go to start.spring.io 2️⃣ Create a new project and add 3 dependencies: • Spring Boot DevTools • Spring Security • Spring Web 3️⃣ Open the project in your IDE 4️⃣ Set your username & password in application.properties: spring.security.user.name=xyz spring.security.user.password=1234 5️⃣ Create a simple Controller, run the app — and your login form is ready! 💡 Pro Tip: If you don't set anything in application.properties, Spring auto-generates a random password in the console. The default username will be: user Learning this today made me realize — security doesn't have to be complex when you have the right framework 🙌 Github Reo : https://lnkd.in/g6bpXQrv #SpringBoot #SpringSecurity #Java #LearningInPublic #100DaysOfCode #JavaDeveloper #BackendDevelopment
To view or add a comment, sign in
Explore content categories
- Career
- Productivity
- Finance
- Soft Skills & Emotional Intelligence
- Project Management
- Education
- Technology
- Leadership
- Ecommerce
- User Experience
- Recruitment & HR
- Customer Experience
- Real Estate
- Marketing
- Sales
- Retail & Merchandising
- Science
- Supply Chain Management
- Future Of Work
- Consulting
- Writing
- Economics
- Artificial Intelligence
- Employee Experience
- Workplace Trends
- Fundraising
- Networking
- Corporate Social Responsibility
- Negotiation
- Communication
- Engineering
- Hospitality & Tourism
- Business Strategy
- Change Management
- Organizational Culture
- Design
- Innovation
- Event Planning
- Training & Development