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