@@ -0,0 +1,1661 @@
+/*%0A * Copyright 2014-2015 Hewlett-Packard Development Company, L.P.%0A * Licensed under the MIT License (the %22License%22); you may not use this file except in compliance with the License.%0A */%0A%0Apackage com.hp.autonomy.frontend.configuration.authentication;%0A%0Aimport org.springframework.security.core.GrantedAuthority;%0Aimport org.springframework.security.core.authority.SimpleGrantedAuthority;%0Aimport org.springframework.security.core.authority.mapping.GrantedAuthoritiesMapper;%0A%0Aimport java.util.Collection;%0Aimport java.util.HashSet;%0Aimport java.util.Map;%0A%0A/**%0A * This maps the incoming granted authorities to the corresponding entries in the %7B@link #authorityMap%7D.%0A */%0Apublic class OneToOneOrZeroSimpleAuthorityMapper implements GrantedAuthoritiesMapper %7B%0A    private final Map%3CString, String%3E authorityMap;%0A%0A    /**%0A     * Constructs a new OneToOneOrZeroSimpleAuthorityMapper with the given authority map.%0A     * @param authorityMap A map from IDOL Community roles to application roles.%0A     */%0A    public OneToOneOrZeroSimpleAuthorityMapper(final Map%3CString, String%3E authorityMap) %7B%0A        this.authorityMap = authorityMap;%0A    %7D%0A%0A    @Override%0A    public Collection%3C? extends GrantedAuthority%3E mapAuthorities(final Collection%3C? extends GrantedAuthority%3E authorities) %7B%0A        final Collection%3CGrantedAuthority%3E output = new HashSet%3C%3E();%0A%0A        for (final GrantedAuthority authority : authorities) %7B%0A            final String mappedAuthority = authorityMap.get(authority.getAuthority());%0A%0A            if (mappedAuthority != null) %7B%0A                output.add(new SimpleGrantedAuthority(mappedAuthority));%0A            %7D%0A        %7D%0A%0A        return output;%0A    %7D%0A%7D%0A

Add GrantedAuthoritiesMapper