class SimpleGrantedAuthoritiesMapper implements GrantedAuthoritiesMapper {

    @Override
    public Collection<? extends GrantedAuthority> mapAuthorities(
            Collection<? extends GrantedAuthority> authorities) {
        if(mappings.isEmpty()) {
            return authorities;
        }
        List<GrantedAuthority> result = new ArrayList<GrantedAuthority>();
        for(GrantedAuthority authority : authorities) {
            if(mappings.containsKey(authority.getAuthority())) {
                result.add(new GrantedAuthorityImpl(mappings.get(authority.getAuthority())));
            } else {
                result.add(authority);
            }
        }
        return result;
    }

    public  SimpleGrantedAuthoritiesMapper(Map<String, String> mappings);

}