Skip to content

Commit

Permalink
Cors update
Browse files Browse the repository at this point in the history
  • Loading branch information
Harsh-Srivastav123 committed Mar 14, 2024
1 parent a7b929e commit 13394e6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,11 @@ public class SecurityConfiguration {

@Bean
public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
http.cors(AbstractHttpConfigurer::disable).
http.cors(Customizer.withDefaults()).
csrf(AbstractHttpConfigurer::disable)
.authorizeHttpRequests(auth ->
auth.requestMatchers("/question/**","user/verifyRegistration","/user/createUser","/user/auth","user/test","/swagger-ui.html","/","/swagger-ui/**","/v3/api-docs/**","/bus/v3/api-docs/**","/post/**")

.permitAll()
.anyRequest()
.authenticated())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

import java.io.IOException;

import static java.rmi.server.LogStream.log;

@Slf4j
public class GatewayFilter extends OncePerRequestFilter {

Expand All @@ -29,9 +31,12 @@ protected void doFilterInternal(
HttpServletRequest request, HttpServletResponse response, FilterChain filterChain)
throws ServletException, IOException {
try {
log.info(request.getHeader("Origin"));
log.info(request.getMethod());
// android.util.Log.i(TAG, "doFilterInternal: ");(request.getHeader("origin").toString());
filterChain.doFilter(request, response);
} catch (Exception e) {
log.error("Spring Security Filter Chain Exception:", e);
GatewayFilter.log.error("Spring Security Filter Chain Exception:", e);
resolver.resolveException(request, response, null, e);
}
}
Expand Down

0 comments on commit 13394e6

Please sign in to comment.