Skip to content

Commit

Permalink
Merge pull request #546 from IT-Academy-BCN/feature/#536
Browse files Browse the repository at this point in the history
bean to solve double slash on url
  • Loading branch information
jonatanvicente authored Mar 21, 2023
2 parents f8168fe + 6d25c36 commit bd22f53
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.businessassistantbcn.usermanagement.security.JwtAuthenticationFilter;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
Expand All @@ -13,6 +14,8 @@
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
import org.springframework.security.web.authentication.www.BasicAuthenticationEntryPoint;
import org.springframework.security.web.firewall.HttpFirewall;
import org.springframework.security.web.firewall.StrictHttpFirewall;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
Expand Down Expand Up @@ -59,4 +62,11 @@ public void commence(HttpServletRequest request, HttpServletResponse response,
});
}
}
//Controlar doble slash en peticiones a endpoints en ambos perfiles.
@Bean
public static HttpFirewall getHttpFirewall() {
StrictHttpFirewall strictHttpFirewall = new StrictHttpFirewall();
strictHttpFirewall.setAllowUrlEncodedDoubleSlash(true);
return strictHttpFirewall;
}
}

0 comments on commit bd22f53

Please sign in to comment.