Skip to content

Commit

Permalink
Improve web security
Browse files Browse the repository at this point in the history
  • Loading branch information
Nikita Pavlovskiy committed Aug 23, 2023
1 parent 376c7c3 commit 951d05e
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import org.springframework.security.config.Customizer;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configurers.HeadersConfigurer.FrameOptionsConfig;
import org.springframework.security.oauth2.server.resource.authentication.JwtAuthenticationConverter;
import org.springframework.security.oauth2.server.resource.authentication.JwtGrantedAuthoritiesConverter;
import org.springframework.security.web.SecurityFilterChain;
Expand All @@ -22,7 +23,8 @@ public class WebSecurityConfig {
public SecurityFilterChain filterChain(HttpSecurity http, MvcRequestMatcher.Builder mvc)
throws Exception {
http
.cors(Customizer.withDefaults())
.cors(Customizer.withDefaults()) //for h2
.headers(headers -> headers.frameOptions(FrameOptionsConfig::sameOrigin)) //for h2
.csrf(csrf -> csrf.disable())
.authorizeHttpRequests(requests -> {
requests
Expand Down

0 comments on commit 951d05e

Please sign in to comment.