Index: src/main/java/com/example/autopartz/AutoPartzApplication.java
===================================================================
--- src/main/java/com/example/autopartz/AutoPartzApplication.java	(revision 6832924aea48cf018493a76963bd8f3ed906c750)
+++ src/main/java/com/example/autopartz/AutoPartzApplication.java	(revision ae042f4e3a0991ca325450a43e0ce8efdd5fb6e4)
@@ -3,4 +3,7 @@
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.context.annotation.Bean;
+import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
+import org.springframework.security.crypto.password.PasswordEncoder;
 
 @SpringBootApplication
@@ -10,4 +13,9 @@
         SpringApplication.run(AutoPartzApplication.class, args);
     }
+    @Bean
+    PasswordEncoder passwordEncoder() {
+        return new BCryptPasswordEncoder(10);
+    }
+
 
 }
Index: src/main/java/com/example/autopartz/config/CustomUsernamePasswordAuthenticationProvider.java
===================================================================
--- src/main/java/com/example/autopartz/config/CustomUsernamePasswordAuthenticationProvider.java	(revision ae042f4e3a0991ca325450a43e0ce8efdd5fb6e4)
+++ src/main/java/com/example/autopartz/config/CustomUsernamePasswordAuthenticationProvider.java	(revision ae042f4e3a0991ca325450a43e0ce8efdd5fb6e4)
@@ -0,0 +1,49 @@
+package com.example.autopartz.config;
+
+import com.example.autopartz.service.UserService;
+import org.springframework.security.authentication.AuthenticationProvider;
+import org.springframework.security.authentication.BadCredentialsException;
+import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
+import org.springframework.security.core.Authentication;
+import org.springframework.security.core.AuthenticationException;
+import org.springframework.security.core.userdetails.UserDetails;
+import org.springframework.security.crypto.password.PasswordEncoder;
+import org.springframework.stereotype.Component;
+
+import java.util.Objects;
+
+@Component
+public class CustomUsernamePasswordAuthenticationProvider implements AuthenticationProvider {
+
+    private final UserService userService;
+    private final PasswordEncoder passwordEncoder;
+
+    public CustomUsernamePasswordAuthenticationProvider(UserService userService, PasswordEncoder passwordEncoder) {
+        this.userService = userService;
+        this.passwordEncoder = passwordEncoder;
+    }
+
+    @Override
+    public Authentication authenticate(Authentication authentication) throws AuthenticationException {
+        String username = authentication.getName();
+        String password = authentication.getCredentials().toString();
+
+        if ("".equals(username) || "".equals(password)) {
+            throw new BadCredentialsException("Invalid Credentials");
+        }
+
+        UserDetails userDetails = this.userService.findByUsername(username);
+        String realPassword = userDetails.getPassword();
+        if (!Objects.equals(password,realPassword)) {
+            throw new BadCredentialsException("Password is incorrect!");
+        }
+        return new UsernamePasswordAuthenticationToken(userDetails, userDetails.getPassword(), userDetails.getAuthorities());
+
+    }
+
+    @Override   
+    public boolean supports(Class<?> aClass) {
+        return aClass.equals(UsernamePasswordAuthenticationToken.class);
+    }
+}
+
Index: src/main/java/com/example/autopartz/config/WebSecurityConfig.java
===================================================================
--- src/main/java/com/example/autopartz/config/WebSecurityConfig.java	(revision ae042f4e3a0991ca325450a43e0ce8efdd5fb6e4)
+++ src/main/java/com/example/autopartz/config/WebSecurityConfig.java	(revision ae042f4e3a0991ca325450a43e0ce8efdd5fb6e4)
@@ -0,0 +1,60 @@
+package com.example.autopartz.config;
+
+import org.springframework.context.annotation.Configuration;
+import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
+import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
+import org.springframework.security.config.annotation.web.builders.HttpSecurity;
+import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
+import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
+import org.springframework.security.crypto.password.PasswordEncoder;
+
+@Configuration
+@EnableWebSecurity
+@EnableGlobalMethodSecurity(securedEnabled = true, prePostEnabled = true)
+public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
+
+    private final PasswordEncoder passwordEncoder;
+    private final CustomUsernamePasswordAuthenticationProvider authenticationProvider;
+
+    public WebSecurityConfig(PasswordEncoder passwordEncoder,
+                             CustomUsernamePasswordAuthenticationProvider authenticationProvider) {
+        this.passwordEncoder = passwordEncoder;
+        this.authenticationProvider = authenticationProvider;
+    }
+
+    @Override
+    protected void configure(HttpSecurity http) throws Exception {
+
+        http.csrf().disable()
+                .authorizeRequests()
+                .antMatchers("/", "/products", "/services", "/filtered", "/login", "/register").permitAll()
+                .antMatchers("/orders/*","/repairs/*","/reviews/*","/part/*").hasRole("CLIENT")
+                .anyRequest()
+                .authenticated()
+                .and()
+                .formLogin()
+                .loginPage("/login").permitAll()
+                .failureUrl("/login?error=BadCredentials")
+                .defaultSuccessUrl("/", true)
+                .and()
+                .logout()
+                .logoutUrl("/logout")
+                .clearAuthentication(true)
+                .invalidateHttpSession(true)
+                .deleteCookies("JSESSIONID")
+                .logoutSuccessUrl("/")
+                .and()
+                .exceptionHandling().accessDeniedPage("/access_denied");
+
+    }
+
+    @Override
+    protected void configure(AuthenticationManagerBuilder auth) {
+        auth.authenticationProvider(authenticationProvider);
+    }
+
+
+
+}
+
+
Index: src/main/java/com/example/autopartz/controller/HomeController.java
===================================================================
--- src/main/java/com/example/autopartz/controller/HomeController.java	(revision 6832924aea48cf018493a76963bd8f3ed906c750)
+++ src/main/java/com/example/autopartz/controller/HomeController.java	(revision ae042f4e3a0991ca325450a43e0ce8efdd5fb6e4)
@@ -14,4 +14,6 @@
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestParam;
+
+import javax.servlet.http.HttpServletRequest;
 
 @Controller
@@ -35,6 +37,7 @@
 
     @GetMapping()
