Package com.bank.auth_service.config
Class SecurityConfig
java.lang.Object
com.bank.auth_service.config.SecurityConfig
Configuration class for Spring Security.
This class defines the security filter chain and password encoder for the application.
- Since:
- 1.0.0
- Version:
- 1.0.0, 06/23/2025
- Author:
- Fernando Cruz Cavina
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.security.crypto.bcrypt.BCryptPasswordEncoder
Encodes passwords using BCrypt hashing algorithm.org.springframework.security.web.SecurityFilterChain
securityFilterChain
(org.springframework.security.config.annotation.web.builders.HttpSecurity http) Permits all requests to the /auth/** endpoints and requires authentication for all other requests.
-
Constructor Details
-
SecurityConfig
public SecurityConfig()
-
-
Method Details
-
securityFilterChain
@Bean public org.springframework.security.web.SecurityFilterChain securityFilterChain(org.springframework.security.config.annotation.web.builders.HttpSecurity http) throws Exception Permits all requests to the /auth/** endpoints and requires authentication for all other requests. In future, this configuration can be extended to include more complex security rules.- Parameters:
http
- the HttpSecurity object used to configure security settings- Returns:
- a SecurityFilterChain that defines the security rules for the application
- Throws:
Exception
-
passwordEncoder
@Bean public org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder passwordEncoder()Encodes passwords using BCrypt hashing algorithm. This bean is used to hash passwords before storing them in the database. It provides a secure way to handle user passwords by applying a strong hashing algorithm.- Returns:
- a BCryptPasswordEncoder instance
-