I want an alternative to GrantedAuthorityImpl() class. I want this in spring security implementation. GrantedAuthorityImpl() class is deprecated. Hence I want an alternative solution to it. My code :
public Collection<GrantedAuthority> getAuthorities(Integer access) {     List<GrantedAuthority> authList = new ArrayList<GrantedAuthority>(2);          if (access.compareTo(1) == 0) {         authList.add(new GrantedAuthorityImpl("ROLE_ADMIN"));     }     else{         authList.add(new GrantedAuthorityImpl("ROLE_USER"));     }     return authList; } The class GrantedAuthorityImpl has been deprecated - you can use SimpleGrantedAuthority instead:
public Collection<GrantedAuthority> getAuthorities(Integer access) {     List<GrantedAuthority> authList = new ArrayList<GrantedAuthority>(2);      if (access.compareTo(1) == 0) {         authList.add(new SimpleGrantedAuthority("ROLE_ADMIN"));     }     else{         authList.add(new SimpleGrantedAuthority("ROLE_USER"));     }     return authList; } If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With