-    public String getHomePage(Model model){
+    public String getHomePage(Model model, HttpServletRequest request){
         model.addAttribute("bodyContent","home");
+        model.addAttribute("user",request.getRemoteUser());
         return "master-template";
     }
Index: src/main/java/com/example/autopartz/controller/PartController.java
===================================================================
--- src/main/java/com/example/autopartz/controller/PartController.java	(revision 6832924aea48cf018493a76963bd8f3ed906c750)
+++ src/main/java/com/example/autopartz/controller/PartController.java	(revision ae042f4e3a0991ca325450a43e0ce8efdd5fb6e4)
@@ -5,9 +5,9 @@
 import com.example.autopartz.service.PriceService;
 import com.example.autopartz.service.RepairShopService;
-import jakarta.servlet.http.HttpServletResponse;
 import org.springframework.stereotype.Controller;
 import org.springframework.ui.Model;
 import org.springframework.web.bind.annotation.*;
 
+import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
 
@@ -24,5 +24,5 @@
     }
     @GetMapping("/{id}")
-    public String getPartPage(@PathVariable Long id, Model model){
+    public String getPartPage(@PathVariable Integer id, Model model){
         Part temp = partService.findById(id);
         Integer amount = priceService.findPriceForPart(temp).stream().findFirst().orElseThrow(RuntimeException::new).getAmount();
@@ -33,5 +33,5 @@
     }
     @GetMapping("/delivery/{id}")
-    public String getDeliveryPage(@PathVariable Long id, Model model){
+    public String getDeliveryPage(@PathVariable Integer id, Model model){
         model.addAttribute("repairShops",repairShopService.findAll());
         model.addAttribute("partId",id);
Index: src/main/java/com/example/autopartz/controller/UserController.java
===================================================================
--- src/main/java/com/example/autopartz/controller/UserController.java	(revision 6832924aea48cf018493a76963bd8f3ed906c750)
+++ src/main/java/com/example/autopartz/controller/UserController.java	(revision ae042f4e3a0991ca325450a43e0ce8efdd5fb6e4)
@@ -1,33 +1,26 @@
 package com.example.autopartz.controller;
 
-import com.example.autopartz.model.*;
-import com.example.autopartz.model.views.*;
-import com.example.autopartz.repository.*;
-import com.example.autopartz.service.UserService;
+import com.example.autopartz.repository.OrdersForUserRepository;
+import com.example.autopartz.repository.RepairsForUserRepository;
+import com.example.autopartz.repository.ReviewsForUserRepository;
 import org.springframework.stereotype.Controller;
 import org.springframework.ui.Model;
-import org.springframework.web.bind.annotation.*;
-
-import java.util.List;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestMapping;
 
 @Controller
 @RequestMapping("/")
 public class UserController {
-    private final UserService userService;
     private final OrdersForUserRepository ordersForUserRepository;
     private final RepairsForUserRepository repairsForUserRepository;
     private final ReviewsForUserRepository reviewsForUserRepository;
-    public UserController(UserService userService, OrdersForUserRepository ordersForUserRepository, RepairsForUserRepository repairsForUserRepository, ReviewsForUserRepository reviewsForUserRepository) {
-        this.userService = userService;
+    public UserController(OrdersForUserRepository ordersForUserRepository, RepairsForUserRepository repairsForUserRepository, ReviewsForUserRepository reviewsForUserRepository) {
         this.ordersForUserRepository = ordersForUserRepository;
         this.repairsForUserRepository = repairsForUserRepository;
         this.reviewsForUserRepository = reviewsForUserRepository;
     }
-    @GetMapping("usersTest")
-    public List<User> getAllUsers(){
-        return userService.findAllUsers();
-    }
     @GetMapping("orders/{id}")
-    public String getOrdersForUser(@PathVariable Long id, Model model){
+    public String getOrdersForUser(@PathVariable Integer id, Model model){
         model.addAttribute("userOrders",ordersForUserRepository.findAllByUserid(id));
         model.addAttribute("bodyContent","ordersForUser");
@@ -35,5 +28,5 @@
     }
     @GetMapping("repairs/{id}")
-    public String getRepairsForUser(@PathVariable Long id,Model model){
+    public String getRepairsForUser(@PathVariable Integer id,Model model){
         model.addAttribute("userRepairs",repairsForUserRepository.findAllByUserid(id));
         model.addAttribute("bodyContent","repairsForUser");
@@ -41,5 +34,5 @@
     }
     @GetMapping("reviews/{id}")
-    public String getReviewsForUser(@PathVariable Long id, Model model){
+    public String getReviewsForUser(@PathVariable Integer id, Model model){
         model.addAttribute("userReviews",reviewsForUserRepository.findAllByUserid(id));
         model.addAttribute("bodyContent","reviewsForUser");
Index: src/main/java/com/example/autopartz/model/Administrator.java
===================================================================
--- src/main/java/com/example/autopartz/model/Administrator.java	(revision 6832924aea48cf018493a76963bd8f3ed906c750)
+++ src/main/java/com/example/autopartz/model/Administrator.java	(revision ae042f4e3a0991ca325450a43e0ce8efdd5fb6e4)
@@ -1,9 +1,14 @@
 package com.example.autopartz.model;
 
-import jakarta.persistence.*;
-import lombok.*;
+import lombok.Getter;
+import lombok.Setter;
+import lombok.ToString;
 import org.hibernate.Hibernate;
+import org.springframework.security.core.GrantedAuthority;
 
+import javax.persistence.Entity;
 import java.time.LocalDate;
+import java.util.Collection;
+import java.util.Collections;
 import java.util.Objects;
 
@@ -29,3 +34,8 @@
         return getClass().hashCode();
     }
+
+    @Override
+    public Collection<? extends GrantedAuthority> getAuthorities() {
+        return Collections.singletonList(Role.ROLE_ADMIN);
+    }
 }
Index: src/main/java/com/example/autopartz/model/Car.java
===================================================================
--- src/main/java/com/example/autopartz/model/Car.java	(revision 6832924aea48cf018493a76963bd8f3ed906c750)
+++ src/main/java/com/example/autopartz/model/Car.java	(revision ae042f4e3a0991ca325450a43e0ce8efdd5fb6e4)
@@ -1,8 +1,11 @@
 package com.example.autopartz.model;
 
-import jakarta.persistence.*;
-import lombok.*;
+import lombok.Getter;
+import lombok.RequiredArgsConstructor;
+import lombok.Setter;
+import lombok.ToString;
 import org.hibernate.Hibernate;
 
+import javax.persistence.*;
 import java.util.Objects;
 
@@ -15,5 +18,5 @@
 public class Car {
     @Id
-    Long ID_car;
+    Integer ID_car;
     Integer in_production_since;
     Integer in_production_till;
Index: src/main/java/com/example/autopartz/model/CarManufacturer.java
===================================================================
--- src/main/java/com/example/autopartz/model/CarManufacturer.java	(revision 6832924aea48cf018493a76963bd8f3ed906c750)
+++ src/main/java/com/example/autopartz/model/CarManufacturer.java	(revision ae042f4e3a0991ca325450a43e0ce8efdd5fb6e4)
@@ -1,10 +1,13 @@
 package com.example.autopartz.model;
 
-import jakarta.persistence.Entity;
-import jakarta.persistence.Id;
-import jakarta.persistence.Table;
-import lombok.*;
+import lombok.Getter;
+import lombok.RequiredArgsConstructor;
+import lombok.Setter;
+import lombok.ToString;
 import org.hibernate.Hibernate;
 
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.Table;
 import java.util.Objects;
 
@@ -17,5 +20,5 @@
 public class CarManufacturer {
     @Id
-    Long ID_car_manufacturer;
+    Integer ID_car_manufacturer;
     String cm_name;
     String cm_country;
Index: src/main/java/com/example/autopartz/model/CarSample.java
===================================================================
--- src/main/java/com/example/autopartz/model/CarSample.java	(revision 6832924aea48cf018493a76963bd8f3ed906c750)
+++ src/main/java/com/example/autopartz/model/CarSample.java	(revision ae042f4e3a0991ca325450a43e0ce8efdd5fb6e4)
@@ -1,8 +1,11 @@
 package com.example.autopartz.model;
 
-import jakarta.persistence.*;
-import lombok.*;
+import lombok.Getter;
+import lombok.RequiredArgsConstructor;
+import lombok.Setter;
+import lombok.ToString;
 import org.hibernate.Hibernate;
 
+import javax.persistence.*;
 import java.util.Objects;
 
Index: src/main/java/com/example/autopartz/model/Category.java
===================================================================
--- src/main/java/com/example/autopartz/model/Category.java	(revision 6832924aea48cf018493a76963bd8f3ed906c750)
+++ src/main/java/com/example/autopartz/model/Category.java	(revision ae042f4e3a0991ca325450a43e0ce8efdd5fb6e4)
@@ -1,8 +1,11 @@
 package com.example.autopartz.model;
 
-import jakarta.persistence.*;
-import lombok.*;
+import lombok.Getter;
+import lombok.RequiredArgsConstructor;
+import lombok.Setter;
+import lombok.ToString;
 import org.hibernate.Hibernate;
 
+import javax.persistence.*;
 import java.util.Objects;
 
@@ -14,5 +17,5 @@
 public class Category {
     @Id
-    Long ID_category;
+    Integer ID_category;
     @Column(name = "category_name")
     String cname;
Index: src/main/java/com/example/autopartz/model/Client.java
===================================================================
--- src/main/java/com/example/autopartz/model/Client.java	(revision 6832924aea48cf018493a76963bd8f3ed906c750)
+++ src/main/java/com/example/autopartz/model/Client.java	(revision ae042f4e3a0991ca325450a43e0ce8efdd5fb6e4)
@@ -1,8 +1,14 @@
 package com.example.autopartz.model;
 
-import jakarta.persistence.Entity;
-import lombok.*;
+import lombok.Getter;
+import lombok.RequiredArgsConstructor;
+import lombok.Setter;
+import lombok.ToString;
 import org.hibernate.Hibernate;
+import org.springframework.security.core.GrantedAuthority;
 
+import javax.persistence.Entity;
+import java.util.Collection;
+import java.util.Collections;
 import java.util.Objects;
 
@@ -25,3 +31,7 @@
         return getClass().hashCode();
     }
+    @Override
+    public Collection<? extends GrantedAuthority> getAuthorities() {
+        return Collections.singletonList(Role.ROLE_CLIENT);
+    }
 }
Index: src/main/java/com/example/autopartz/model/Delivery.java
===================================================================
--- src/main/java/com/example/autopartz/model/Delivery.java	(revision 6832924aea48cf018493a76963bd8f3ed906c750)
+++ src/main/java/com/example/autopartz/model/Delivery.java	(revision ae042f4e3a0991ca325450a43e0ce8efdd5fb6e4)
@@ -1,8 +1,11 @@
 package com.example.autopartz.model;
 
-import jakarta.persistence.*;
-import lombok.*;
+import lombok.Getter;
+import lombok.RequiredArgsConstructor;
+import lombok.Setter;
+import lombok.ToString;
 import org.hibernate.Hibernate;
 
+import javax.persistence.*;
 import java.util.Objects;
 
@@ -14,5 +17,5 @@
 public class Delivery {
     @Id
-    Long ID_delivery;
+    Integer ID_delivery;
     String delivery_status;
     String delivery_address;
Index: src/main/java/com/example/autopartz/model/Deliveryman.java
===================================================================
--- src/main/java/com/example/autopartz/model/Deliveryman.java	(revision 6832924aea48cf018493a76963bd8f3ed906c750)
+++ src/main/java/com/example/autopartz/model/Deliveryman.java	(revision ae042f4e3a0991ca325450a43e0ce8efdd5fb6e4)
@@ -1,10 +1,16 @@
 package com.example.autopartz.model;
 
-import jakarta.persistence.Entity;
-import jakarta.persistence.Table;
-import lombok.*;
+import lombok.Getter;
+import lombok.RequiredArgsConstructor;
+import lombok.Setter;
+import lombok.ToString;
 import org.hibernate.Hibernate;
+import org.springframework.security.core.GrantedAuthority;
 
+import javax.persistence.Entity;
+import javax.persistence.Table;
 import java.time.LocalDate;
+import java.util.Collection;
+import java.util.Collections;
 import java.util.Objects;
 
@@ -30,3 +36,7 @@
         return getClass().hashCode();
     }
+    @Override
+    public Collection<? extends GrantedAuthority> getAuthorities() {
+        return Collections.singletonList(Role.ROLE_DELIVERYMAN);
+    }
 }
Index: src/main/java/com/example/autopartz/model/Order.java
===================================================================
--- src/main/java/com/example/autopartz/model/Order.java	(revision 6832924aea48cf018493a76963bd8f3ed906c750)
+++ src/main/java/com/example/autopartz/model/Order.java	(revision ae042f4e3a0991ca325450a43e0ce8efdd5fb6e4)
@@ -1,8 +1,11 @@
 package com.example.autopartz.model;
 
-import jakarta.persistence.*;
-import lombok.*;
+import lombok.Getter;
+import lombok.RequiredArgsConstructor;
+import lombok.Setter;
+import lombok.ToString;
 import org.hibernate.Hibernate;
 
+import javax.persistence.*;
 import java.time.LocalDateTime;
 import java.util.List;
@@ -17,5 +20,5 @@
 public class Order {
     @Id
-    Long ID_order;
+    Integer ID_order;
     String order_status;
     LocalDateTime order_date;
Index: src/main/java/com/example/autopartz/model/Part.java
===================================================================
--- src/main/java/com/example/autopartz/model/Part.java	(revision 6832924aea48cf018493a76963bd8f3ed906c750)
+++ src/main/java/com/example/autopartz/model/Part.java	(revision ae042f4e3a0991ca325450a43e0ce8efdd5fb6e4)
@@ -1,5 +1,4 @@
 package com.example.autopartz.model;
 
-import jakarta.persistence.*;
 import lombok.Getter;
 import lombok.RequiredArgsConstructor;
@@ -8,4 +7,5 @@
 import org.hibernate.Hibernate;
 
+import javax.persistence.*;
 import java.util.List;
 import java.util.Objects;
@@ -19,5 +19,5 @@
     @Id
     @Column(name = "ID_part")
-    Long id;
+    Integer id;
     @Column(name = "part_name")
     String name;
Index: src/main/java/com/example/autopartz/model/PartManufacturer.java
===================================================================
--- src/main/java/com/example/autopartz/model/PartManufacturer.java	(revision 6832924aea48cf018493a76963bd8f3ed906c750)
+++ src/main/java/com/example/autopartz/model/PartManufacturer.java	(revision ae042f4e3a0991ca325450a43e0ce8efdd5fb6e4)
@@ -1,11 +1,14 @@
 package com.example.autopartz.model;
 
-import jakarta.persistence.Column;
-import jakarta.persistence.Entity;
-import jakarta.persistence.Id;
-import jakarta.persistence.Table;
-import lombok.*;
+import lombok.Getter;
+import lombok.RequiredArgsConstructor;
+import lombok.Setter;
+import lombok.ToString;
 import org.hibernate.Hibernate;
 
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.Table;
 import java.util.Objects;
 
@@ -18,5 +21,5 @@
 public class PartManufacturer {
     @Id
-    Long ID_part_manufacturer;
+    Integer ID_part_manufacturer;
     @Column(name = "pm_name")
     String name;
Index: src/main/java/com/example/autopartz/model/Price.java
===================================================================
--- src/main/java/com/example/autopartz/model/Price.java	(revision 6832924aea48cf018493a76963bd8f3ed906c750)
+++ src/main/java/com/example/autopartz/model/Price.java	(revision ae042f4e3a0991ca325450a43e0ce8efdd5fb6e4)
@@ -1,11 +1,14 @@
 package com.example.autopartz.model;
 
-import jakarta.persistence.Entity;
-import jakarta.persistence.Id;
-import jakarta.persistence.JoinColumn;
-import jakarta.persistence.ManyToOne;
-import lombok.*;
+import lombok.Getter;
+import lombok.RequiredArgsConstructor;
+import lombok.Setter;
+import lombok.ToString;
 import org.hibernate.Hibernate;
 
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
 import java.time.LocalDate;
 import java.util.Objects;
@@ -18,5 +21,5 @@
 public class Price {
     @Id
-    Long ID_price;
+    Integer ID_price;
     Integer amount;
     LocalDate price_from;
Index: src/main/java/com/example/autopartz/model/Repair.java
===================================================================
--- src/main/java/com/example/autopartz/model/Repair.java	(revision 6832924aea48cf018493a76963bd8f3ed906c750)
+++ src/main/java/com/example/autopartz/model/Repair.java	(revision ae042f4e3a0991ca325450a43e0ce8efdd5fb6e4)
@@ -1,11 +1,14 @@
 package com.example.autopartz.model;
 
-import jakarta.persistence.Entity;
-import jakarta.persistence.Id;
-import jakarta.persistence.JoinColumn;
-import jakarta.persistence.ManyToOne;
-import lombok.*;
+import lombok.Getter;
+import lombok.RequiredArgsConstructor;
+import lombok.Setter;
+import lombok.ToString;
 import org.hibernate.Hibernate;
 
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
 import java.util.Objects;
 
@@ -17,5 +20,5 @@
 public class Repair {
     @Id
-    Long ID_repair;
+    Integer ID_repair;
     @ManyToOne
     @JoinColumn(name = "vin")
Index: src/main/java/com/example/autopartz/model/RepairShop.java
===================================================================
--- src/main/java/com/example/autopartz/model/RepairShop.java	(revision 6832924aea48cf018493a76963bd8f3ed906c750)
+++ src/main/java/com/example/autopartz/model/RepairShop.java	(revision ae042f4e3a0991ca325450a43e0ce8efdd5fb6e4)
@@ -1,8 +1,11 @@
 package com.example.autopartz.model;
 
-import jakarta.persistence.*;
-import lombok.*;
+import lombok.Getter;
+import lombok.RequiredArgsConstructor;
+import lombok.Setter;
+import lombok.ToString;
 import org.hibernate.Hibernate;
 
+import javax.persistence.*;
 import java.util.List;
 import java.util.Objects;
@@ -17,5 +20,5 @@
     @Id
     @Column(name = "ID_repair_shop")
-    Long id;
+    Integer id;
     @Column(name = "rs_name")
     String name;
Index: src/main/java/com/example/autopartz/model/Review.java
===================================================================
--- src/main/java/com/example/autopartz/model/Review.java	(revision 6832924aea48cf018493a76963bd8f3ed906c750)
+++ src/main/java/com/example/autopartz/model/Review.java	(revision ae042f4e3a0991ca325450a43e0ce8efdd5fb6e4)
@@ -1,11 +1,14 @@
 package com.example.autopartz.model;
 
-import jakarta.persistence.Entity;
-import jakarta.persistence.Id;
-import jakarta.persistence.JoinColumn;
-import jakarta.persistence.ManyToOne;
-import lombok.*;
+import lombok.Getter;
+import lombok.RequiredArgsConstructor;
+import lombok.Setter;
+import lombok.ToString;
 import org.hibernate.Hibernate;
 
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
 import java.util.Objects;
 
@@ -17,5 +20,5 @@
 public class Review {
     @Id
-    Long ID_review;
+    Integer ID_review;
     Integer review_rating;
     String review_comment;
Index: src/main/java/com/example/autopartz/model/Role.java
===================================================================
--- src/main/java/com/example/autopartz/model/Role.java	(revision ae042f4e3a0991ca325450a43e0ce8efdd5fb6e4)
+++ src/main/java/com/example/autopartz/model/Role.java	(revision ae042f4e3a0991ca325450a43e0ce8efdd5fb6e4)
@@ -0,0 +1,15 @@
+package com.example.autopartz.model;
+
+import org.springframework.security.core.GrantedAuthority;
+
+
+public enum Role implements GrantedAuthority {
+
+    ROLE_USER,ROLE_CLIENT, ROLE_ADMIN, ROLE_WAREHOUSEMAN, ROLE_DELIVERYMAN;
+
+    @Override
+    public String getAuthority() {
+        return name();
+    }
+}
+
Index: src/main/java/com/example/autopartz/model/ServiceBook.java
===================================================================
--- src/main/java/com/example/autopartz/model/ServiceBook.java	(revision 6832924aea48cf018493a76963bd8f3ed906c750)
+++ src/main/java/com/example/autopartz/model/ServiceBook.java	(revision ae042f4e3a0991ca325450a43e0ce8efdd5fb6e4)
@@ -1,8 +1,11 @@
 package com.example.autopartz.model;
 
-import jakarta.persistence.*;
-import lombok.*;
+import lombok.Getter;
+import lombok.RequiredArgsConstructor;
+import lombok.Setter;
+import lombok.ToString;
 import org.hibernate.Hibernate;
 
+import javax.persistence.*;
 import java.time.LocalDateTime;
 import java.util.Objects;
@@ -16,5 +19,5 @@
 public class ServiceBook {
     @Id
-    Long ID_service_book;
+    Integer ID_service_book;
     LocalDateTime sb_created_on;
     @OneToOne
Index: src/main/java/com/example/autopartz/model/User.java
===================================================================
--- src/main/java/com/example/autopartz/model/User.java	(revision 6832924aea48cf018493a76963bd8f3ed906c750)
+++ src/main/java/com/example/autopartz/model/User.java	(revision ae042f4e3a0991ca325450a43e0ce8efdd5fb6e4)
@@ -1,9 +1,16 @@
 package com.example.autopartz.model;
 
-import jakarta.persistence.*;
-import lombok.*;
+import lombok.Getter;
+import lombok.RequiredArgsConstructor;
+import lombok.Setter;
+import lombok.ToString;
 import org.hibernate.Hibernate;
+import org.springframework.security.core.GrantedAuthority;
+import org.springframework.security.core.userdetails.UserDetails;
 
+import javax.persistence.*;
 import java.time.LocalDateTime;
+import java.util.Collection;
+import java.util.Collections;
 import java.util.Objects;
 
@@ -15,7 +22,7 @@
 @Table(name = "users_table")
 @Inheritance(strategy = InheritanceType.JOINED)
-public class User {
+public class User implements UserDetails {
     @Id
-    Long ID_user;
+    Integer ID_user;
     String username;
     String email;
@@ -50,3 +57,29 @@
         return getClass().hashCode();
     }
+
+
+    @Override
+    public Collection<? extends GrantedAuthority> getAuthorities() {
+        return Collections.singletonList(Role.ROLE_USER);
+    }
+
+    @Override
+    public boolean isAccountNonExpired() {
+        return true;
+    }
+
+    @Override
+    public boolean isAccountNonLocked() {
+        return true;
+    }
+
+    @Override
+    public boolean isCredentialsNonExpired() {
+        return true;
+    }
+
+    @Override
+    public boolean isEnabled() {
+        return true;
+    }
 }
Index: src/main/java/com/example/autopartz/model/Warehouse.java
===================================================================
--- src/main/java/com/example/autopartz/model/Warehouse.java	(revision 6832924aea48cf018493a76963bd8f3ed906c750)
+++ src/main/java/com/example/autopartz/model/Warehouse.java	(revision ae042f4e3a0991ca325450a43e0ce8efdd5fb6e4)
@@ -1,9 +1,12 @@
 package com.example.autopartz.model;
 
-import jakarta.persistence.Entity;
-import jakarta.persistence.Id;
-import lombok.*;
+import lombok.Getter;
+import lombok.RequiredArgsConstructor;
+import lombok.Setter;
+import lombok.ToString;
 import org.hibernate.Hibernate;
 
+import javax.persistence.Entity;
+import javax.persistence.Id;
 import java.util.Objects;
 
@@ -15,5 +18,5 @@
 public class Warehouse {
     @Id
-    Long ID_warehouse;
+    Integer ID_warehouse;
     String warehouse_location;
 
Index: src/main/java/com/example/autopartz/model/Warehouseman.java
===================================================================
--- src/main/java/com/example/autopartz/model/Warehouseman.java	(revision 6832924aea48cf018493a76963bd8f3ed906c750)
+++ src/main/java/com/example/autopartz/model/Warehouseman.java	(revision ae042f4e3a0991ca325450a43e0ce8efdd5fb6e4)
@@ -1,11 +1,17 @@
 package com.example.autopartz.model;
 
-import jakarta.persistence.Entity;
-import jakarta.persistence.JoinColumn;
-import jakarta.persistence.ManyToOne;
-import lombok.*;
+import lombok.Getter;
+import lombok.RequiredArgsConstructor;
+import lombok.Setter;
+import lombok.ToString;
 import org.hibernate.Hibernate;
+import org.springframework.security.core.GrantedAuthority;
 
+import javax.persistence.Entity;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
 import java.time.LocalDate;
+import java.util.Collection;
+import java.util.Collections;
 import java.util.Objects;
 
@@ -33,3 +39,7 @@
         return getClass().hashCode();
     }
+    @Override
+    public Collection<? extends GrantedAuthority> getAuthorities() {
+        return Collections.singletonList(Role.ROLE_WAREHOUSEMAN);
+    }
 }
Index: src/main/java/com/example/autopartz/model/views/OrdersForUser.java
===================================================================
--- src/main/java/com/example/autopartz/model/views/OrdersForUser.java	(revision 6832924aea48cf018493a76963bd8f3ed906c750)
+++ src/main/java/com/example/autopartz/model/views/OrdersForUser.java	(revision ae042f4e3a0991ca325450a43e0ce8efdd5fb6e4)
@@ -1,11 +1,14 @@
 package com.example.autopartz.model.views;
 
-import jakarta.persistence.Entity;
-import jakarta.persistence.Id;
-import jakarta.persistence.IdClass;
-import jakarta.persistence.Table;
-import lombok.*;
+import lombok.Getter;
+import lombok.RequiredArgsConstructor;
+import lombok.Setter;
+import lombok.ToString;
 import org.hibernate.annotations.Immutable;
 
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.IdClass;
+import javax.persistence.Table;
 import java.io.Serial;
 import java.io.Serializable;
@@ -25,5 +28,5 @@
     private static final long serialVersionUID = 1L;
     @Id
-    Long userid;
+    Integer userid;
     @Id
     LocalDateTime orderdate;
Index: src/main/java/com/example/autopartz/model/views/OrdersForUserId.java
===================================================================
--- src/main/java/com/example/autopartz/model/views/OrdersForUserId.java	(revision 6832924aea48cf018493a76963bd8f3ed906c750)
+++ src/main/java/com/example/autopartz/model/views/OrdersForUserId.java	(revision ae042f4e3a0991ca325450a43e0ce8efdd5fb6e4)
@@ -8,5 +8,5 @@
 @Data
 public class OrdersForUserId implements Serializable {
-    Long userid;
+    Integer userid;
     LocalDateTime orderdate;
     String partname;
Index: src/main/java/com/example/autopartz/model/views/PartsForCarTypeAndCategory.java
===================================================================
--- src/main/java/com/example/autopartz/model/views/PartsForCarTypeAndCategory.java	(revision 6832924aea48cf018493a76963bd8f3ed906c750)
+++ src/main/java/com/example/autopartz/model/views/PartsForCarTypeAndCategory.java	(revision ae042f4e3a0991ca325450a43e0ce8efdd5fb6e4)
@@ -1,10 +1,13 @@
 package com.example.autopartz.model.views;
 
-import jakarta.persistence.Entity;
-import jakarta.persistence.Id;
-import jakarta.persistence.Table;
-import lombok.*;
+import lombok.Getter;
+import lombok.RequiredArgsConstructor;
+import lombok.Setter;
+import lombok.ToString;
 import org.hibernate.annotations.Immutable;
 
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.Table;
 import java.io.Serial;
 import java.io.Serializable;
@@ -21,5 +24,5 @@
     private static final long serialVersionUID = 1L;
     @Id
-    Long partid;
+    Integer partid;
     String partname;
     String cartype;
Index: src/main/java/com/example/autopartz/model/views/RepairShopReviewsSummary.java
===================================================================
--- src/main/java/com/example/autopartz/model/views/RepairShopReviewsSummary.java	(revision 6832924aea48cf018493a76963bd8f3ed906c750)
+++ src/main/java/com/example/autopartz/model/views/RepairShopReviewsSummary.java	(revision ae042f4e3a0991ca325450a43e0ce8efdd5fb6e4)
@@ -1,11 +1,14 @@
 package com.example.autopartz.model.views;
 
-import jakarta.persistence.Entity;
-import jakarta.persistence.Id;
-import jakarta.persistence.Table;
-import lombok.*;
+import lombok.Getter;
+import lombok.RequiredArgsConstructor;
+import lombok.Setter;
+import lombok.ToString;
 import org.hibernate.Hibernate;
 import org.hibernate.annotations.Immutable;
 
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.Table;
 import java.io.Serial;
 import java.io.Serializable;
@@ -24,7 +27,7 @@
     private static final long serialVersionUID = 1L;
     @Id
-    Long rsid;
+    Integer rsid;
     String rsname;
-    Integer reviewcount;
+    Long reviewcount;
     Float reviewaverage;
 
Index: src/main/java/com/example/autopartz/model/views/RepairsForUser.java
===================================================================
--- src/main/java/com/example/autopartz/model/views/RepairsForUser.java	(revision 6832924aea48cf018493a76963bd8f3ed906c750)
+++ src/main/java/com/example/autopartz/model/views/RepairsForUser.java	(revision ae042f4e3a0991ca325450a43e0ce8efdd5fb6e4)
@@ -1,8 +1,4 @@
 package com.example.autopartz.model.views;
 
-import jakarta.persistence.Entity;
-import jakarta.persistence.Id;
-import jakarta.persistence.IdClass;
-import jakarta.persistence.Table;
 import lombok.Getter;
 import lombok.RequiredArgsConstructor;
@@ -11,4 +7,8 @@
 import org.hibernate.annotations.Immutable;
 
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.IdClass;
+import javax.persistence.Table;
 import java.io.Serial;
 import java.io.Serializable;
@@ -28,5 +28,5 @@
     private static final long serialVersionUID = 1L;
     @Id
-    Long userid;
+    Integer userid;
     @Id
     LocalDateTime orderdate;
Index: src/main/java/com/example/autopartz/model/views/ReviewsForUser.java
===================================================================
--- src/main/java/com/example/autopartz/model/views/ReviewsForUser.java	(revision 6832924aea48cf018493a76963bd8f3ed906c750)
+++ src/main/java/com/example/autopartz/model/views/ReviewsForUser.java	(revision ae042f4e3a0991ca325450a43e0ce8efdd5fb6e4)
@@ -1,7 +1,4 @@
 package com.example.autopartz.model.views;
 
-import jakarta.persistence.Entity;
-import jakarta.persistence.Id;
-import jakarta.persistence.Table;
 import lombok.Getter;
 import lombok.RequiredArgsConstructor;
@@ -10,4 +7,7 @@
 import org.hibernate.annotations.Immutable;
 
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.Table;
 import java.io.Serial;
 import java.io.Serializable;
@@ -25,6 +25,6 @@
     private static final long serialVersionUID = 1L;
     @Id
-    Long repairid;
-    Long userid;
+    Integer repairid;
+    Integer userid;
     Integer rating;
     String rcomment;
Index: src/main/java/com/example/autopartz/repository/CarRepository.java
===================================================================
--- src/main/java/com/example/autopartz/repository/CarRepository.java	(revision 6832924aea48cf018493a76963bd8f3ed906c750)
+++ src/main/java/com/example/autopartz/repository/CarRepository.java	(revision ae042f4e3a0991ca325450a43e0ce8efdd5fb6e4)
@@ -6,4 +6,4 @@
 
 @Repository
-public interface CarRepository extends JpaRepository<Car,Long> {
+public interface CarRepository extends JpaRepository<Car,Integer> {
 }
Index: src/main/java/com/example/autopartz/repository/CategoryRepository.java
===================================================================
--- src/main/java/com/example/autopartz/repository/CategoryRepository.java	(revision 6832924aea48cf018493a76963bd8f3ed906c750)
+++ src/main/java/com/example/autopartz/repository/CategoryRepository.java	(revision ae042f4e3a0991ca325450a43e0ce8efdd5fb6e4)
@@ -6,4 +6,4 @@
 
 @Repository
-public interface CategoryRepository extends JpaRepository<Category,Long> {
+public interface CategoryRepository extends JpaRepository<Category,Integer> {
 }
Index: src/main/java/com/example/autopartz/repository/OrdersForUserRepository.java
===================================================================
--- src/main/java/com/example/autopartz/repository/OrdersForUserRepository.java	(revision 6832924aea48cf018493a76963bd8f3ed906c750)
+++ src/main/java/com/example/autopartz/repository/OrdersForUserRepository.java	(revision ae042f4e3a0991ca325450a43e0ce8efdd5fb6e4)
@@ -3,8 +3,8 @@
 import com.example.autopartz.model.views.OrdersForUser;
 import com.example.autopartz.model.views.OrdersForUserId;
-import jakarta.transaction.Transactional;
 import org.springframework.data.jpa.repository.JpaRepository;
 import org.springframework.stereotype.Repository;
 
+import javax.transaction.Transactional;
 import java.util.List;
 
@@ -12,4 +12,4 @@
 @Transactional
 public interface OrdersForUserRepository extends JpaRepository<OrdersForUser, OrdersForUserId> {
-    List<OrdersForUser> findAllByUserid(Long userid);
+    List<OrdersForUser> findAllByUserid(Integer userid);
 }
Index: src/main/java/com/example/autopartz/repository/PartRepository.java
===================================================================
--- src/main/java/com/example/autopartz/repository/PartRepository.java	(revision 6832924aea48cf018493a76963bd8f3ed906c750)
+++ src/main/java/com/example/autopartz/repository/PartRepository.java	(revision ae042f4e3a0991ca325450a43e0ce8efdd5fb6e4)
@@ -6,4 +6,4 @@
 
 @Repository
-public interface PartRepository extends JpaRepository<Part,Long> {
+public interface PartRepository extends JpaRepository<Part,Integer> {
 }
Index: src/main/java/com/example/autopartz/repository/PartsForCarTypeAndCategoryRepository.java
===================================================================
--- src/main/java/com/example/autopartz/repository/PartsForCarTypeAndCategoryRepository.java	(revision 6832924aea48cf018493a76963bd8f3ed906c750)
+++ src/main/java/com/example/autopartz/repository/PartsForCarTypeAndCategoryRepository.java	(revision ae042f4e3a0991ca325450a43e0ce8efdd5fb6e4)
@@ -2,13 +2,13 @@
 
 import com.example.autopartz.model.views.PartsForCarTypeAndCategory;
-import jakarta.transaction.Transactional;
 import org.springframework.data.jpa.repository.JpaRepository;
 import org.springframework.stereotype.Repository;
 
+import javax.transaction.Transactional;
 import java.util.List;
 
 @Repository
 @Transactional
-public interface PartsForCarTypeAndCategoryRepository extends JpaRepository<PartsForCarTypeAndCategory,Long> {
+public interface PartsForCarTypeAndCategoryRepository extends JpaRepository<PartsForCarTypeAndCategory,Integer> {
     List<PartsForCarTypeAndCategory> findAllByCartypeAndCategory(String cartype, String category);
 }
Index: src/main/java/com/example/autopartz/repository/PriceRepository.java
===================================================================
--- src/main/java/com/example/autopartz/repository/PriceRepository.java	(revision 6832924aea48cf018493a76963bd8f3ed906c750)
+++ src/main/java/com/example/autopartz/repository/PriceRepository.java	(revision ae042f4e3a0991ca325450a43e0ce8efdd5fb6e4)
@@ -7,5 +7,5 @@
 import java.util.List;
 
-public interface PriceRepository extends JpaRepository<Price,Long> {
+public interface PriceRepository extends JpaRepository<Price,Integer> {
     List<Price> findAllByPart(Part part);
 }
Index: src/main/java/com/example/autopartz/repository/RepairShopRepository.java
===================================================================
--- src/main/java/com/example/autopartz/repository/RepairShopRepository.java	(revision 6832924aea48cf018493a76963bd8f3ed906c750)
+++ src/main/java/com/example/autopartz/repository/RepairShopRepository.java	(revision ae042f4e3a0991ca325450a43e0ce8efdd5fb6e4)
@@ -6,5 +6,5 @@
 
 @Repository
-public interface RepairShopRepository extends JpaRepository<RepairShop,Long> {
+public interface RepairShopRepository extends JpaRepository<RepairShop,Integer> {
 
 }
Index: src/main/java/com/example/autopartz/repository/RepairShopReviewSummaryRepository.java
===================================================================
--- src/main/java/com/example/autopartz/repository/RepairShopReviewSummaryRepository.java	(revision 6832924aea48cf018493a76963bd8f3ed906c750)
+++ src/main/java/com/example/autopartz/repository/RepairShopReviewSummaryRepository.java	(revision ae042f4e3a0991ca325450a43e0ce8efdd5fb6e4)
@@ -2,12 +2,13 @@
 
 import com.example.autopartz.model.views.RepairShopReviewsSummary;
-import jakarta.transaction.Transactional;
 import org.springframework.data.jpa.repository.JpaRepository;
 import org.springframework.stereotype.Repository;
+
+import javax.transaction.Transactional;
 
 // извештај за сите сервиси и за сите број на reviews и avg рејтинг
 @Repository
 @Transactional
-public interface RepairShopReviewSummaryRepository extends JpaRepository<RepairShopReviewsSummary,Long> {
-    // List<RepairShopReviewsSummary> findAllByRsid(Long rsid);
+public interface RepairShopReviewSummaryRepository extends JpaRepository<RepairShopReviewsSummary,Integer> {
+    // List<RepairShopReviewsSummary> findAllByRsid(Integer rsid);
 }
Index: src/main/java/com/example/autopartz/repository/RepairsForUserRepository.java
===================================================================
--- src/main/java/com/example/autopartz/repository/RepairsForUserRepository.java	(revision 6832924aea48cf018493a76963bd8f3ed906c750)
+++ src/main/java/com/example/autopartz/repository/RepairsForUserRepository.java	(revision ae042f4e3a0991ca325450a43e0ce8efdd5fb6e4)
@@ -10,4 +10,4 @@
 @Repository
 public interface RepairsForUserRepository extends JpaRepository<RepairsForUser, OrdersForUserId> {
-    List<RepairsForUser> findAllByUserid(Long userid);
+    List<RepairsForUser> findAllByUserid(Integer userid);
 }
Index: src/main/java/com/example/autopartz/repository/ReviewsForUserRepository.java
===================================================================
--- src/main/java/com/example/autopartz/repository/ReviewsForUserRepository.java	(revision 6832924aea48cf018493a76963bd8f3ed906c750)
+++ src/main/java/com/example/autopartz/repository/ReviewsForUserRepository.java	(revision ae042f4e3a0991ca325450a43e0ce8efdd5fb6e4)
@@ -8,5 +8,5 @@
 
 @Repository
-public interface ReviewsForUserRepository extends JpaRepository<ReviewsForUser,Long> {
-    List<ReviewsForUser> findAllByUserid(Long id);
+public interface ReviewsForUserRepository extends JpaRepository<ReviewsForUser,Integer> {
+    List<ReviewsForUser> findAllByUserid(Integer id);
 }
Index: src/main/java/com/example/autopartz/repository/UserRepository.java
===================================================================
--- src/main/java/com/example/autopartz/repository/UserRepository.java	(revision 6832924aea48cf018493a76963bd8f3ed906c750)
+++ src/main/java/com/example/autopartz/repository/UserRepository.java	(revision ae042f4e3a0991ca325450a43e0ce8efdd5fb6e4)
@@ -10,6 +10,6 @@
 
 @Repository
-public interface UserRepository extends JpaRepository<User,Long> {
-     // List<User> findAllByUsername(String username);
+public interface UserRepository extends JpaRepository<User,Integer> {
+     List<User> findAllByUsername(String username);
      List<User> findAllByUsernameAndPassword(String username, String password);
 }
Index: src/main/java/com/example/autopartz/service/LoginService.java
===================================================================
--- src/main/java/com/example/autopartz/service/LoginService.java	(revision 6832924aea48cf018493a76963bd8f3ed906c750)
+++ src/main/java/com/example/autopartz/service/LoginService.java	(revision ae042f4e3a0991ca325450a43e0ce8efdd5fb6e4)
@@ -6,5 +6,3 @@
     User register(String name, String username, String email, String number, String password);
     User login(String username, String password);
-    // User findByUsername(String username);
-
 }
Index: src/main/java/com/example/autopartz/service/PartService.java
===================================================================
--- src/main/java/com/example/autopartz/service/PartService.java	(revision 6832924aea48cf018493a76963bd8f3ed906c750)
+++ src/main/java/com/example/autopartz/service/PartService.java	(revision ae042f4e3a0991ca325450a43e0ce8efdd5fb6e4)
@@ -7,4 +7,4 @@
 public interface PartService {
     List<Part> findAll();
-    Part findById(Long id);
+    Part findById(Integer id);
 }
Index: src/main/java/com/example/autopartz/service/UserService.java
===================================================================
--- src/main/java/com/example/autopartz/service/UserService.java	(revision 6832924aea48cf018493a76963bd8f3ed906c750)
+++ src/main/java/com/example/autopartz/service/UserService.java	(revision ae042f4e3a0991ca325450a43e0ce8efdd5fb6e4)
@@ -7,3 +7,5 @@
 public interface UserService {
     List<User> findAllUsers();
+    User findByUsername(String username);
+
 }
Index: src/main/java/com/example/autopartz/service/impl/PartServiceImpl.java
===================================================================
--- src/main/java/com/example/autopartz/service/impl/PartServiceImpl.java	(revision 6832924aea48cf018493a76963bd8f3ed906c750)
+++ src/main/java/com/example/autopartz/service/impl/PartServiceImpl.java	(revision ae042f4e3a0991ca325450a43e0ce8efdd5fb6e4)
@@ -22,5 +22,5 @@
 
     @Override
-    public Part findById(Long id) {
+    public Part findById(Integer id) {
         return partRepository.findById(id).orElseThrow(RuntimeException::new);
     }
Index: src/main/java/com/example/autopartz/service/impl/UserServiceImpl.java
===================================================================
--- src/main/java/com/example/autopartz/service/impl/UserServiceImpl.java	(revision 6832924aea48cf018493a76963bd8f3ed906c750)
+++ src/main/java/com/example/autopartz/service/impl/UserServiceImpl.java	(revision ae042f4e3a0991ca325450a43e0ce8efdd5fb6e4)
@@ -20,3 +20,8 @@
         return userRepository.findAll();
     }
+
+    @Override
+    public User findByUsername(String username) {
+        return userRepository.findAllByUsername(username).stream().findFirst().orElseThrow(RuntimeException::new);
+    }
 }
Index: src/main/resources/templates/filteredParts.html
===================================================================
--- src/main/resources/templates/filteredParts.html	(revision 6832924aea48cf018493a76963bd8f3ed906c750)
+++ src/main/resources/templates/filteredParts.html	(revision ae042f4e3a0991ca325450a43e0ce8efdd5fb6e4)
@@ -1,5 +1,5 @@
 <div>
 <h1>Резултат од филтерот</h1>
-<a th:href="${'/'}">Врати се на сите производи</a>
+<a th:href="${'/products'}">Врати се на сите производи</a>
 
 <table>
Index: src/main/resources/templates/fragments/header.html
===================================================================
--- src/main/resources/templates/fragments/header.html	(revision 6832924aea48cf018493a76963bd8f3ed906c750)
+++ src/main/resources/templates/fragments/header.html	(revision ae042f4e3a0991ca325450a43e0ce8efdd5fb6e4)
@@ -1,3 +1,3 @@
-<header>
+<header xmlns:sec="http://www.w3.org/1999/xhtml">
   <nav class="navbar navbar-expand-md navbar-dark bg-dark">
     <div class="container">
@@ -19,11 +19,12 @@
 
         <ul class="nav navbar-nav navbar-right">
-
+          <th:block th:if="${#request.getRemoteUser() != null}">
           <li class="nav-item">
-            <a class="nav-link" href="#">
-<!--              <th:block th:if="${#request.getRemoteUser() != null}"-->
-<!--                        th:text="${#request.getRemoteUser()}"></th:block>-->
+            <a class="btn btn-success btn-sm ml-3" href="/register">
+              <th:block th:text="${#request.getRemoteUser()}"></th:block>
             </a>
           </li>
+        </th:block>
+          <th:block th:if="${#request.getRemoteUser() == null}">
           <li class="nav-item">
             <a class="btn btn-success btn-sm ml-3" href="/register">
@@ -31,9 +32,14 @@
             </a>
           </li>
-          <li class="nav-item">
+          </th:block>
+          <th:block th:if="${#request.getRemoteUser() != null}">
+          <li class="nav-item" sec:authorize="isAuthenticated()">
             <a class="btn btn-light btn-sm ml-3" href="/logout">
-              <i class="fa fa-shopping-cart"></i> Одјави се
+              <i class="fa fa-shopping-cart"></i>
+                        Одјави се
             </a>
           </li>
+          </th:block>
+          <th:block th:if="${#request.getRemoteUser() == null}">
           <li class="nav-item">
             <a class="btn btn-light btn-sm ml-3" href="/login">
@@ -41,4 +47,5 @@
             </a>
           </li>
+          </th:block>
         </ul>
       </div>
