Skip to content

Conversation

@ParkDooWon
Copy link

안녕하세요 데이브! 두강입니다~~
3단계 미션 제출합니다! 피드백 부탁드릴게요! :)
감사합니다~~ 😄

Copy link

@dave915 dave915 left a 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("해당 유저가 없습니다."));
Copy link

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<>();
Copy link

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();
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

단순히 값들을 삭제할 뿐만 아니라 invalidated 된 Session은 사용 할 수 없는 것으로 알고 있어요.
혹시 모르니 조금 더 찾아보세요! :)

https://love2taeyeon.tistory.com/entry/invalidate%EC%9D%80-%EC%84%B8%EC%85%98%EC%9D%84-%EC%86%8C%EB%A9%B8%EC%8B%9C%ED%82%A4%EB%8A%94-%EA%B2%83%EC%9D%B4-%EC%95%84%EB%8B%88%EB%9D%BC-%EB%AC%B4%ED%9A%A8%ED%99%94-%EC%8B%9C%ED%82%AC%EB%BF%90%EC%9D%B4%EB%8B%A4

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);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

미션 요구사항은 cookie에다 logind 값을 지정하도록 되어있는데 세션에 담은 이유가 있나요?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants