use of rocks.coffeenet.autoconfigure.security.service.HumanCoffeeNetUser in project coffeenet-starter by coffeenet.
the class CoffeeNetPrincipalExtractorTest method extractPrincipalReturnHumanCoffeeUserIfClientOnlyKeyIsMissing.
@Test
public void extractPrincipalReturnHumanCoffeeUserIfClientOnlyKeyIsMissing() {
userInfoHashMap.remove("clientOnly");
Object principal = sut.extractPrincipal(userInfoHashMap);
assertThat(principal, instanceOf(HumanCoffeeNetUser.class));
HumanCoffeeNetUser humanCoffeeUser = (HumanCoffeeNetUser) principal;
assertThat(humanCoffeeUser.getEmail(), is("coffy@coffeenet"));
assertThat(humanCoffeeUser.getUsername(), is("coffy"));
assertThat(humanCoffeeUser.getAuthorities().size(), is(1));
}
use of rocks.coffeenet.autoconfigure.security.service.HumanCoffeeNetUser in project coffeenet-starter by coffeenet.
the class CoffeeNetPrincipalExtractorTest method extractPrincipalReturnsHumanCoffeeUserWithUnknownNameIfUsernameIsNotOfTypeString.
@Test
public void extractPrincipalReturnsHumanCoffeeUserWithUnknownNameIfUsernameIsNotOfTypeString() {
testPrincipal.put("username", true);
Object principal = sut.extractPrincipal(userInfoHashMap);
assertThat(principal, instanceOf(HumanCoffeeNetUser.class));
HumanCoffeeNetUser humanCoffeeUser = (HumanCoffeeNetUser) principal;
assertThat(humanCoffeeUser.getEmail(), is("coffy@coffeenet"));
assertThat(humanCoffeeUser.getUsername(), is("UNKNOWN"));
assertThat(humanCoffeeUser.getAuthorities().size(), is(1));
}
Aggregations