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
2 changes: 0 additions & 2 deletions .github/ISSUE_TEMPLATE/---feature-template.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ assignees: ''

---

# 🚀 Feature - <!--{ 작업 내용 }-->

### 📝 Description

---
Expand Down
2 changes: 0 additions & 2 deletions .github/ISSUE_TEMPLATE/---refactor-template.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ assignees: ''

---

# 🔨 Refactor - <!--{ 작업 내용 }-->

### 📝 Description

---
Expand Down
2 changes: 0 additions & 2 deletions .github/ISSUE_TEMPLATE/-bug-report-template.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ assignees: ''

---

# 🐞 Bug - <!--{ 작업 내용 }-->

### 🕵️‍♀️ Condition

---
Expand Down
11 changes: 10 additions & 1 deletion docker-compose.dev.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
version: "3"

x-logging: &default-logging
driver: json-file
options:
max-size: "20m"
max-file: "3"

services:
backend:
image: ceos17/ceos-backend-dev
container_name: backend
hostname: backend
logging: *default-logging
env_file:
- .env
expose:
Expand All @@ -14,6 +21,7 @@ services:

nginx:
image: ceos17/ceos-nginx-dev
logging: *default-logging
depends_on:
- backend
restart: always
Expand All @@ -24,6 +32,7 @@ services:
image: mysql:latest
container_name: mysql
restart: always
logging: *default-logging
environment:
MYSQL_DATABASE: ceos-dev
MYSQL_USER: ${DB_USERNAME}
Expand All @@ -46,6 +55,6 @@ services:
image: redis:latest
container_name: redis
hostname: redis
logging: *default-logging
ports:
- "6379:6379"

11 changes: 10 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,25 @@
version: "3"

x-logging: &default-logging
driver: json-file
options:
max-size: "20m"
max-file: "3"

services:
backend:
image: ceos17/ceos-backend
container_name: backend
hostname: backend
logging: *default-logging
env_file:
- .env
expose:
- "8080"

nginx:
image: ceos17/ceos-nginx
logging: *default-logging
depends_on:
- backend
restart: always
Expand All @@ -22,5 +30,6 @@ services:
image: redis:latest
container_name: redis
hostname: redis
logging: *default-logging
ports:
- "6379:6379"
- "6379:6379"
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public void deleteActivity(@PathVariable Long id) {
}

