diff --git a/spring-security-rest/src/main/java/org/baeldung/spring/SecurityJavaConfig.java b/spring-security-rest/src/main/java/org/baeldung/spring/SecurityJavaConfig.java index 23c8155491..3302482f48 100644 --- a/spring-security-rest/src/main/java/org/baeldung/spring/SecurityJavaConfig.java +++ b/spring-security-rest/src/main/java/org/baeldung/spring/SecurityJavaConfig.java @@ -44,7 +44,7 @@ public class SecurityJavaConfig extends WebSecurityConfigurerAdapter { .authorizeRequests() .antMatchers("/api/csrfAttacker*").permitAll() .antMatchers("/api/customer/**").permitAll() - .antMatchers("/api/**").authenticated() + .antMatchers("/api/foos/**").authenticated() .and() .formLogin() .successHandler(authenticationSuccessHandler) diff --git a/spring-security-rest/src/test/java/org/baeldung/web/SwaggerLiveTest.java b/spring-security-rest/src/test/java/org/baeldung/web/SwaggerLiveTest.java new file mode 100644 index 0000000000..792b3e28ce --- /dev/null +++ b/spring-security-rest/src/test/java/org/baeldung/web/SwaggerLiveTest.java @@ -0,0 +1,20 @@ +package org.baeldung.web; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; + +import com.jayway.restassured.RestAssured; +import com.jayway.restassured.response.Response; + +public class SwaggerLiveTest { + private static final String URL_PREFIX = "http://localhost:8080/spring-security-rest/api"; + + @Test + public void whenVerifySpringFoxIsWorking_thenOK() { + final Response response = RestAssured.get(URL_PREFIX + "/v2/api-docs"); + assertEquals(200, response.statusCode()); + System.out.println(response.asString()); + + } +}