This article explains how to implement role‑based access control in Spring Security by embedding roles into UserDetails, configuring HttpSecurity with hasRole/hasAnyRole/hasAuthority, handling anonymous users, and using permitAll, providing code examples and detailed explanations for each approach.
This article explains why Role‑Based Access Control (RBAC) is essential for modern applications, outlines the four RBAC model variants (RBAC0‑RBAC3), clarifies core concepts such as users, roles, sessions and permissions, and shows how RBAC improves scalability and security in Spring Security projects.
This article explains the different exception types in Spring Security, how HTTP status codes map to authentication and authorization failures, and provides concrete implementations of AuthenticationEntryPoint and AccessDeniedHandler that return JSON responses, along with configuration tips for integrating them into a Spring Boot application.
This article walks through the inner workings of Spring Security after login, explains session and token based authentication, and provides step‑by‑step guidance on customizing logout logic with LogoutFilter, LogoutConfigurer, and custom LogoutHandler and LogoutSuccessHandler implementations in Java.
This article explains Spring Security 5.2's Lambda DSL enhancements, compares lambda‑based and traditional configurations for HttpSecurity and ServerHttpSecurity, shows equivalent code samples, highlights default behaviors, and demonstrates the same approach for Spring Security WebFlux.
This article walks through customizing Spring Security in a Spring Boot application by creating a custom security configuration class, overriding authentication manager, web security, and HttpSecurity methods, and explains the default and common HttpSecurity settings with code examples.
This article explains the Ant‑style path matching syntax, its wildcards ?, *, **, the longest‑match rule, and demonstrates how to apply these patterns in Spring MVC controller mappings and Spring Security antMatchers for precise URI access control.
This article explores how Spring Security is automatically configured in Spring Boot, detailing key auto‑configuration classes such as SecurityAutoConfiguration, SpringBootWebSecurityConfiguration, WebSecurityEnablerConfiguration, and the @EnableWebSecurity annotation, while providing code snippets and explanations of their roles in the security filter chain.
This tutorial explains how to integrate JWT with Spring Security so that a successful login returns a JWT token instead of a page redirect, covering the authentication flow, custom success and failure handlers, configuration steps, and verification of the returned JSON responses.
This guide walks through integrating Spring Security with Spring Boot, explains the UserDetailsServiceAutoConfiguration, demonstrates how to customize UserDetailsManager using in‑memory storage, and shows how to extend it for database‑backed user management, providing complete code examples and practical insights.
This article compares Spring Security and Apache Shiro, explaining their authentication and authorization features, filter‑chain mechanisms, RBAC model, and related security concepts to help Java developers choose the right framework for production‑grade web applications.
This article explains how to achieve consistent OAuth2 token handling across multiple clients and tenants by customizing the token key generation, overriding DefaultTokenServices logic, and configuring a RedisTokenStore with a custom AuthenticationKeyGenerator in a Spring Boot application.
This tutorial walks through setting up Spring Boot Admin as a monitoring server and client, integrating it with Eureka for service discovery, adding Spring Security for authentication, and configuring email and custom notifications, complete with Maven and YAML configurations and Java code examples.
This tutorial walks you through building a lightweight OAuth2 authentication server using Spring Cloud Hoxton, covering required dependencies, web security configuration, client details, grant types, testing with the password flow, and key insights on Spring Security password handling.
Learn how to quickly set up an OAuth2 authentication server using Spring Cloud Hoxton, including Maven dependencies, web security configuration, client details, and password‑grant testing, while also covering Spring Security’s {noop} password handling and providing useful code snippets for developers.
This tutorial shows how to integrate Spring Security and JWT into a Spring Boot backend to implement user login and authorization, configure Swagger‑UI to automatically include the token, and provides all necessary code snippets, configuration files, and utility classes for a complete authentication solution.
This article walks through Spring Security OAuth's core classes, explaining how the TokenEndpoint processes /oauth/token requests, validates client details, builds TokenRequests, delegates to TokenGranters, and ultimately generates and returns an OAuth2 access token.
This article explains how to customize the default OAuth2 check‑token flow in Spring Cloud by extending the token converter to assemble complete user information—including IDs, department and tenant data—directly into the security context, eliminating extra database queries and improving performance.
This article explains how to protect Spring Cloud microservices using OAuth2 by configuring an API gateway, an authorization server, and a simple account service, providing a complete token‑based security solution with code examples and testing instructions.
This tutorial walks through a complete Spring Boot demo that sets up Maven dependencies, creates Thymeleaf front‑end pages (home, login, hello), implements a main Application class, a HomeController, and a WebSecurityConfig to secure the application with in‑memory authentication, illustrating how to protect URLs, configure a custom login page, and enable logout functionality.
This guide explains how to create a custom Spring Security filter, extend GenericFilterBean, and precisely position it within the default filter chain using HttpSecurity’s addFilterBefore, addFilterAfter, or addFilterAt methods, complete with code examples and configuration steps.
This guide shows how to combine Spring Security and MyBatis to implement username‑password authentication backed by a MariaDB database, covering repository cloning, database setup, Maven execution, and a deep dive into the underlying authentication filter and provider classes with code examples.
This tutorial walks you through setting up a Spring Boot project with Spring Security, explains the @EnableWebSecurity annotation, shows how to extend WebSecurityConfigurerAdapter, demonstrates overriding configure(AuthenticationManagerBuilder) and configure(HttpSecurity) methods with concrete code examples, and provides a concise reference table of common HttpSecurity methods.
This guide provides a deep dive into Spring Security's architecture, explaining how authentication and authorization are separated, how the AuthenticationManager and AccessDecisionManager work, how web filter chains are organized, and how to apply method‑level security and thread‑local context handling in Java applications.
This weekend roundup compiles essential Spring Boot, Spring Cloud, and Spring Security articles—including quick starts, deep‑dive tutorials, microservice patterns, API‑gateway tips, and OAuth2 guides—providing developers a convenient reference list to enhance their Java backend expertise.
This article presents a collection of straightforward, developer‑friendly techniques for enhancing Java API security and performance, covering API key protection, TLS adoption, Spring Boot web service creation, application monitoring, and safeguarding sensitive configuration files.
This article breaks down Spring Security’s three core Java configuration components—@EnableWebSecurity, WebSecurityConfiguration, and AuthenticationConfiguration—explaining how they replace XML setup, register the security filter chain, build the AuthenticationManager, and enable fine‑grained HttpSecurity rules such as path protection, form login, logout, CSRF, and security headers.
This article breaks down the internal workflow of Spring Security’s @EnableResourceServer, explaining how OAuth2 tokens are extracted, validated, and turned into authentication objects through ResourceServerSecurityConfigurer, OAuth2AuthenticationProcessingFilter, OAuth2AuthenticationManager, and related components.
This article walks through building a Spring Boot application that protects HTTP endpoints using OAuth2, covering password and client‑credentials flows, Maven setup, resource and authorization server configuration, in‑memory users, token retrieval, and accessing secured resources with detailed code examples.