@Operation(summary = "활동 이미지 url 생성하기")
@GetMapping("/image")
@PostMapping("/image")
public AwsS3Url getImageUrl() {
log.info("활동 이미지 url 생성하기");
return activityService.getImageUrl();
Expand Down
14 changes: 4 additions & 10 deletions src/main/java/ceos/backend/domain/admin/AdminController.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@
public class AdminController {

private final AdminService adminService;
private static final String MOBILE = "mobile";
private static final String WEB = "web";

@Operation(summary = "닉네임 확인")
@PostMapping("/username")
Expand All @@ -41,11 +39,9 @@ public void signUp(@RequestBody @Valid SignUpRequest signUpRequest) {

@Operation(summary = "로그인")
@PostMapping("/signin")
public TokenResponse signIn(
HttpServletRequest request, @RequestBody @Valid SignInRequest signInRequest) {
public TokenResponse signIn(@RequestBody @Valid SignInRequest signInRequest) {
log.info("로그인");
String device = request.getHeader("User-Agent").contains("mobile") ? MOBILE : WEB;
return adminService.signIn(device, signInRequest);
return adminService.signIn(signInRequest);
}

@Operation(summary = "아이디 찾기")
Expand Down Expand Up @@ -73,11 +69,9 @@ public void resetPwd(

@Operation(summary = "로그아웃")
@PostMapping("/logout")
public void logout(
HttpServletRequest request, @AuthenticationPrincipal AdminDetails adminUser) {
public void logout(@AuthenticationPrincipal AdminDetails adminUser) {
log.info("로그아웃");
String device = request.getHeader("User-Agent").contains("mobile") ? MOBILE : WEB;
adminService.logout(device, adminUser);
adminService.logout(adminUser);
}

@Operation(summary = "토큰 재발급")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ public void resetPwd(ResetPwdRequest resetPwdRequest, Admin admin) {
}

public void matchesRefreshToken(String refreshToken, Admin admin) {
String savedToken = redisTemplate.opsForValue().get(admin.getId().toString());
String savedToken = redisTemplate.opsForValue().get("refresh:" + admin.getId().toString());
if (savedToken == null || !savedToken.equals(refreshToken)) {
throw RefreshTokenNotFound.EXCEPTION;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,14 @@ public void signUp(SignUpRequest signUpRequest) {
}

@Transactional
public TokenResponse signIn(String device, SignInRequest signInRequest) {
public TokenResponse signIn(SignInRequest signInRequest) {

final Admin admin = adminHelper.findForSignIn(signInRequest);
final Authentication authentication = adminHelper.adminAuthorizationInput(admin);

adminHelper.checkRole(admin);

String redisKey = admin.getId().toString() + ":" + device;
String redisKey = "refresh:" + admin.getId().toString();

// 토큰 발급
final String accessToken = tokenProvider.createAccessToken(admin.getId(), authentication);
Expand Down Expand Up @@ -100,10 +100,10 @@ public void resetPwd(ResetPwdRequest resetPwdRequest, AdminDetails adminUser) {
}

@Transactional
public void logout(String device, AdminDetails adminUser) {
public void logout(AdminDetails adminUser) {
final Admin admin = adminUser.getAdmin();

String redisKey = admin.getId().toString() + ":" + device;
String redisKey = "refresh:" + admin.getId().toString();

// 레디스 삭제
tokenProvider.deleteRefreshToken(redisKey);
Expand All @@ -121,10 +121,13 @@ public TokenResponse reissueToken(RefreshTokenRequest refreshTokenRequest) {
adminHelper.matchesRefreshToken(refreshToken, admin);

// 토큰 재발급
String redisKey = "refresh:" + admin.getId();
final String newAccessToken =
tokenProvider.createAccessToken(admin.getId(), authentication);
final String newRefreshToken =
tokenProvider.createRefreshToken(admin.getId(), authentication, redisKey);

return adminMapper.toTokenResponse(newAccessToken, refreshToken);
return adminMapper.toTokenResponse(newAccessToken, newRefreshToken);
}

@Transactional(readOnly = true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public void deleteManagement(@PathVariable(name = "managerId") Long managerId) {
}

@Operation(summary = "임원진 이미지 url 생성하기")
@GetMapping("/image")
@PostMapping("/image")
public AwsS3Url getImageUrl() {
log.info("임원진 이미지 url 생성하기");
return managementService.getImageUrl();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public void deleteActivity(@PathVariable Long projectId) {
}

@Operation(summary = "프로젝트 이미지 url 생성하기")
@GetMapping("/image")
@PostMapping("/image")
public AwsS3Url getImageUrl() {
log.info("프로젝트 이미지 url 생성하기");
return projectService.getImageUrl();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public void deleteSponsor(@PathVariable(name = "sponsorId") Long sponsorId) {
}

@Operation(summary = "스폰서 이미지 url 생성하기")
@GetMapping("/image")
@PostMapping("/image")
public AwsS3Url getImageUrl() {
log.info("스폰서 이미지 url 생성하기");
return sponsorService.getImageUrl();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public void deleteManagement(@PathVariable(name = "startupId") Long startupId) {
}

@Operation(summary = "서비스 이미지 url 생성하기")
@GetMapping("/image")
@PostMapping("/image")
public AwsS3Url getImageUrl() {
log.info("서비스 이미지 url 생성하기");
return startupService.getImageUrl();
Expand Down
Loading