A Spring Boot project that demonstrates the internal authentication flow of Spring Security and how requests pass through the security infrastructure before accessing protected resources.
This project was built as part of learning Spring Security fundamentals and understanding how authentication works internally inside the framework.
- Spring Boot REST application
- Spring Security authentication flow
- Demonstrates security filters chain
- AuthenticationManager & AuthenticationProvider
- UserDetailsService implementation
- Password encoding mechanism
- Colored logging configuration for better debugging
| Technology | Description |
|---|---|
| Java 17 | Programming Language |
| Spring Boot | Backend Framework |
| Spring Security | Authentication & Authorization |
| Spring MVC | Web layer |
| Maven | Dependency Management |
| IntelliJ IDEA | Development Environment |
src
└─ main
├─ java
│ └─ com.sp.secu
│ ├─ controller
│ │ └─ HomeController.java
│ │
│ └─ EazyBankApplication.java
│
└─ resources
├─ static
├─ templates
└─ application.properties
The diagram below illustrates how Spring Security processes authentication internally.
-
The Client sends a request with credentials.
-
The request enters the Spring Security Filter Chain.
-
The AuthenticationManager receives the authentication request.
-
The AuthenticationProvider validates the credentials.
-
The UserDetailsService loads the user information.
-
The PasswordEncoder verifies the password.
-
If authentication succeeds:
- A SecurityContext is created
- The user gains access to protected endpoints.
-
If authentication fails:
- The system returns 401 Unauthorized or 403 Forbidden.
The project uses custom logging patterns to improve debugging visibility during development.
Example configuration:
logging.pattern.console=%green(%d{yyyy-MM-dd HH:mm:ss.SSS}) %highlight(%-5level) %cyan(%logger{36}) %yellow([%thread]) - %msg%n
logging.level.root=DEBUG
logging.level.org.springframework=DEBUG
logging.level.org.springframework.web=DEBUG
logging.level.org.hibernate=DEBUG
logging.level.com.sp=DEBUG
spring.output.ansi.enabled=always
This configuration provides:
- colored logs
- visible errors
- detailed debugging information
- better development experience
git clone https://github.com/your-username/eazybank-security.git
cd eazybank-security
mvn spring-boot:run
Run the main class:
EazyBankApplication.java
This project helps understand:
- Spring Security architecture
- Authentication flow
- Security filter chain
- AuthenticationManager & AuthenticationProvider
- UserDetailsService
- Password encoding
Possible enhancements:
- JWT authentication
- Role-based authorization
- Database user authentication
- Custom login API
- Exception handling for security
Built for learning and practicing Spring Security concepts and backend security fundamentals in Spring Boot.
⭐ If you found this project helpful, consider giving it a star on GitHub.
