@Test(expected = LoginCreationException.class) public void createLoginThrowsLoginCreationExceptionWhenTheLoginsFileCannotBeRead() throws Exception { Path pathToNonExistingFile = FileHelpers.makeTempFilePath(false); JsonBasedAuthenticator instance = backedByFile(pathToNonExistingFile); instance.createLogin("userPid", "userName", "password", "givenName", "surname", "email", "org"); }
@Override public void createLogin(String userPid, String userName, String password, String givenName, String surname, String email, String organization) throws LoginCreationException { try { Login login = create(userPid, userName, password, givenName, surname, email, organization); loginAccess.addLogin(login); } catch (NoSuchAlgorithmException e) { LOG.error("Encryption algorithm can not be found.", e); throw new LoginCreationException(e.getMessage()); } }
JsonBasedAuthenticator implements Authenticator, LoginCreator { @Override public void createLogin(String userPid, String userName, String password, String givenName, String surname, String email, String organization) throws LoginCreationException { try { Login login = create(userPid, userName, password, givenName, surname, email, organization); loginAccess.addLogin(login); } catch (NoSuchAlgorithmException e) { LOG.error("Encryption algorithm can not be found.", e); throw new LoginCreationException(e.getMessage()); } } }
JsonBasedAuthenticator implements Authenticator, LoginCreator { @Override public void createLogin(String userPid, String userName, String password, String givenName, String surname, String email, String organization) throws LoginCreationException { try { Login login = create(userPid, userName, password, givenName, surname, email, organization); loginAccess.addLogin(login); } catch (NoSuchAlgorithmException e) { LOG.error("Encryption algorithm can not be found.", e); throw new LoginCreationException(e.getMessage()); } } JsonBasedAuthenticator(LoginAccess loginAccess, String encryptionAlgorithm); }
JsonBasedAuthenticator implements Authenticator, LoginCreator { @Override public void createLogin(String userPid, String userName, String password, String givenName, String surname, String email, String organization) throws LoginCreationException { try { Login login = create(userPid, userName, password, givenName, surname, email, organization); loginAccess.addLogin(login); } catch (NoSuchAlgorithmException e) { LOG.error("Encryption algorithm can not be found.", e); throw new LoginCreationException(e.getMessage()); } } JsonBasedAuthenticator(LoginAccess loginAccess, String encryptionAlgorithm); @Override Optional<String> authenticate(String username, String password); @Override void createLogin(String userPid, String userName, String password, String givenName, String surname,
                          String email, String organization); Login create(String userPid, String userName, String password, String givenName, String surname, String email,
                      String organization); }
JsonBasedAuthenticator implements Authenticator, LoginCreator { @Override public void createLogin(String userPid, String userName, String password, String givenName, String surname, String email, String organization) throws LoginCreationException { try { Login login = create(userPid, userName, password, givenName, surname, email, organization); loginAccess.addLogin(login); } catch (NoSuchAlgorithmException e) { LOG.error("Encryption algorithm can not be found.", e); throw new LoginCreationException(e.getMessage()); } } JsonBasedAuthenticator(LoginAccess loginAccess, String encryptionAlgorithm); @Override Optional<String> authenticate(String username, String password); @Override void createLogin(String userPid, String userName, String password, String givenName, String surname,
                          String email, String organization); Login create(String userPid, String userName, String password, String givenName, String surname, String email,
                      String organization); static final Logger LOG; }