Skip to content

Commit

Permalink
feat: 쿠키 암호화 키 환경변수 설정
Browse files Browse the repository at this point in the history
  • Loading branch information
SHEOMM committed Apr 2, 2024
1 parent c3e920c commit 68faa8e
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import java.util.List;
import java.util.Optional;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpCookie;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
Expand All @@ -44,6 +45,7 @@ public class AttendanceController {
private final AttendanceService attendanceService;
private final AttendeeService attendeeService;

@Value("${cookie.encode}")
private final String COOKIE_ENCODE = "SRCT";

//FIXME: 중복 인원인 경우 코드 중복이 생겨도 API 분리가 나아 보인다. 한 API에서 너무 많은 일을 하는 중이다.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,6 @@ public void addArgumentResolvers(List<HandlerMethodArgumentResolver> resolvers)

@Override
public void addCorsMappings(CorsRegistry registry) {



registry.addMapping("/**")
.allowedOrigins(allowedOrigins)
.allowedMethods("GET","POST", "PUT", "DELETE", "OPTIONS", "HEAD")
Expand Down
3 changes: 3 additions & 0 deletions src/main/resources/application-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,6 @@ logging:

cors:
allowed-origins: http://localhost:5173

cookie:
encode: TEMP
9 changes: 6 additions & 3 deletions src/main/resources/application-temp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ spring:
driver-class-name: com.mysql.cj.jdbc.Driver
url: ${MYSQL_DATASOURCE_URL}
username: ${MYSQL_DATASOURCE_USERNAME}
password: ${ MYSQL_DATASOURCE_PASSWORD }
password: ${MYSQL_DATASOURCE_PASSWORD}
jpa:
show-sql: true
hibernate:
Expand All @@ -16,10 +16,13 @@ spring:
database: mysql
data:
redis:
host: ${ REDIS_DATASOURCE_HOST }
port: ${ REDIS_DATASOURCE_PORT }
host: ${REDIS_DATASOURCE_HOST}
port: ${REDIS_DATASOURCE_PORT}


cors:
allowed-origins: https://areyouhere.today, https://www.areyouhere.today

cookie:
encode: ${SECRET_KEY}

0 comments on commit 68faa8e

Please sign in to comment.