forked from Soomin-Lim/be-java-web-server
-
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.
* FEAT : POST request 구현 * REFACTOR : builder 패턴으로 변경 HttpResponse 객체 생성자에 null 값 전달 하던 것 builder 패턴으로 변경 * REFACTOR : 쓰지 않는 함수 삭제 * DOCS : README.md 학습 내용 추가 HTTP POST 방식, JAVA builder 패턴 공부 * FORM : 주석 삭제 * FEAT : 로그인 기능 구현 LogInService 클래스 추가 * FEAT : 로그인 기능 구현 step2 로그인 성공 실패 나누어 놓음 UserController에서 LogInService를 활용해 boolean으로 리턴 받아놓음 * FEAT : null request 예외처리
- Loading branch information
Showing
16 changed files
with
194 additions
and
46 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,4 +31,7 @@ public String getAccept() { | |
} | ||
|
||
|
||
public String getContentLength() { | ||
return headers.get("Content-Length"); | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package http.exception; | ||
|
||
public class NullHttpRequestException extends RuntimeException{ | ||
public NullHttpRequestException(String message){ | ||
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
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 |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package service; | ||
|
||
import db.Database; | ||
import model.User; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
import util.HttpRequestUtils; | ||
|
||
import java.util.Map; | ||
|
||
public class LogInService { | ||
private static final Logger logger = LoggerFactory.getLogger(SignUpService.class); | ||
|
||
public static boolean isLoginSuccess(String body) { | ||
Map<String, String> params = HttpRequestUtils.parseQueryString(body); | ||
|
||
User tryLoginUser = Database.findUserById(params.get("userId")); | ||
logger.debug("User : {}", tryLoginUser); | ||
|
||
// id가 없을 때 | ||
if(tryLoginUser == null) { | ||
logger.debug("User not Found !!"); | ||
return false; | ||
} | ||
|
||
// 비밀번호가 맞아서 로그인 성공 | ||
if(tryLoginUser.getPassword().equals(params.get("password"))){ | ||
logger.debug("Login success !!"); | ||
return true; | ||
} | ||
|
||
// 비밀번호 틀림 | ||
logger.debug("Login failed !!"); | ||
return false; | ||
|
||
} | ||
} |
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
Oops, something went wrong.