fix: 토큰에 권한이 비어있을 경우 role 추가하지 않도록 변경 #449
Open
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.
🔥 Related Issue
📝 Description
JwtUtils
에서role
을 반환할 때SimpleGrantedAuthority
객체에 담아서 반환해주고 있었는데,SimpleGrantedAuthority
구현을 살펴보면hasText
가 아니면 exception을 반환하도록 되어 있습니다.그런데 이
SimpleGrantedAuthority
객체의 exception을 반환하는 위치가 security의 filter단이라 WebMVC의 ControllerAdvice를 타지 못하는 것으로 보입니다. 그래서 아래와 같이 이상한 응답이 나가는 것으로 보여요.권한이 없으면 권한이 없는대로 일단 진행하고, 각 API에서 401이나 403을 뱉는게 맞다고 판단해서 권한이 없어도 해당 filter는 통과하도록 수정했습니다.
⭐️ Review Request