Works json endpoint ui dont

This commit is contained in:
BuildTools 2020-11-04 15:06:24 +01:00
parent 1571bccb49
commit 1a30ac3374
4 changed files with 34 additions and 5 deletions

View File

@ -16,8 +16,8 @@
<properties> <properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.14</maven.compiler.source> <maven.compiler.source>14</maven.compiler.source>
<maven.compiler.target>1.14</maven.compiler.target> <maven.compiler.target>14</maven.compiler.target>
</properties> </properties>
<dependencies> <dependencies>

View File

@ -18,9 +18,10 @@
<properties> <properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.14</maven.compiler.source> <maven.compiler.source>14</maven.compiler.source>
<maven.compiler.target>1.14</maven.compiler.target> <maven.compiler.target>14</maven.compiler.target>
<start-class>com.plannaplan.App</start-class> <start-class>com.plannaplan.App</start-class>
<swagger.version>2.9.2</swagger.version>
</properties> </properties>
<dependencies> <dependencies>
@ -85,6 +86,22 @@
<groupId>com.plannaplan</groupId> <groupId>com.plannaplan</groupId>
<version>1.0-SNAPSHOT</version> <version>1.0-SNAPSHOT</version>
</dependency> </dependency>
<!-- https://mvnrepository.com/artifact/io.springfox/springfox-swagger2 -->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>${swagger.version}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/io.springfox/springfox-swagger-ui -->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>${swagger.version}</version>
</dependency>
</dependencies> </dependencies>
<build> <build>

View File

@ -8,9 +8,18 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.event.ApplicationReadyEvent; import org.springframework.boot.context.event.ApplicationReadyEvent;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.event.EventListener; 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 @SpringBootApplication
@Configuration
@EnableSwagger2
@EnableWebMvc
public class App { public class App {
public final static String API_VERSION = "v1"; public final static String API_VERSION = "v1";

View File

@ -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.AntPathRequestMatcher;
import org.springframework.security.web.util.matcher.OrRequestMatcher; import org.springframework.security.web.util.matcher.OrRequestMatcher;
import org.springframework.security.web.util.matcher.RequestMatcher; import org.springframework.security.web.util.matcher.RequestMatcher;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.security.web.authentication.AnonymousAuthenticationFilter; import org.springframework.security.web.authentication.AnonymousAuthenticationFilter;
import org.springframework.security.web.authentication.HttpStatusEntryPoint; import org.springframework.security.web.authentication.HttpStatusEntryPoint;
@Configuration @Configuration
@EnableWebSecurity @EnableWebSecurity
public class WebSecurityConfig extends WebSecurityConfigurerAdapter { public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
private static final RequestMatcher PROTECTED_URLS = new OrRequestMatcher(new AntPathRequestMatcher("/api/**")); private static final RequestMatcher PROTECTED_URLS = new OrRequestMatcher(new AntPathRequestMatcher("/api/**"));
@ -37,7 +39,8 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
@Override @Override
public void configure(final WebSecurity webSecurity) { public void configure(final WebSecurity webSecurity) {
webSecurity.ignoring().antMatchers("/token**").antMatchers("/api/v1/courses/all") 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 @Override