|
|
@@ -4,10 +4,12 @@ import cn.hutool.core.collection.CollectionUtil; |
|
|
|
import com.ningdatech.basic.auth.AbstractLoginUser; |
|
|
|
import lombok.Data; |
|
|
|
import lombok.EqualsAndHashCode; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.springframework.security.core.GrantedAuthority; |
|
|
|
import org.springframework.security.core.authority.SimpleGrantedAuthority; |
|
|
|
import org.springframework.security.core.userdetails.UserDetails; |
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.Collection; |
|
|
|
import java.util.List; |
|
|
|
|
|
|
@@ -41,8 +43,11 @@ public class UserInfoDetails extends AbstractLoginUser implements UserDetails { |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public Collection<? extends GrantedAuthority> getAuthorities() { |
|
|
|
SimpleGrantedAuthority simpleGrantedAuthority = new SimpleGrantedAuthority(this.role); |
|
|
|
return CollectionUtil.toList(simpleGrantedAuthority); |
|
|
|
if (StringUtils.isNotBlank(role)) { |
|
|
|
SimpleGrantedAuthority simpleGrantedAuthority = new SimpleGrantedAuthority(this.role); |
|
|
|
return CollectionUtil.toList(simpleGrantedAuthority); |
|
|
|
} |
|
|
|
return new ArrayList<>(); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|