diff --git a/src/main/java/com/keeper/homepage/global/config/security/data/JwtUserDetails.java b/src/main/java/com/keeper/homepage/global/config/security/data/JwtUserDetails.java index 005c522cc..80cde9add 100644 --- a/src/main/java/com/keeper/homepage/global/config/security/data/JwtUserDetails.java +++ b/src/main/java/com/keeper/homepage/global/config/security/data/JwtUserDetails.java @@ -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 { @@ -18,7 +19,9 @@ public class JwtUserDetails implements UserDetails { public Collection getAuthorities() { List roles = new ArrayList<>(); for (String memberJob : memberJobs) { - roles.add(new SimpleGrantedAuthority(memberJob)); + if (StringUtils.hasText(memberJob)) { + roles.add(new SimpleGrantedAuthority(memberJob)); + } } return roles; }