Skip to content
Merged
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
1 change: 1 addition & 0 deletions .github/workflows/cd-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ jobs:
./deploy.sh

- name: ❌ Remove GitHub Actions IP
if: always()
run: |
aws ec2 revoke-security-group-ingress \
--group-id ${{ secrets.SECURITY_GROUP_ID }} \
Expand Down
23 changes: 23 additions & 0 deletions src/main/java/com/kuit/findyou/global/config/SecurityConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.web.SecurityFilterChain;
import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
import org.springframework.web.cors.CorsConfiguration;
import org.springframework.web.cors.CorsConfigurationSource;
import org.springframework.web.cors.UrlBasedCorsConfigurationSource;

import java.util.List;

import static com.kuit.findyou.global.jwt.constant.JwtAuthParameters.LOGIN_ENDPOINT;

Expand Down Expand Up @@ -46,6 +51,8 @@ public AuthenticationManager authenticationManager(AuthenticationConfiguration c

@Bean
public SecurityFilterChain filterChain(HttpSecurity http) throws Exception{
http
.cors(cors -> cors.configurationSource(corsConfigurationSource()));

http
.csrf((auth) -> auth.disable());
Expand Down Expand Up @@ -95,4 +102,20 @@ public SecurityFilterChain filterChain(HttpSecurity http) throws Exception{

return http.build();
}


@Bean
public CorsConfigurationSource corsConfigurationSource() {
CorsConfiguration configuration = new CorsConfiguration();

configuration.setAllowedOrigins(List.of("https://findyou.store"));
configuration.setAllowedMethods(List.of("GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS"));
configuration.setAllowedHeaders(List.of("*"));
configuration.setAllowCredentials(true);
configuration.setMaxAge(3600L);

UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
source.registerCorsConfiguration("/**", configuration);
return source;
}
}
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
package com.kuit.findyou.global.config;

import io.swagger.v3.oas.models.servers.Server;
import io.swagger.v3.oas.models.info.Info;
import io.swagger.v3.oas.models.Components;
import io.swagger.v3.oas.models.OpenAPI;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.List;

@Configuration
public class SwaggerConfig {
@Bean
public OpenAPI openAPI() {
return new OpenAPI()
.servers(List.of(new Server().url("https://findyou.store")
.description("운영 서버")))
.components(new Components())
.info(apiInfo());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ protected void doFilterInternal(HttpServletRequest request, HttpServletResponse
}
finally {
filterChain.doFilter(request, response);
MDC.clear();
}
}

Expand Down
12 changes: 6 additions & 6 deletions src/main/resources/logback-spring.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

<!-- INFO 로그 파일 (텍스트) -->
<appender name="INFO_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${LOG_PATH}/info.log</file>
<file>${LOG_PATH}/info/info.log</file>
<encoder>
<pattern>${file.format}</pattern>
</encoder>
Expand All @@ -36,13 +36,13 @@
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<fileNamePattern>${LOG_PATH}/info.%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<maxFileSize>10MB</maxFileSize>
<maxHistory>30</maxHistory>
<maxHistory>3</maxHistory>
</rollingPolicy>
</appender>

<!-- WARN 로그 파일 (텍스트) -->
<appender name="WARN_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${LOG_PATH}/warn.log</file>
<file>${LOG_PATH}/warn/warn.log</file>
<encoder>
<pattern>${file.format}</pattern>
</encoder>
Expand All @@ -54,13 +54,13 @@
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<fileNamePattern>${LOG_PATH}/warn.%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<maxFileSize>10MB</maxFileSize>
<maxHistory>30</maxHistory>
<maxHistory>3</maxHistory>
</rollingPolicy>
</appender>

<!-- ERROR 로그 파일 (텍스트) -->
<appender name="ERROR_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${LOG_PATH}/error.log</file>
<file>${LOG_PATH}/error/error.log</file>
<encoder>
<pattern>${file.format}</pattern>
</encoder>
Expand All @@ -72,7 +72,7 @@
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<fileNamePattern>${LOG_PATH}/error.%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<maxFileSize>10MB</maxFileSize>
<maxHistory>30</maxHistory>
<maxHistory>3</maxHistory>
</rollingPolicy>
</appender>

Expand Down
Loading