Skip to content
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

fix: 토큰에 권한이 비어있을 경우 role 추가하지 않도록 변경 #449

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.util.StringUtils;

@RequiredArgsConstructor
public class JwtUserDetails implements UserDetails {
Expand All @@ -18,7 +19,9 @@ public class JwtUserDetails implements UserDetails {
public Collection<? extends GrantedAuthority> getAuthorities() {
List<SimpleGrantedAuthority> roles = new ArrayList<>();
for (String memberJob : memberJobs) {
roles.add(new SimpleGrantedAuthority(memberJob));
if (StringUtils.hasText(memberJob)) {
roles.add(new SimpleGrantedAuthority(memberJob));
}
}
return roles;
}
Expand Down
Loading