Index: trip-planner/src/main/java/finki/diplomska/tripplanner/service/PlannerService.java
===================================================================
--- trip-planner/src/main/java/finki/diplomska/tripplanner/service/PlannerService.java	(revision 1ad8e64a349fcc7c996155279b16efc2cfe001dd)
+++ trip-planner/src/main/java/finki/diplomska/tripplanner/service/PlannerService.java	(revision 84d0fbb56bfbe319ba63e3327f1777ac5d841f83)
@@ -11,8 +11,9 @@
 
         Planner createPlannerWithRequestParams(String description, String name, List<Location> locationList);
-        Optional<Planner> editPlanner(Long id, PlannerDto plannerDto);
+        Optional<Planner> editPlanner(Long id, PlannerDto plannerDto, String username);
         List<Planner> getAllPlaners();
+        List<Planner> getPlannersByUser(String username);
         Optional<Planner> findById(Long id);
         Planner editPlannerWithRequestParams(Long id, String description, String name, List<Location> locationList);
-        Optional<Planner> newPlanner(PlannerDto plannerDto);
+        Optional<Planner> newPlanner(PlannerDto plannerDto, String username);
 }
Index: trip-planner/src/main/java/finki/diplomska/tripplanner/service/UserService.java
===================================================================
--- trip-planner/src/main/java/finki/diplomska/tripplanner/service/UserService.java	(revision 1ad8e64a349fcc7c996155279b16efc2cfe001dd)
+++ trip-planner/src/main/java/finki/diplomska/tripplanner/service/UserService.java	(revision 84d0fbb56bfbe319ba63e3327f1777ac5d841f83)
@@ -2,5 +2,7 @@
 
 import finki.diplomska.tripplanner.models.User;
+import finki.diplomska.tripplanner.models.dto.UserDto;
 
+import java.util.Optional;
 
 
Index: trip-planner/src/main/java/finki/diplomska/tripplanner/service/impl/CustomUserDetailsServiceImpl.java
===================================================================
--- trip-planner/src/main/java/finki/diplomska/tripplanner/service/impl/CustomUserDetailsServiceImpl.java	(revision 84d0fbb56bfbe319ba63e3327f1777ac5d841f83)
+++ trip-planner/src/main/java/finki/diplomska/tripplanner/service/impl/CustomUserDetailsServiceImpl.java	(revision 84d0fbb56bfbe319ba63e3327f1777ac5d841f83)
@@ -0,0 +1,34 @@
+package finki.diplomska.tripplanner.service.impl;
+
+import finki.diplomska.tripplanner.models.User;
+import finki.diplomska.tripplanner.repository.jpa.JpaUserRepository;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.core.userdetails.UserDetails;
+import org.springframework.security.core.userdetails.UserDetailsService;
+import org.springframework.security.core.userdetails.UsernameNotFoundException;
+import org.springframework.stereotype.Service;
+
+import javax.transaction.Transactional;
+
+@Service
+public class CustomUserDetailsServiceImpl implements UserDetailsService {
+
+    @Autowired
+    private JpaUserRepository userRepository;
+
+    @Override
+    public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
+        User user = userRepository.findByUsername(username);
+        if(user==null) new UsernameNotFoundException("User not found");
+        return user;
+    }
+
+
+    @Transactional
+    public User loadUserById(Long id){
+        User user = userRepository.getById(id);
+        if(user==null) new UsernameNotFoundException("User not found");
+        return user;
+
+    }
+}
Index: trip-planner/src/main/java/finki/diplomska/tripplanner/service/impl/PlannerServiceImpl.java
===================================================================
--- trip-planner/src/main/java/finki/diplomska/tripplanner/service/impl/PlannerServiceImpl.java	(revision 1ad8e64a349fcc7c996155279b16efc2cfe001dd)
+++ trip-planner/src/main/java/finki/diplomska/tripplanner/service/impl/PlannerServiceImpl.java	(revision 84d0fbb56bfbe319ba63e3327f1777ac5d841f83)
@@ -3,4 +3,5 @@
 import finki.diplomska.tripplanner.models.Location;
 import finki.diplomska.tripplanner.models.Planner;
