Package org.localify.common.config.v1
Class ApiHttpConfig
java.lang.Object
org.localify.common.config.v1.ApiHttpConfig
@Configuration
@ConditionalOnWebApplication
@EnableMethodSecurity(securedEnabled=true,
jsr250Enabled=true)
public class ApiHttpConfig
extends Object
Configuration for the API's HTTP security.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.security.authentication.AuthenticationManagerauthManager(org.springframework.security.config.annotation.web.builders.HttpSecurity http, JwtAuthenticationProvider jwtProvider) Creates an authentication manager.org.springframework.security.web.SecurityFilterChaindefaultSecurityFilterChain(org.springframework.security.config.annotation.web.builders.HttpSecurity http, JwtAuthenticationFilter jwtAuthenticationFilter, JwtAuthenticationProvider jwtAuthenticationProvider) Configures the default security filter chain.jwtAuthenticationFilter(org.springframework.security.authentication.AuthenticationManager authManager) Creates a JWT authentication filter.jwtAuthenticationProvider(JwtService jwtService) Creates a JWT authentication provider.jwtService(LocalifyProperties props, RefreshTokenRepository refreshTokenRepository, jakarta.persistence.EntityManager entityManager, jakarta.servlet.http.HttpServletRequest request) Creates a JWT service.
-
Constructor Details
-
ApiHttpConfig
public ApiHttpConfig()
-
-
Method Details
-
authManager
@Bean public org.springframework.security.authentication.AuthenticationManager authManager(org.springframework.security.config.annotation.web.builders.HttpSecurity http, JwtAuthenticationProvider jwtProvider) throws Exception Creates an authentication manager.- Parameters:
http- The HttpSecurity object.jwtProvider- The JWT authentication provider.- Returns:
- The authentication manager.
- Throws:
Exception- If an error occurs.
-
jwtAuthenticationProvider
Creates a JWT authentication provider.- Parameters:
jwtService- The JWT service.- Returns:
- The JWT authentication provider.
-
jwtService
@Bean public JwtService jwtService(LocalifyProperties props, RefreshTokenRepository refreshTokenRepository, jakarta.persistence.EntityManager entityManager, jakarta.servlet.http.HttpServletRequest request) Creates a JWT service.- Parameters:
props- The application properties.refreshTokenRepository- The refresh token repository.entityManager- The entity manager.request- The HTTP servlet request.- Returns:
- The JWT service.
-
jwtAuthenticationFilter
@Bean public JwtAuthenticationFilter jwtAuthenticationFilter(org.springframework.security.authentication.AuthenticationManager authManager) Creates a JWT authentication filter.- Parameters:
authManager- The authentication manager.- Returns:
- The JWT authentication filter.
-
defaultSecurityFilterChain
@Bean @Order(-2147483648) public org.springframework.security.web.SecurityFilterChain defaultSecurityFilterChain(org.springframework.security.config.annotation.web.builders.HttpSecurity http, JwtAuthenticationFilter jwtAuthenticationFilter, JwtAuthenticationProvider jwtAuthenticationProvider) throws Exception Configures the default security filter chain.- Parameters:
http- The HttpSecurity object.jwtAuthenticationFilter- The JWT authentication filter.jwtAuthenticationProvider- The JWT authentication provider.- Returns:
- The security filter chain.
- Throws:
Exception- If an error occurs.
-