-
Notifications
You must be signed in to change notification settings - Fork 90
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[두강] 3단계 - HTTP 웹서버 구현 미션 제출합니다. #191
base: parkdoowon
Are you sure you want to change the base?
Conversation
[두강] 2단계 - HTTP 웹 서버 리팩토링 미션 제출합니다.
- 로그인 상태엔 유저 목록을 보여준다. - 로그인 상태가 아니면 login 페이지로 이동한다.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
두강 구현 잘 해주셨습니다!
몇가지 코멘트 남겼습니다.
확인 해 보시고 궁금한 점 있다면 언제든 DM주세요!
String userId = loginInfo.get("userId"); | ||
String password = loginInfo.get("password"); | ||
User user = Optional.ofNullable(DataBase.findUserById(userId)) | ||
.orElseThrow(() -> new IllegalArgumentException("해당 유저가 없습니다.")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
로그인 실패시 /user/login_failed.html
로 이동해야 할 것 같은데 그냥 로그만 찍히고 에러 화면으로 넘어가 버리네요 ㅜㅜ
import java.util.UUID; | ||
|
||
public class SessionStorage { | ||
private static final Map<String, HttpSession> sessions = new HashMap<>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
웹서버는 멀티스레드로 동작하는데 static 타입의 필드를 접근시 Thread Safe 할까요? 🤔
} | ||
|
||
public void invalidate() { | ||
this.attributes.clear(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
단순히 값들을 삭제할 뿐만 아니라 invalidated 된 Session은 사용 할 수 없는 것으로 알고 있어요.
혹시 모르니 조금 더 찾아보세요! :)
LoginStatus loginStatus = LoginStatus.of(user.validatePassword(password)); | ||
HttpCookie httpCookie = new HttpCookie(httpRequest.getHeader("Cookie")); | ||
HttpSession httpSession = SessionStorage.getSession(httpCookie.getCookie("sessionId")); | ||
httpSession.setAttribute("logined", true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
미션 요구사항은 cookie에다 logind 값을 지정하도록 되어있는데 세션에 담은 이유가 있나요?
안녕하세요 데이브! 두강입니다~~
3단계 미션 제출합니다! 피드백 부탁드릴게요! :)
감사합니다~~ 😄