forked from woowacourse-teams/2024-cruru
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from xogns1514/be-515-DOCKER_IMAGE_TAG_01
Be 515 docker image tag 01
- Loading branch information
Showing
82 changed files
with
1,322 additions
and
709 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -66,7 +66,8 @@ public void run(ApplicationArguments args) { | |
} | ||
|
||
private void runDataLoader() { | ||
Member member = new Member("[email protected]", "qwer1234", "01012345678"); | ||
Member member = new Member("[email protected]", "$2a$10$rG0JsflKdGcORjGFTURYb.npEgtvClK4.3P.EMr/o3SdekrVFxOvG", | ||
"01012345678"); // password 원문: qwer1234 | ||
memberRepository.save(member); | ||
Club club = new Club("우아한테크코스", member); | ||
clubRepository.save(club); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
...nd/src/main/java/com/cruru/applicant/exception/badrequest/ApplicantUnrejectException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package com.cruru.applicant.exception.badrequest; | ||
|
||
import com.cruru.advice.badrequest.BadRequestException; | ||
|
||
public class ApplicantUnrejectException extends BadRequestException { | ||
|
||
private static final String MESSAGE = "불합격하지 않은 지원자입니다."; | ||
|
||
public ApplicantUnrejectException() { | ||
super(MESSAGE); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
backend/src/main/java/com/cruru/auth/controller/AuthController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package com.cruru.auth.controller; | ||
|
||
import com.cruru.auth.controller.dto.LoginRequest; | ||
import com.cruru.auth.service.facade.AuthFacade; | ||
import com.cruru.global.util.CookieManager; | ||
import jakarta.validation.Valid; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.http.HttpHeaders; | ||
import org.springframework.http.ResponseCookie; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.web.bind.annotation.PostMapping; | ||
import org.springframework.web.bind.annotation.RequestBody; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
@RestController | ||
@RequestMapping("/v1/auth") | ||
@RequiredArgsConstructor | ||
public class AuthController { | ||
|
||
private final AuthFacade authFacade; | ||
private final CookieManager cookieManager; | ||
|
||
@PostMapping("/login") | ||
public ResponseEntity<Void> login(@RequestBody @Valid LoginRequest request) { | ||
String token = authFacade.login(request); | ||
ResponseCookie cookie = cookieManager.createTokenCookie(token); | ||
return ResponseEntity.ok() | ||
.header(HttpHeaders.SET_COOKIE, cookie.toString()) | ||
.build(); | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
backend/src/main/java/com/cruru/auth/controller/dto/LoginProfile.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package com.cruru.auth.controller.dto; | ||
|
||
import com.cruru.member.domain.MemberRole; | ||
|
||
public record LoginProfile(String email, MemberRole memberRole) { | ||
|
||
} |
14 changes: 14 additions & 0 deletions
14
backend/src/main/java/com/cruru/auth/controller/dto/LoginRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package com.cruru.auth.controller.dto; | ||
|
||
import jakarta.validation.constraints.Email; | ||
import jakarta.validation.constraints.NotBlank; | ||
|
||
public record LoginRequest( | ||
@Email(message = "이메일의 형식이 올바르지 않습니다.") | ||
String email, | ||
|
||
@NotBlank(message = "비밀번호를 입력해주세요.") | ||
String password | ||
) { | ||
|
||
} |
12 changes: 12 additions & 0 deletions
12
backend/src/main/java/com/cruru/auth/exception/IllegalCookieException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package com.cruru.auth.exception; | ||
|
||
import com.cruru.advice.badrequest.BadRequestException; | ||
|
||
public class IllegalCookieException extends BadRequestException { | ||
|
||
private static final String MESSAGE = "유효하지 않은 쿠키입니다."; | ||
|
||
public IllegalCookieException() { | ||
super(MESSAGE); | ||
} | ||
} |
4 changes: 3 additions & 1 deletion
4
backend/src/main/java/com/cruru/auth/exception/IllegalTokenException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
backend/src/main/java/com/cruru/auth/exception/LoginFailedException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package com.cruru.auth.exception; | ||
|
||
import com.cruru.advice.UnauthorizedException; | ||
|
||
public class LoginFailedException extends UnauthorizedException { | ||
|
||
private static final String MESSAGE = "비밀번호가 일치하지 않습니다."; | ||
|
||
public LoginFailedException() { | ||
super(MESSAGE); | ||
} | ||
} |
Oops, something went wrong.