@Test public void extractPrincipalReturnsHumanCoffeeUserWithUnknownMailIfPrincipalDoesNotContainMailKey() { testPrincipal.remove("mail"); Object principal = sut.extractPrincipal(userInfoHashMap); assertThat(principal, instanceOf(HumanCoffeeNetUser.class)); HumanCoffeeNetUser humanCoffeeUser = (HumanCoffeeNetUser) principal; assertThat(humanCoffeeUser.getEmail(), is("UNKNOWN")); assertThat(humanCoffeeUser.getUsername(), is("coffy")); assertThat(humanCoffeeUser.getAuthorities().size(), is(1)); }
@Override public Object extractPrincipal(Map<String, Object> map) { if ((boolean) map.getOrDefault("clientOnly", false)) { return extractClientDetails(map); } else { return extractUserDetails(map); } }
CoffeeNetPrincipalExtractor implements PrincipalExtractor { @Override public Object extractPrincipal(Map<String, Object> map) { if ((boolean) map.getOrDefault("clientOnly", false)) { return extractClientDetails(map); } else { return extractUserDetails(map); } } }
CoffeeNetPrincipalExtractor implements PrincipalExtractor { @Override public Object extractPrincipal(Map<String, Object> map) { if ((boolean) map.getOrDefault("clientOnly", false)) { return extractClientDetails(map); } else { return extractUserDetails(map); } } CoffeeNetPrincipalExtractor(AuthoritiesExtractor authoritiesExtractor); }
CoffeeNetPrincipalExtractor implements PrincipalExtractor { @Override public Object extractPrincipal(Map<String, Object> map) { if ((boolean) map.getOrDefault("clientOnly", false)) { return extractClientDetails(map); } else { return extractUserDetails(map); } } CoffeeNetPrincipalExtractor(AuthoritiesExtractor authoritiesExtractor); @Override Object extractPrincipal(Map<String, Object> map); }
CoffeeNetPrincipalExtractor implements PrincipalExtractor { @Override public Object extractPrincipal(Map<String, Object> map) { if ((boolean) map.getOrDefault("clientOnly", false)) { return extractClientDetails(map); } else { return extractUserDetails(map); } } CoffeeNetPrincipalExtractor(AuthoritiesExtractor authoritiesExtractor); @Override Object extractPrincipal(Map<String, Object> map);  }