private <E> E executePrincipalQuery(
        QueryConfiguration configuration, ResultSetCallback<E> resultSetCallback) {
      String sql = configuration.getSql();

      try (Connection connection = getConnection(configuration);
          PreparedStatement preparedStatement = connection.prepareStatement(sql)) {
        preparedStatement.setString(1, name);

        try (ResultSet resultSet = preparedStatement.executeQuery()) {
          return resultSetCallback.handle(resultSet);
        }
      } catch (SQLException e) {
        throw log.couldNotExecuteQuery(sql, e);
      } catch (Exception e) {
        throw log.unexpectedErrorWhenProcessingAuthenticationQuery(sql, e);
      }
    }