From 1a30ac33743a426b85810423d53d1fdc183cf44f Mon Sep 17 00:00:00 2001 From: BuildTools Date: Wed, 4 Nov 2020 15:06:24 +0100 Subject: [PATCH] Works json endpoint ui dont --- buisnesslogic/pom.xml | 4 ++-- restservice/pom.xml | 21 +++++++++++++++++-- .../src/main/java/com/plannaplan/App.java | 9 ++++++++ .../security/WebSecurityConfig.java | 5 ++++- 4 files changed, 34 insertions(+), 5 deletions(-) diff --git a/buisnesslogic/pom.xml b/buisnesslogic/pom.xml index 73b3b1d..2c6b9cb 100755 --- a/buisnesslogic/pom.xml +++ b/buisnesslogic/pom.xml @@ -16,8 +16,8 @@ UTF-8 - 1.14 - 1.14 + 14 + 14 diff --git a/restservice/pom.xml b/restservice/pom.xml index 68b7c09..60714c1 100755 --- a/restservice/pom.xml +++ b/restservice/pom.xml @@ -18,9 +18,10 @@ UTF-8 - 1.14 - 1.14 + 14 + 14 com.plannaplan.App + 2.9.2 @@ -85,6 +86,22 @@ com.plannaplan 1.0-SNAPSHOT + + + + io.springfox + springfox-swagger2 + ${swagger.version} + + + + + io.springfox + springfox-swagger-ui + ${swagger.version} + + + diff --git a/restservice/src/main/java/com/plannaplan/App.java b/restservice/src/main/java/com/plannaplan/App.java index 0a789c9..a929f6d 100755 --- a/restservice/src/main/java/com/plannaplan/App.java +++ b/restservice/src/main/java/com/plannaplan/App.java @@ -8,9 +8,18 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.context.event.ApplicationReadyEvent; +import org.springframework.context.annotation.Configuration; import org.springframework.context.event.EventListener; +import org.springframework.web.servlet.config.annotation.EnableWebMvc; + +import springfox.documentation.swagger2.annotations.EnableSwagger2; + +import org.springframework.web.servlet.DispatcherServlet; @SpringBootApplication +@Configuration +@EnableSwagger2 +@EnableWebMvc public class App { public final static String API_VERSION = "v1"; diff --git a/restservice/src/main/java/com/plannaplan/security/WebSecurityConfig.java b/restservice/src/main/java/com/plannaplan/security/WebSecurityConfig.java index 4993630..6fb5b50 100755 --- a/restservice/src/main/java/com/plannaplan/security/WebSecurityConfig.java +++ b/restservice/src/main/java/com/plannaplan/security/WebSecurityConfig.java @@ -12,12 +12,14 @@ import org.springframework.security.web.AuthenticationEntryPoint; import org.springframework.security.web.util.matcher.AntPathRequestMatcher; import org.springframework.security.web.util.matcher.OrRequestMatcher; import org.springframework.security.web.util.matcher.RequestMatcher; +import org.springframework.web.servlet.config.annotation.EnableWebMvc; import org.springframework.http.HttpStatus; import org.springframework.security.web.authentication.AnonymousAuthenticationFilter; import org.springframework.security.web.authentication.HttpStatusEntryPoint; @Configuration @EnableWebSecurity + public class WebSecurityConfig extends WebSecurityConfigurerAdapter { private static final RequestMatcher PROTECTED_URLS = new OrRequestMatcher(new AntPathRequestMatcher("/api/**")); @@ -37,7 +39,8 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter { @Override public void configure(final WebSecurity webSecurity) { webSecurity.ignoring().antMatchers("/token**").antMatchers("/api/v1/courses/all") - .antMatchers("/api/v1/groups/course/{id}"); + .antMatchers("/api/v1/groups/course/{id}").antMatchers("/v2/api-docs", "/configuration/ui", + "/swagger-resources/**", "/configuration/security", "/swagger-ui.html", "/webjars/**"); } @Override