@Test public void simpleMapping() { String roleName = "XROAD_REGISTRATION_OFFICER"; Set<GrantedAuthority> authorities = mapper.getAuthorities( Collections.singletonList(Role.valueOf(roleName))); assertTrue(authorities.size() > 1); Set<String> authStrings = authorities.stream().map( auth -> auth.getAuthority()) .collect(Collectors.toSet()); assertTrue(authStrings.contains("ROLE_" + roleName)); assertTrue(authStrings.contains("ADD_CLIENT")); assertFalse(authStrings.contains("INIT_CONFIG")); }
public Set<GrantedAuthority> getAuthorities(Collection<Role> roles) { Set<GrantedAuthority> auths = new HashSet<>(); auths.addAll(getPermissionGrants(roles)); auths.addAll(getRoleGrants(roles)); return auths; }
GrantedAuthorityMapper { public Set<GrantedAuthority> getAuthorities(Collection<Role> roles) { Set<GrantedAuthority> auths = new HashSet<>(); auths.addAll(getPermissionGrants(roles)); auths.addAll(getRoleGrants(roles)); return auths; } }
GrantedAuthorityMapper { public Set<GrantedAuthority> getAuthorities(Collection<Role> roles) { Set<GrantedAuthority> auths = new HashSet<>(); auths.addAll(getPermissionGrants(roles)); auths.addAll(getRoleGrants(roles)); return auths; } GrantedAuthorityMapper(); }
GrantedAuthorityMapper { public Set<GrantedAuthority> getAuthorities(Collection<Role> roles) { Set<GrantedAuthority> auths = new HashSet<>(); auths.addAll(getPermissionGrants(roles)); auths.addAll(getRoleGrants(roles)); return auths; } GrantedAuthorityMapper(); Set<GrantedAuthority> getAuthorities(Collection<Role> roles); }
GrantedAuthorityMapper { public Set<GrantedAuthority> getAuthorities(Collection<Role> roles) { Set<GrantedAuthority> auths = new HashSet<>(); auths.addAll(getPermissionGrants(roles)); auths.addAll(getRoleGrants(roles)); return auths; } GrantedAuthorityMapper(); Set<GrantedAuthority> getAuthorities(Collection<Role> roles);  }