-
Notifications
You must be signed in to change notification settings - Fork 57
[한성지] sprint9 #454
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
The head ref may contain hidden characters: "part4-\uD55C\uC131\uC9C0-sprint9"
[한성지] sprint9 #454
Conversation
f7e0ac2
to
ba20927
Compare
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.
성지님 고생하셨습니다!
403 에러는 제가 채점 다 끝낸 후에 디버깅 해볼게요~~
// 세션 무효화 | ||
HttpSession session = request.getSession(false); | ||
if (session != null) { | ||
session.invalidate(); | ||
} | ||
|
||
// securityContext 초기화 | ||
SecurityContextHolder.clearContext(); | ||
|
||
return ResponseEntity.ok().build(); |
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.
https://limvik.github.io/posts/spring-security-logout-operation/
위 글 읽어보시면 좋아요. 로그아웃시 정리되어야 하는게 session, context 외에도 있더라구요~
@Override | ||
public UserDto updateRole(RoleUpdateRequest request) { | ||
|
||
User user = userRepository.findById(request.userId()) | ||
.orElseThrow(() -> UserNotFoundException.withId(request.userId())); | ||
|
||
user.updateRole(request.newRole()); | ||
|
||
return userMapper.toDto(user); | ||
} |
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.
권한 변경 후 로그아웃이 되면 좋을텐데! 아쉽습니당!
요구사항
기본
Spring Security 환경 설정
com.sprint.mission.discodeit.config
SecurityConfig
SecurityFilterChain
Bean을 선언하세요.가장 기본적인
SecurityFilterChain
을 등록하고, 이때 등록되는 필터 목록을 디버깅해보세요. 필터 목록은 PR에 첨부하세요.아래 코드를
SecurityConfig/filterChain
에 작성하여 필터 확인결과
모든 요청에 대해 인증이 수행되도록 하세요.
/api/
를 포함하지 않는 모든 url에 대한 요청(정적 리소스, swagger, actuator 등)은 인증을 수행하지 않도록 하세요.LogoutFilter
를 제외하세요.LogoutFilter
는 사용하지 않습니다.trace
로 설정하세요.CSRF 보호 설정하기
CSRF 토큰을 발급하는 API를 구현하세요.
다이어그램
권한이 수정된 사용자가 로그인 상태라면, 강제 로그아웃 되도록 합니다.
인가 처리
ROLE_USER
권한을 가져야합니다.ROLE_CHANNEL_MANAGER
권한을 가져야합니다.ROLE_ADMIN
권한을 가져야합니다.심화
프론트엔드 버전업
심화 요구 사항을 위해 프론트엔드 코드를 버전업하세요.
v2.1.0
Remember-Me
동시 로그인 제한
세션 고정 보호
사용자 로그인 상태 고도화
인가 고도화
ROLE_ADMIN
권한을 가진 사용자만 호출할 수 있습니다.ROLE_ADMIN
권한을 가진 사용자만 호출할 수 있습니다.주요 변경사항
스크린샷
멘토에게