Skip to content

Conversation

@sanhee
Copy link
Owner

@sanhee sanhee commented Jul 23, 2021

  • “로그인” 메뉴를 클릭하면 http://localhost:8080/user/login.html 으로 이동해 로그인할 수 있다.

    • 로그인이 성공하면 index.html로 이동
    • 로그인이 실패하면 /user/login_failed.html로 이동해야 한다.
  • 회원가입한 사용자로 로그인할 수 있어야 한다.

    • 로그인이 성공하면 cookie를 활용해 로그인 상태를 유지할 수 있어야 한다.

      • 정상적으로 로그인 되었는지 확인하려면 앞 단계에서 회원가입한 데이터를 유지해야 한다(회원가입할 때 생성한 User 객체를 DataBase.addUser() 메서드를 활용해 RAM 메모리에 저장한다)
    • 로그인이 성공할 경우 요청 header의 Cookie header 값이 logined=true

      HTTP/1.1 200 OK
      Content-Type: text/html
      Set-Cookie: logined=true; Path=/
      

      Set-Cookie 설정시 모든 요청에 대해 Cookie 처리가 가능하도록 Path 설정 값을 /(Path=/)로 설정한다.

    • 로그인이 실패하면 Cookie header 값이 logined=false로 전달되어야 한다.

  • 로그인 후에 get 요청에서 쿠키가 true로 되어야 한다.

    GET /index.html HTTP/1.1
    Host: localhost:8080
    Connection: keep-alive
    Accept: */*
    Cookie: logined=true
    

@sanhee sanhee requested a review from Dae-Hwa July 23, 2021 06:08
@sanhee sanhee self-assigned this Jul 23, 2021
Comment on lines +115 to +127
private String response302Header() {
String responseMessage = "HTTP/1.1 302 Found" + System.lineSeparator() +
"Location: /index.html" + System.lineSeparator();
return responseMessage;
}

private String response302HeaderWithCookie(String location, String cookie) {
String responseMessage = "HTTP/1.1 302 Found" + System.lineSeparator() +
"Location: "+location+ System.lineSeparator()+
"Set-Cookie: "+cookie+"; Path=/";
return responseMessage;
}

Copy link
Collaborator

Choose a reason for hiding this comment

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

좋네요 Header 클래스에 static 메소드 같은걸로 잡아놓아도 괜찮을 것 같습니다.

Copy link
Collaborator

Choose a reason for hiding this comment

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

그런데 이게 지금 단계에서만 리팩토링해야되는게 아니기 때문에(다른 부분도 함께 되야 하니까) 따로 이슈 남기고 작업해봐도 괜찮을 것 같아요

@sanhee
Copy link
Owner Author

sanhee commented Jul 23, 2021

회원가입시 로그인 처리는 미구현

Base automatically changed from login/main to implement-requirements August 5, 2021 02:52
@sanhee sanhee closed this Aug 5, 2021
@Dae-Hwa Dae-Hwa added the 미션 label Aug 18, 2021
@Dae-Hwa Dae-Hwa deleted the login/noeul branch October 25, 2021 09:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants