Skip to content

Commit

Permalink
zmiana reguły firewalla
Browse files Browse the repository at this point in the history
  • Loading branch information
JanisBe committed Apr 16, 2024
1 parent 485db78 commit 6556de5
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 7 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
/src/main/frontend/.vscode/
/src/main/frontend/node_modules/
/target/
/src/main/resources/frontend/
/src/main/resources/static/
/src/main/resources/application-secrets.properties
/backend/target/
/node/
/frontend/bin/
/frontend/node/
/.idea/
/.jpb/**

pom.xml.versionsBackup
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
Expand Down
3 changes: 2 additions & 1 deletion src/main/frontend/src/environments/environment.prod.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export const environment = {
production: true,
API_URL: 'http://130.61.100.99:8080/'
API_URL: 'http://localhost:8080'
// API_URL: 'http://130.61.100.99:8080'
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import org.springframework.security.web.csrf.CsrfTokenRepository;
import org.springframework.security.web.csrf.CsrfTokenRequestHandler;
import org.springframework.security.web.csrf.DeferredCsrfToken;
import pl.janis.komornik.filter.MyCsrfTokenRequestHandler;

public class MyAuthenticationStrategy implements
SessionAuthenticationStrategy {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package pl.janis.komornik.filter;
package pl.janis.komornik.config;

import jakarta.servlet.http.Cookie;
import jakarta.servlet.http.HttpServletRequest;
Expand Down
12 changes: 10 additions & 2 deletions src/main/java/pl/janis/komornik/config/SecurityConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import org.springframework.security.config.annotation.authentication.configuration.AuthenticationConfiguration;
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.configuration.WebSecurityCustomizer;
import org.springframework.security.config.annotation.web.configurers.HeadersConfigurer.FrameOptionsConfig;
import org.springframework.security.config.http.SessionCreationPolicy;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
Expand All @@ -19,10 +20,10 @@
import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
import org.springframework.security.web.csrf.CookieCsrfTokenRepository;
import org.springframework.security.web.csrf.CsrfTokenRepository;
import org.springframework.security.web.firewall.StrictHttpFirewall;
import org.springframework.security.web.header.writers.XXssProtectionHeaderWriter;
import org.springframework.web.cors.CorsConfiguration;
import pl.janis.komornik.filter.CsrfCookieFilter;
import pl.janis.komornik.filter.MyCsrfTokenRequestHandler;
import pl.janis.komornik.service.UserService;

import java.util.Collections;
Expand Down Expand Up @@ -64,7 +65,7 @@ public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Excepti
auth.requestMatchers("/csrf").permitAll();
auth.requestMatchers(
HttpMethod.GET,
"/index*", "/static/**", "/*.js", "/*.css", "/*.json", "/*.ico")
"/index*", "/assets/**", "/*.js", "/*.css", "/*.json", "/*.ico")
.permitAll();
auth.requestMatchers(HttpMethod.OPTIONS).permitAll();
auth.anyRequest().authenticated();
Expand Down Expand Up @@ -102,4 +103,11 @@ public PasswordEncoder passwordEncoder() {
public AuthenticationManager authenticationManager(AuthenticationConfiguration authConfig) throws Exception {
return authConfig.getAuthenticationManager();
}

@Bean
public WebSecurityCustomizer webSecurityCustomizer() {
StrictHttpFirewall firewall = new StrictHttpFirewall();
firewall.setAllowBackSlash(true);
return (web) -> web.httpFirewall(firewall);
}
}

0 comments on commit 6556de5

Please sign in to comment.