public final void testGetGrantedAuthoritiesDontAddPrefixIfAlreadyExisting2() { String[] roles = {"Role1", "Role2", "role_Role3"}; String[] expectedGas = {"ROLE_Role1", "ROLE_Role2", "ROLE_role_Role3"}; SimpleAttributes2GrantedAuthoritiesMapper mapper = getDefaultMapper(); mapper.setAddPrefixIfAlreadyExisting(false); mapper.setAttributePrefix("ROLE_"); testGetGrantedAuthorities(mapper, roles, expectedGas); }
public final void testGetGrantedAuthoritiesCombination1() { String[] roles = {"Role1", "Role2", "role_Role3"}; String[] expectedGas = {"ROLE_ROLE1", "ROLE_ROLE2", "ROLE_ROLE3"}; SimpleAttributes2GrantedAuthoritiesMapper mapper = getDefaultMapper(); mapper.setAddPrefixIfAlreadyExisting(false); mapper.setConvertAttributeToUpperCase(true); mapper.setAttributePrefix("ROLE_"); testGetGrantedAuthorities(mapper, roles, expectedGas); }
private SimpleAttributes2GrantedAuthoritiesMapper getDefaultMapper() { SimpleAttributes2GrantedAuthoritiesMapper mapper = new SimpleAttributes2GrantedAuthoritiesMapper(); mapper.setAttributePrefix(""); mapper.setConvertAttributeToLowerCase(false); mapper.setConvertAttributeToUpperCase(false); mapper.setAddPrefixIfAlreadyExisting(false); return mapper; }