Browse Source

swagger 추가

feature/auth
지대한 2 years ago
parent
commit
d3f6829ffb
  1. 8
      pom.xml
  2. 16
      src/main/java/com/palnet/biz/config/WebSecurityConfig.java

8
pom.xml

@ -148,6 +148,14 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-amqp</artifactId>
</dependency>
<!-- Swagger -->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-boot-starter</artifactId>
<version>3.0.0</version>
</dependency>
</dependencies>
<build>

16
src/main/java/com/palnet/biz/config/WebSecurityConfig.java

@ -35,7 +35,20 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
private JwtRequestFilter jwtRequestFilter;
private final String[] PERMITTED_URL = {"/api/acnt/**"};
private final String[] PERMITTED_URL = {
"/api/acnt/**",
/* swagger v2 */
"/v2/api-docs",
"/swagger-resources",
"/swagger-resources/**",
"/configuration/ui",
"/configuration/security",
"/swagger-ui.html",
"/webjars/**",
/* swagger v3 */
"/v3/api-docs/**",
"/swagger-ui/**"
};
@Autowired
public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
@ -64,6 +77,7 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
.authorizeRequests()
.antMatchers(HttpMethod.OPTIONS,"/api/**").permitAll()
.antMatchers(HttpMethod.GET,"/ping").permitAll()
.antMatchers("/swagger-ui/**").permitAll()
.antMatchers(PERMITTED_URL).permitAll()
// all other requests need to be authenticated
.anyRequest().authenticated().and()

Loading…
Cancel
Save