+import finki.diplomska.tripplanner.models.User;
 import finki.diplomska.tripplanner.models.dto.PlannerDto;
 import finki.diplomska.tripplanner.models.exceptions.LocationNotFoundException;
@@ -8,10 +9,9 @@
 import finki.diplomska.tripplanner.repository.jpa.JpaLocationRepository;
 import finki.diplomska.tripplanner.repository.jpa.JpaPlannerRepository;
-import finki.diplomska.tripplanner.service.LocationService;
+import finki.diplomska.tripplanner.repository.jpa.JpaUserRepository;
 import finki.diplomska.tripplanner.service.PlannerService;
 import org.springframework.stereotype.Service;
-import reactor.util.annotation.Nullable;
 
-import java.util.ArrayList;
+import javax.jws.soap.SOAPBinding;
 import java.util.List;
 import java.util.Optional;
@@ -22,8 +22,10 @@
     private final JpaPlannerRepository plannerRepository;
     private final JpaLocationRepository locationRepository;
+    private final JpaUserRepository userRepository;
 
-    public PlannerServiceImpl(JpaPlannerRepository plannerRepository, JpaLocationRepository locationRepository) {
+    public PlannerServiceImpl(JpaPlannerRepository plannerRepository, JpaLocationRepository locationRepository, JpaUserRepository userRepository) {
         this.plannerRepository = plannerRepository;
         this.locationRepository = locationRepository;
+        this.userRepository = userRepository;
     }
 
@@ -31,4 +33,10 @@
     public List<Planner> getAllPlaners() {
         return this.plannerRepository.findAll();
+    }
+
+    @Override
+    public List<Planner> getPlannersByUser(String username) {
+        User user = this.userRepository.findByUsername(username);
+        return this.plannerRepository.getPlannersByUser(user.getUsername());
     }
 
@@ -40,5 +48,5 @@
 
     @Override
-    public Optional<Planner> newPlanner(PlannerDto plannerDto) {
+    public Optional<Planner> newPlanner(PlannerDto plannerDto, String username) {
         /*
         List<Location> locationList  = new ArrayList<>();
@@ -48,7 +56,8 @@
             locationList.add(loc);
         }
-
          */
-           return Optional.of(this.plannerRepository.save(new Planner(plannerDto.getName(), plannerDto.getDescription(), null)));
+        User user = this.userRepository.findByUsername(username);
+        plannerDto.setUser(user.getUsername());
+        return Optional.of(this.plannerRepository.save(new Planner(plannerDto.getName(), plannerDto.getDescription(), null, user)));
     }
 
@@ -69,9 +78,12 @@
 
     @Override
-    public Optional<Planner> editPlanner(Long id, PlannerDto plannerDto) {
+    public Optional<Planner> editPlanner(Long id, PlannerDto plannerDto, String username) {
         Planner planner = this.plannerRepository.findById(id).orElseThrow(() -> new PlannerNotFoundException(id));
+        User user = this.userRepository.findByUsername(username);
 
         planner.setName(plannerDto.getName());
         planner.setDescription(plannerDto.getDescription());
+        plannerDto.setUser(user.getUsername());
+        planner.setUser(user);
 /*
         List<Location> locationList  = new ArrayList<>();
Index: trip-planner/src/main/java/finki/diplomska/tripplanner/service/impl/UserServiceImpl.java
===================================================================
--- trip-planner/src/main/java/finki/diplomska/tripplanner/service/impl/UserServiceImpl.java	(revision 1ad8e64a349fcc7c996155279b16efc2cfe001dd)
+++ trip-planner/src/main/java/finki/diplomska/tripplanner/service/impl/UserServiceImpl.java	(revision 84d0fbb56bfbe319ba63e3327f1777ac5d841f83)
@@ -9,4 +9,6 @@
 import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
 import org.springframework.stereotype.Service;
+
+import java.util.Optional;
 
 
@@ -28,5 +30,5 @@
             // We don't persist or show the confirmPassword
             newUser.setConfirmPassword("");
-            return this.userRepository.save(newUser);
+             return this.userRepository.save(newUser);
         }catch(Exception e){
             throw new UsernameAlreadyExistsException("Username '"+newUser.getUsername()+ "' already exists");
