diff --git a/pom.xml b/pom.xml
index 87178dc..81ab720 100644
--- a/pom.xml
+++ b/pom.xml
@@ -46,6 +46,10 @@
+
+
+
+
org.hibernate
hibernate-core
@@ -71,6 +75,17 @@
+
+
+ org.json
+ json
+ 20200518
+
+
+
+
+
+
diff --git a/src/main/java/pl/staszczykpiotr/truckforwarder_backend/SecurityConfiguration.java b/src/main/java/pl/staszczykpiotr/truckforwarder_backend/SecurityConfiguration.java
index d5f927b..0df3a12 100644
--- a/src/main/java/pl/staszczykpiotr/truckforwarder_backend/SecurityConfiguration.java
+++ b/src/main/java/pl/staszczykpiotr/truckforwarder_backend/SecurityConfiguration.java
@@ -34,7 +34,7 @@ protected void configure(HttpSecurity httpSecurity)
throws Exception {
httpSecurity.csrf().disable();
httpSecurity.authorizeRequests()
- .antMatchers("/trucks/all","/session/player/**").permitAll()
+ .antMatchers("/trucks/all","/session/player/**","/order/all").permitAll()
.anyRequest().authenticated()
.and()
.formLogin().permitAll()
@@ -46,37 +46,29 @@ protected void configure(HttpSecurity httpSecurity)
.alwaysRemember(true)
.tokenValiditySeconds(30*5);
-
-
httpSecurity.headers()
.frameOptions()
.sameOrigin();
+
}
@Autowired
protected void configureGlobal(AuthenticationManagerBuilder builder, MyUserDetailService myUserDetailService) throws Exception {
-// builder.jdbcAuthentication()
-// .dataSource(dataSource)
-// .usersByUsernameQuery("select username,password,enabled from users where username = ?")
-// .authoritiesByUsernameQuery("select username,authority from authorities where username = ?")
-//
-// ;
builder.userDetailsService(myUserDetailService)
.passwordEncoder(passwordEncoder());
-
}
- @Bean
- public PasswordEncoder passwordEncoder () {
+ @Bean
+ public PasswordEncoder passwordEncoder () {
return new BCryptPasswordEncoder();
- }
+ }
- }
+}
diff --git a/src/main/java/pl/staszczykpiotr/truckforwarder_backend/controller/OrderController.java b/src/main/java/pl/staszczykpiotr/truckforwarder_backend/controller/OrderController.java
index 0cb33e1..9821973 100644
--- a/src/main/java/pl/staszczykpiotr/truckforwarder_backend/controller/OrderController.java
+++ b/src/main/java/pl/staszczykpiotr/truckforwarder_backend/controller/OrderController.java
@@ -1,8 +1,92 @@
package pl.staszczykpiotr.truckforwarder_backend.controller;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.core.context.SecurityContextHolder;
+import org.springframework.web.bind.annotation.*;
+import pl.staszczykpiotr.truckforwarder_backend.dto.Course;
+import pl.staszczykpiotr.truckforwarder_backend.dto.Order;
+import pl.staszczykpiotr.truckforwarder_backend.repository.CourseRepository;
+import pl.staszczykpiotr.truckforwarder_backend.repository.OrderRepository;
+
+import java.text.SimpleDateFormat;
+import java.util.*;
@RestController
public class OrderController {
+
+ private OrderRepository orderRepository;
+ private CourseRepository courseRepository;
+
+ @Autowired
+ public OrderController(OrderRepository orderRepository, CourseRepository courseRepository){
+ this.orderRepository = orderRepository;
+ this.courseRepository = courseRepository;
+
+ }
+
+
+ @GetMapping("/order/all")
+
+ public List getOrders() {
+ return orderRepository.findAll();
+ }
+
+ @GetMapping("/order/vieworders")
+ public List