You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've already integrated Spring Security 6 and Spring Boot 3 into my service, which is currently functioning properly. However, I'm now facing an issue while trying to incorporate Swagger-UI. Despite configuring both Swagger and Spring Security, I'm unable to access the specific URL "http://localhost:8082/swagger-ui.html". Whenever I attempt to visit this URL, I encounter an error message stating "You don't have authorization to view this page" (HTTP ERROR 403). Additionally, I've configured Spring Security as follows:
Despite including the particular configuration ".requestMatchers("/swagger-ui.html").permitAll()", I'm still unable to access the URL. If anyone is interested in assisting, please let me know, and I can provide further details about my project.
Thank you so much !!
The text was updated successfully, but these errors were encountered:
I've already integrated Spring Security 6 and Spring Boot 3 into my service, which is currently functioning properly. However, I'm now facing an issue while trying to incorporate Swagger-UI. Despite configuring both Swagger and Spring Security, I'm unable to access the specific URL "http://localhost:8082/swagger-ui.html". Whenever I attempt to visit this URL, I encounter an error message stating "You don't have authorization to view this page" (HTTP ERROR 403). Additionally, I've configured Spring Security as follows:
@bean
public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception {
http
.csrf(AbstractHttpConfigurer::disable)
.cors(AbstractHttpConfigurer::disable)
.exceptionHandling()
.accessDeniedHandler(customAccessDeniedHandler)
.and()
.sessionManagement(session -> session.sessionCreationPolicy(SessionCreationPolicy.STATELESS))
.authorizeHttpRequests((requests) -> requests
.requestMatchers("/swagger-ui.html").permitAll()
.requestMatchers("/admin/").hasRole("ADMIN")
.requestMatchers("/user/").hasRole("USER")
.anyRequest()
.authenticated());
http.addFilterBefore(filter, UsernamePasswordAuthenticationFilter.class);
return http.build();
}
Despite including the particular configuration ".requestMatchers("/swagger-ui.html").permitAll()", I'm still unable to access the URL. If anyone is interested in assisting, please let me know, and I can provide further details about my project.
Thank you so much !!
The text was updated successfully, but these errors were encountered: