Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: swagger UI #9

Open
wants to merge 1 commit into
base: jiwon/s3-config
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ dependencies {
runtimeOnly group: 'io.jsonwebtoken', name: 'jjwt-impl', version: '0.11.5'
runtimeOnly group: 'io.jsonwebtoken', name: 'jjwt-jackson', version: '0.11.5'

implementation group: 'io.springfox', name: 'springfox-boot-starter', version: '3.0.0'
implementation group: 'io.springfox', name: 'springfox-swagger-ui', version: '3.0.0'

implementation 'org.springframework.cloud:spring-cloud-starter-aws:2.2.6.RELEASE'

implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
Expand Down
5 changes: 4 additions & 1 deletion src/main/java/com/itsu/threedays/config/SecurityConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ public class SecurityConfig {
@Bean
public SecurityFilterChain filterChain(HttpSecurity httpSecurity) throws Exception {
httpSecurity.authorizeRequests().mvcMatchers("/api/login").permitAll()
.mvcMatchers("/api/**").hasRole("USER")
.mvcMatchers("/api/**").permitAll()
.mvcMatchers("/swagger-ui/**").permitAll()
.mvcMatchers("/swagger-resources/**").permitAll()
.mvcMatchers("/v3/api-docs/**").permitAll()
.anyRequest().authenticated()
.and().csrf().disable()
.addFilterBefore(new JwtFilter(jwtTokenProvider), UsernamePasswordAuthenticationFilter.class);
Expand Down
20 changes: 20 additions & 0 deletions src/main/java/com/itsu/threedays/config/SwaggerConfig.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package com.itsu.threedays.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;

@Configuration
public class SwaggerConfig {
@Bean
public Docket api() {
return new Docket(DocumentationType.OAS_30)
.select()
.apis(RequestHandlerSelectors.any())
.paths(PathSelectors.any())
.build();
}
}
8 changes: 7 additions & 1 deletion src/main/resources/application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ spring:
properties:
hibernate:
format_sql: true
mvc:
pathmatch:
matching-strategy: ant_path_matcher
# profiles:
# active: test
cloud:
Expand All @@ -26,4 +29,7 @@ cloud:
accessKey: AKIARREOKLWWNCOBGJHR
secretKey: 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
jwt:
secret: threedaysapitokensecretkey123149398230
secret: threedaysapitokensecretkey123149398230
jasypt:
encryptor:
password: hcjweg3120