[Sammy] 5단계 - 게시글 권한 부여#150
Open
astraum wants to merge 10 commits intocodesquad-members-2022:astraumfrom
Open
Conversation
* LoginRequiredInterceptor가 /questions/** 경로에 대한 요청을 가로채 로그인 상태 여부를 검사한다.
* UserService에서 HttpSession 객체를 받아 URL path variable로 전달된 userId와 현재 로그인 중인 유저의 userId를 비교하는 검증 로직을 제거하였다. * 에러 페이지로 이동하는 로직에 try-catch 대신 UserAuthenticationInterceptor를 사용하였다.
* LoginRequiredInterceptor에서 로그인 페이지로 리다이렉트를 발생시킨 요청의 경로를 세션에 저장해두었다가 성공적으로 로그인하고 나면 저장된 경로로 리다이렉트시킨다. 저장된 경로가 없다면 인덱스 페이지로 리다이렉트시킨다.
* 작성자를 식별하기 위해 작성자의 userId 정보 추가 * Article * ArticleRepository * schema.sql * sample_data.sql * Article 생성 시 작성자의 userId와 name은 세션의 currentUser를 참조한다. * 글 작성 페이지 및 ArticleCreationForm에서 글쓴이 입력 항목 제거. * Article 정보를 표시하는 각 페이지의 템플릿 수정 * 글쓴이 이름을 클릭하면 글쓴이의 프로필 페이지로 이동
* 로그인되지 않은 사용자가 수정 페이지에 접근하면 로그인 페이지로 리다이렉트 * 다른 사용자가 쓴 글의 수정 페이지에 접근하면 에러 페이지로 리다이렉트 * 다른 사용자가 쓴 글에 POST 요청을 보내면 에러 페이지로 리다이렉트 * 정상적으로 수정되었을 경우 Article의 id값을 기준으로 DB테이블에 UPDATE 쿼리 전송
* 키(userId)가 존재하면 업데이트하고 존재하지 않으면 새 행을 추가하도록 하였다.
* 로그인 페이지로 리다이렉트시킨 경로를 저장했다가 로그인 후 저장된 경로로 다시 돌려보내는 로직에서, 저장된 경로가 계속 보존되어 로그아웃했다가 로그인했을 때 해당 경로로 다시 리다이렉트되는 현상을 수정.
* 다른 사용자가 작성한 글에 대해 DELETE 요청을 전송하면 에러 페이지로 리다이렉트
* HttpSession 객체를 UserService로 전달하지 않고 LoginController에서 login 및 logout을 처리하도록 변경하였다.
* 인터셉터가 로그인 상태가 아닐 때 회원가입까지 차단하는 문제를 수정하였다.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
스프링 카페 5단계 리뷰 요청드립니다. 미션 기한은 지났지만, 로컬에는 7단계까지 거의 완료했던 분량이 남아있어서 가능하다면 완주하고 싶습니다.
웹 서버 미션 리뷰해주시는 것만으로도 바쁘시겠지만 혹시 간단하게나마 피드백 남겨주실 수 있다면 제게 많은 도움이 될 것입니다.
요구사항
전 단계 피드백 반영