изменила название папки и убрала лишние импорты

This commit is contained in:
Elena Ponomareva
2026-05-14 21:00:46 +03:00
committed by skettiks
parent 82a0cec1cc
commit aecf19aa11
9 changed files with 2 additions and 2 deletions
@@ -0,0 +1,42 @@
package com.project.movienight.adapters.security
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration
import org.springframework.security.config.annotation.web.builders.HttpSecurity
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity
import org.springframework.security.web.SecurityFilterChain
@Configuration
@EnableWebSecurity
class SecurityConfiguration(
private val customOAuth2UserService: CustomOAuth2UserService,
) {
@Bean
fun securityFilterChain(http: HttpSecurity): SecurityFilterChain {
http
.oauth2Login { oauth2 ->
oauth2
.userInfoEndpoint { userInfo ->
userInfo.userService(customOAuth2UserService)
}
.defaultSuccessUrl("/api/users/me", true)
}
.authorizeHttpRequests { auth ->
auth
.requestMatchers("/", "/login/**", "/oauth2/**", "/h2-console/**", "/actuator/health").permitAll()
.requestMatchers("/api/users/me").authenticated()
.requestMatchers("/api/**").authenticated()
.anyRequest().authenticated()
}
.headers { headers ->
headers.frameOptions { frameOptions ->
frameOptions.sameOrigin()
}
}
.csrf { csrf ->
csrf.disable()
}
return http.build()
}
}