@Test public void extractAuthoritiesReturnsDefaultAuthorityIfAuthoritiesIsNotOfTypeCollection() { testPrincipal.put("authorities", "ROLE_COFFEENET-USER"); List<GrantedAuthority> grantedAuthorities = sut.extractAuthorities(userInfoHashMap); assertThat(grantedAuthorities.size(), is(1)); assertThat(grantedAuthorities.contains(new SimpleGrantedAuthority("ROLE_UNKNOWN")), is(true)); }
@Override public List<GrantedAuthority> extractAuthorities(Map<String, Object> map) { List<GrantedAuthority> authoritiesList; if (map.containsKey(PRINCIPAL) && map.get(PRINCIPAL) instanceof Map) { authoritiesList = extractAuthoritiesOutOfPrincipal((Map) map.get(PRINCIPAL)); } else { LOGGER.warn(ERROR_MSG); authoritiesList = AuthorityUtils.commaSeparatedStringToAuthorityList(DEFAULT_AUTHORITY); } return authoritiesList; }
CoffeeNetAuthoritiesExtractor implements AuthoritiesExtractor { @Override public List<GrantedAuthority> extractAuthorities(Map<String, Object> map) { List<GrantedAuthority> authoritiesList; if (map.containsKey(PRINCIPAL) && map.get(PRINCIPAL) instanceof Map) { authoritiesList = extractAuthoritiesOutOfPrincipal((Map) map.get(PRINCIPAL)); } else { LOGGER.warn(ERROR_MSG); authoritiesList = AuthorityUtils.commaSeparatedStringToAuthorityList(DEFAULT_AUTHORITY); } return authoritiesList; } }
CoffeeNetAuthoritiesExtractor implements AuthoritiesExtractor { @Override public List<GrantedAuthority> extractAuthorities(Map<String, Object> map) { List<GrantedAuthority> authoritiesList; if (map.containsKey(PRINCIPAL) && map.get(PRINCIPAL) instanceof Map) { authoritiesList = extractAuthoritiesOutOfPrincipal((Map) map.get(PRINCIPAL)); } else { LOGGER.warn(ERROR_MSG); authoritiesList = AuthorityUtils.commaSeparatedStringToAuthorityList(DEFAULT_AUTHORITY); } return authoritiesList; }  }
CoffeeNetAuthoritiesExtractor implements AuthoritiesExtractor { @Override public List<GrantedAuthority> extractAuthorities(Map<String, Object> map) { List<GrantedAuthority> authoritiesList; if (map.containsKey(PRINCIPAL) && map.get(PRINCIPAL) instanceof Map) { authoritiesList = extractAuthoritiesOutOfPrincipal((Map) map.get(PRINCIPAL)); } else { LOGGER.warn(ERROR_MSG); authoritiesList = AuthorityUtils.commaSeparatedStringToAuthorityList(DEFAULT_AUTHORITY); } return authoritiesList; }  @Override List<GrantedAuthority> extractAuthorities(Map<String, Object> map); }
CoffeeNetAuthoritiesExtractor implements AuthoritiesExtractor { @Override public List<GrantedAuthority> extractAuthorities(Map<String, Object> map) { List<GrantedAuthority> authoritiesList; if (map.containsKey(PRINCIPAL) && map.get(PRINCIPAL) instanceof Map) { authoritiesList = extractAuthoritiesOutOfPrincipal((Map) map.get(PRINCIPAL)); } else { LOGGER.warn(ERROR_MSG); authoritiesList = AuthorityUtils.commaSeparatedStringToAuthorityList(DEFAULT_AUTHORITY); } return authoritiesList; }  @Override List<GrantedAuthority> extractAuthorities(Map<String, Object> map);  }