Index: trip-planner/src/main/java/finki/diplomska/tripplanner/web/rest/PlannerRestController.java
===================================================================
--- trip-planner/src/main/java/finki/diplomska/tripplanner/web/rest/PlannerRestController.java	(revision 1ad8e64a349fcc7c996155279b16efc2cfe001dd)
+++ trip-planner/src/main/java/finki/diplomska/tripplanner/web/rest/PlannerRestController.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.service.LocationService;
@@ -9,7 +10,9 @@
 import org.springframework.http.MediaType;
 import org.springframework.http.ResponseEntity;
+import org.springframework.security.core.Authentication;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.bind.annotation.RestController;
 
+import javax.validation.Valid;
 import java.util.ArrayList;
 import java.util.List;
@@ -17,5 +20,5 @@
 
 @RestController
-@CrossOrigin(origins = "http://localhost:4200")
+@CrossOrigin(origins = "http://localhost:4200",  exposedHeaders = "token")
 @RequestMapping(value = "/api")
 public class PlannerRestController {
@@ -31,4 +34,11 @@
     public List<Planner> getAllPlanners(){
         return this.plannerService.getAllPlaners();
+    }
+
+
+    @GetMapping(value = "/planners/user")
+    public List<Planner> getPlannersByUser(Authentication authentication){
+        User user = (User) authentication.getPrincipal();
+        return this.plannerService.getPlannersByUser(user.getUsername());
     }
 
@@ -57,6 +67,8 @@
     @PostMapping(value = "/planner/new", consumes= MediaType.APPLICATION_JSON_VALUE)
     @ResponseStatus(HttpStatus.CREATED)
-    public ResponseEntity<Planner> newPlanner(@RequestBody PlannerDto plannerDto)  {
-        return this.plannerService.newPlanner(plannerDto)
+    public ResponseEntity<?> newPlanner(@Valid @RequestBody PlannerDto plannerDto, Authentication authentication)  {
+
+        User user = (User) authentication.getPrincipal();
+        return this.plannerService.newPlanner(plannerDto, user.getUsername())
                 .map(planner -> ResponseEntity.ok().body(planner))
                 .orElseGet(() -> ResponseEntity.badRequest().build());
@@ -65,6 +77,7 @@
 
     @PutMapping(value ="edit/planner/{id}", consumes= MediaType.APPLICATION_JSON_VALUE)
-    public ResponseEntity<Planner> editPlanner(@PathVariable Long id, @RequestBody PlannerDto plannerDto){
-        return this.plannerService.editPlanner(id, plannerDto)
+    public ResponseEntity<Planner> editPlanner(@PathVariable Long id, @Valid @RequestBody PlannerDto plannerDto, Authentication authentication){
+        User user = (User) authentication.getPrincipal();
+        return this.plannerService.editPlanner(id, plannerDto, user.getUsername())
                 .map(planner -> ResponseEntity.ok().body(planner))
                 .orElseGet(()-> ResponseEntity.badRequest().build());
Index: trip-planner/src/main/java/finki/diplomska/tripplanner/web/rest/UserController.java
===================================================================
--- trip-planner/src/main/java/finki/diplomska/tripplanner/web/rest/UserController.java	(revision 1ad8e64a349fcc7c996155279b16efc2cfe001dd)
+++ trip-planner/src/main/java/finki/diplomska/tripplanner/web/rest/UserController.java	(revision 84d0fbb56bfbe319ba63e3327f1777ac5d841f83)
@@ -3,4 +3,8 @@
 import finki.diplomska.tripplanner.models.User;
 import finki.diplomska.tripplanner.models.dto.UserDto;
+import finki.diplomska.tripplanner.payload.JWTLoginSucessReponse;
+import finki.diplomska.tripplanner.payload.LoginRequest;
+import finki.diplomska.tripplanner.security.JwtTokenProvider;
+import finki.diplomska.tripplanner.security.SecurityConstants;
 import finki.diplomska.tripplanner.service.UserService;
 import finki.diplomska.tripplanner.service.impl.MapValidationErrorService;
@@ -9,7 +13,10 @@
 import org.springframework.http.HttpStatus;
 import org.springframework.http.ResponseEntity;
+import org.springframework.security.authentication.AuthenticationManager;
+import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
+import org.springframework.security.core.context.SecurityContextHolder;
 import org.springframework.validation.BindingResult;
 import org.springframework.web.bind.annotation.*;
-
+import org.springframework.security.core.Authentication;
 import javax.validation.Valid;
 
@@ -28,5 +35,29 @@
     private UserValidator userValidator;
 
-    @PostMapping("/register")
+    @Autowired
+    private JwtTokenProvider tokenProvider;
+
+    @Autowired
+    private AuthenticationManager authenticationManager;
+
+    @PostMapping(value = "/login")
+    public ResponseEntity<?> authenticateUser(@Valid @RequestBody LoginRequest loginRequest, BindingResult result){
+        ResponseEntity<?> errorMap = mapValidationErrorService.MapValidationService(result);
+        if(errorMap != null) return errorMap;
+
+        Authentication authentication = authenticationManager.authenticate(
+                new UsernamePasswordAuthenticationToken(
+                        loginRequest.getUsername(),
+                        loginRequest.getPassword()
+                )
+        );
+
+        SecurityContextHolder.getContext().setAuthentication(authentication);
+        String jwt = SecurityConstants.TOKEN_PREFIX +  tokenProvider.generateToken(authentication);
+
+        return ResponseEntity.ok(new JWTLoginSucessReponse(true, jwt));
+    }
+
+    @PostMapping(value = "/register")
     public ResponseEntity<?> registerUser(@Valid @RequestBody User user, BindingResult result){
         // Validate passwords match
@@ -38,4 +69,5 @@
 
         return  new ResponseEntity<User>(newUser, HttpStatus.CREATED);
+
     }
 }
