Skip to content
Advertisement

.antMatchers(“/swagger-ui/**”).permitAll() error 405

I am impemeting swagger 3 in my APIREST but wne I try to access to this link http://localhost:8080/swagger-ui/, a 405 error shows up.

This is the code in my ConfigClass:

 protected void configure(HttpSecurity http) throws Exception {
         http
            .csrf().disable()
            .exceptionHandling()
            .authenticationEntryPoint(authenticationEntryPoint)
            .and()
            .sessionManagement()
            .sessionCreationPolicy(SessionCreationPolicy.STATELESS)
            .and()
            .authorizeRequests()
            .antMatchers(HttpMethod.GET, "/api/v1/**").permitAll()
            .antMatchers("/api/v1/auth/**").permitAll()

            .antMatchers("/swagger-ui/**").permitAll()
            .antMatchers("/swagger-resources/**").permitAll()
            .antMatchers("/swagger-ui.html").permitAll()
            .antMatchers("/webjars/**").permitAll()
            .anyRequest()
            .authenticated();
    http.addFilterBefore(jwtAuthenticationFilter(), UsernamePasswordAuthenticationFilter.class);
}

And this is the dependency in the POM.XML:

     <dependency>
        <groupId>io.springfox</groupId>
        <artifactId>springfox-boot-starter</artifactId>
        <version>3.0.0</version>
    </dependency>

Can someboyde help me, please?

Advertisement

Answer

You might be doing a PUT call for GET operation Please check once.

5 People found this is helpful
Advertisement