use of nl.knaw.huygens.timbuctoo.security.exceptions.UserCreationException in project timbuctoo by HuygensING.
the class LocalUserCreator method create.
public void create(Map<String, String> userInfo) throws UserCreationException {
String userPid = userInfo.get(USER_PID);
String userName = userInfo.get(USER_NAME);
String password = userInfo.get(PASSWORD);
String givenName = userInfo.get(GIVEN_NAME);
String surname = userInfo.get(SURNAME);
String emailAddress = userInfo.get(EMAIL_ADDRESS);
String organization = userInfo.get(ORGANIZATION);
String vreId = userInfo.get(VRE_ID);
String vreRole = userInfo.get(VRE_ROLE);
try {
loginCreator.createLogin(userPid, userName, password, givenName, surname, emailAddress, organization);
User user = userCreator.createUser(userPid, emailAddress, givenName, surname, organization);
authorizationCreator.createAuthorization(vreId, user, vreRole);
} catch (LoginCreationException e) {
throw new UserCreationException(e);
} catch (AuthorizationCreationException e) {
throw new UserCreationException(e);
}
}
use of nl.knaw.huygens.timbuctoo.security.exceptions.UserCreationException in project timbuctoo by HuygensING.
the class LocalUserCreatorTest method createThrowsAUserCreationExceptionWhenTheUserCreatorDoes.
@Test(expected = UserCreationException.class)
public void createThrowsAUserCreationExceptionWhenTheUserCreatorDoes() throws Exception {
doThrow(new UserCreationException("")).when(userCreator).createUser(anyString(), anyString(), anyString(), anyString(), anyString());
instance.create(userInfo);
}
use of nl.knaw.huygens.timbuctoo.security.exceptions.UserCreationException in project timbuctoo by HuygensING.
the class UserCreationTaskTest method executeRethrowsTheExceptionsOfTheLocalUserCreator.
@Test(expected = UserCreationException.class)
public void executeRethrowsTheExceptionsOfTheLocalUserCreator() throws Exception {
doThrow(new UserCreationException("")).when(localUserCreator).create(ArgumentMatchers.any());
ImmutableMultimap<String, String> immutableMultimap = ImmutableMultimap.<String, String>builder().put(UserInfoKeys.USER_PID, PID).put(UserInfoKeys.USER_NAME, USER_NAME).put(UserInfoKeys.PASSWORD, PWD).put(UserInfoKeys.GIVEN_NAME, GIVEN_NAME).put(UserInfoKeys.SURNAME, SURNAME).put(UserInfoKeys.EMAIL_ADDRESS, EMAIL).put(UserInfoKeys.ORGANIZATION, ORGANIZATION).put(UserInfoKeys.VRE_ID, VRE_ID).put(UserInfoKeys.VRE_ROLE, VRE_ROLE).build();
instance.execute(immutableMultimap, mock(PrintWriter.class));
}
Aggregations