@Override @JsonIgnore public Collection<? extends GrantedAuthority> getAuthorities() { Set<Role> roles = this.getRoles(); if (roles == null) { return Collections.emptyList(); } Set<GrantedAuthority> authorities = new HashSet<GrantedAuthority>(); for (Role role : roles) { authorities.add(new SimpleGrantedAuthority(role.name())); } return authorities; }
@Override public Collection<? extends GrantedAuthority> getAuthorities() { /* Set<String> roles = this.getRoles(); if (roles == null) { return Collections.emptyList(); } */ Set<GrantedAuthority> authorities = new HashSet<>(); for (Role role : roles) { authorities.add(new SimpleGrantedAuthority(role.toString())); } return authorities; }
@Transient @JsonIgnore public Collection<? extends GrantedAuthority> getAuthorities() { if (authorities.isEmpty()) { for (Role role : roles) { String[] rights = role.getRights().split(";"); for (String right : rights) { if (NullEmptyChecker.isNotNullOrEmpty(right)) { authorities.add(new SimpleGrantedAuthority("ROLE_" + right)); } } } } return authorities; }
@Override public String toString() { return "RoleResourcePermission{id=" + this.getId() + ",roleId=" + (role != null ? role.getId() : "null") + ", resourceId=" + resourceId + ", permissionIds=" + permissionIds + '}'; }
@Override public Collection<? extends GrantedAuthority> getAuthorities() { List<GrantedAuthority> authorities = new ArrayList<>(); authorities.add(new SimpleGrantedAuthority(role.getName())); return authorities; }