Skip to content

Commit

Permalink
update :: update securityConfig
Browse files Browse the repository at this point in the history
  • Loading branch information
4mjeo committed Mar 9, 2024
1 parent 2fca1f6 commit 09eea28
Showing 1 changed file with 3 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package com.example.v1oauthauthorizationservice.infrastructure.configuration.sec
import com.example.v1oauthauthorizationservice.global.config.filter.FilterConfig
import com.example.v1oauthauthorizationservice.global.config.jwt.JwtTokenResolver
import com.example.v1oauthauthorizationservice.global.config.jwt.TokenProvider
import com.example.v1oauthauthorizationservice.infrastructure.configuration.AuthenticationFilter
import com.example.v1oauthauthorizationservice.infrastructure.configuration.exception.filter.ExceptionHandlerFilter
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration
Expand All @@ -16,20 +15,15 @@ import org.springframework.security.config.http.SessionCreationPolicy
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder
import org.springframework.security.crypto.password.PasswordEncoder
import org.springframework.security.web.SecurityFilterChain
import org.springframework.security.web.access.intercept.AuthorizationFilter

@EnableWebSecurity(debug = true)
@Configuration
class SecurityConfiguration(
private val authenticationFilter: AuthenticationFilter,
private val tokenProvider: TokenProvider,
private val tokenResolver: JwtTokenResolver,
private val exceptionHandlerFilter: ExceptionHandlerFilter
) {

@Bean
fun passwordEncoder(): PasswordEncoder = BCryptPasswordEncoder()

@Bean
@Order(Ordered.HIGHEST_PRECEDENCE)
fun securityFilterChain(
Expand All @@ -47,8 +41,6 @@ class SecurityConfiguration(
.sessionManagement()
.sessionCreationPolicy(SessionCreationPolicy.STATELESS).and()

httpSecurity.addFilterBefore(authenticationFilter, AuthorizationFilter::class.java)

httpSecurity
.authorizeHttpRequests { authorize ->
authorize
Expand All @@ -73,4 +65,7 @@ class SecurityConfiguration(

return httpSecurity.build()
}

@Bean
fun passwordEncoder(): PasswordEncoder = BCryptPasswordEncoder()
}

0 comments on commit 09eea28

Please sign in to comment.