Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert spring update #487

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM mcr.microsoft.com/devcontainers/java:17
FROM mcr.microsoft.com/devcontainers/java:0-17

RUN su vscode -c "umask 0002 && . /usr/local/sdkman/bin/sdkman-init.sh && sdk install gradle "

Expand Down
20 changes: 5 additions & 15 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,14 @@
// Use 'forwardPorts' to make a list of ports inside the container available locally.
// This can be used to network with other containers or with the host.
"forwardPorts": [
1080, // Mailcatcher
5432, // PostgreSQL
8080, // Events
8082 // Adminer
1080,
80,
8082
],
// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "gradle bootRun",
"postCreateCommand": "gradle bootRun",
// Configure tool-specific properties.
// "customizations": {},
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
"remoteUser": "root",
"customizations": {
"vscode": {
"extensions": [
"vmware.vscode-boot-dev-pack",
"vscjava.vscode-gradle",
"vscjava.vscode-java-pack"
]
}
}
"remoteUser": "root"
}
6 changes: 3 additions & 3 deletions .devcontainer/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ services:
- mailcatcher

postgres:
image: docker.io/library/postgres:latest
image: postgres:latest
restart: unless-stopped
volumes:
- postgres-data:/var/lib/postgresql/data
Expand All @@ -36,14 +36,14 @@ services:
POSTGRES_HOST_AUTH_METHOD: trust

adminer:
image: docker.io/library/adminer:latest
image: adminer
restart: always
depends_on:
- postgres
ports:
- "8082:8080"

mailcatcher:
image: docker.io/schickling/mailcatcher:latest
image: schickling/mailcatcher
restart: on-failure
network_mode: service:postgres
13 changes: 4 additions & 9 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup JDK
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
uses: actions/checkout@v3
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
uses: github/codeql-action/init@v2
- name: Autobuild
uses: github/codeql-action/autobuild@v3
uses: github/codeql-action/autobuild@v2
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
uses: github/codeql-action/analyze@v2
13 changes: 9 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
buildscript {
ext {
springBootVersion = '3.2.5'
springBootVersion = '2.7.18'
}
repositories {
mavenCentral()
Expand Down Expand Up @@ -56,11 +56,16 @@ dependencies {
//TEMP APPLICATION PROPERTIES HELPER
runtimeOnly 'org.springframework.boot:spring-boot-properties-migrator'


implementation 'javax.el:javax.el-api:2.2.5'
implementation "be.woutschoovaerts:mollie:3.6.1"

implementation 'org.thymeleaf:thymeleaf-spring6'
implementation 'org.thymeleaf:thymeleaf'
implementation 'org.thymeleaf.extras:thymeleaf-extras-springsecurity6'

implementation 'org.thymeleaf:thymeleaf-spring5'
implementation 'org.thymeleaf:thymeleaf'
implementation 'org.thymeleaf.extras:thymeleaf-extras-springsecurity5'
implementation 'org.thymeleaf.extras:thymeleaf-extras-java8time'


implementation 'com.google.guava:guava:32.0.0-jre'
implementation 'org.hibernate.validator:hibernate-validator'
Expand Down
2 changes: 1 addition & 1 deletion config/application-devcontainer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ logging.level.web: DEBUG

# Serve connect
server:
port: 8080
port: 80
servlet.context-path: /

# CH Connect Configuration
Expand Down
13 changes: 5 additions & 8 deletions docs/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -229,14 +229,14 @@ GEM
jekyll-seo-tag (~> 2.1)
minitest (5.22.3)
mutex_m (0.2.0)
nokogiri (1.16.5)
nokogiri (1.15.6)
mini_portile2 (~> 2.8.2)
racc (~> 1.4)
nokogiri (1.16.5-java)
nokogiri (1.15.6-java)
racc (~> 1.4)
nokogiri (1.16.5-x64-mingw32)
nokogiri (1.15.6-x64-mingw32)
racc (~> 1.4)
nokogiri (1.16.5-x86-mingw32)
nokogiri (1.15.6-x86-mingw32)
racc (~> 1.4)
octokit (4.25.1)
faraday (>= 1, < 3)
Expand All @@ -249,8 +249,7 @@ GEM
rb-fsevent (0.11.2)
rb-inotify (0.10.1)
ffi (~> 1.0)
rexml (3.2.8)
strscan (>= 3.0.9)
rexml (3.2.6)
rouge (3.30.0)
ruby2_keywords (0.0.5)
rubyzip (2.3.2)
Expand All @@ -265,8 +264,6 @@ GEM
faraday (>= 0.17.3, < 3)
simpleidn (0.2.2)
unf (~> 0.1.4)
strscan (3.1.0)
strscan (3.1.0-java)
terminal-table (1.8.0)
unicode-display_width (~> 1.1, >= 1.1.1)
typhoeus (1.4.1)
Expand Down
42 changes: 18 additions & 24 deletions src/main/java/ch/wisv/events/ChConnectConfiguration.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,17 @@
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;
import org.springframework.security.config.Customizer;
import org.springframework.security.config.annotation.method.configuration.EnableMethodSecurity;
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.core.authority.SimpleGrantedAuthority;
import org.springframework.security.oauth2.client.oidc.userinfo.OidcUserRequest;
import org.springframework.security.oauth2.client.oidc.userinfo.OidcUserService;
import org.springframework.security.oauth2.client.userinfo.OAuth2UserService;
import org.springframework.security.oauth2.core.oidc.OidcIdToken;
import org.springframework.security.oauth2.core.oidc.user.DefaultOidcUser;
import org.springframework.security.oauth2.core.oidc.user.OidcUser;
import org.springframework.security.web.SecurityFilterChain;
import org.springframework.security.web.csrf.CookieCsrfTokenRepository;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.cors.CorsConfigurationSource;
Expand All @@ -33,11 +32,11 @@
*/
@Configuration
@EnableWebSecurity
@EnableMethodSecurity(prePostEnabled = true)
@EnableGlobalMethodSecurity(prePostEnabled = true)
@ConfigurationProperties(prefix = "wisvch.connect")
@Validated
@Profile("!test")
public class ChConnectConfiguration {
public class ChConnectConfiguration extends WebSecurityConfigurerAdapter {

/**
* Groups that are admin in the system.
Expand Down Expand Up @@ -65,29 +64,24 @@ public class ChConnectConfiguration {
* @param http
* @throws Exception
*/
@Bean
public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
public void configure(HttpSecurity http) throws Exception {
http
.cors(Customizer.withDefaults())
.csrf(Customizer.withDefaults())
.authorizeHttpRequests((authorize) -> authorize
.requestMatchers("/administrator/**").hasRole("ADMIN")
.requestMatchers("/", "/management/health").permitAll()
.cors()
.and()
.csrf()
.and().authorizeRequests()
.antMatchers("/administrator/**").hasRole("ADMIN")
.antMatchers("/", "/management/health").permitAll()
.anyRequest().permitAll()
)
.logout(logout -> logout
.and()
.logout()
.logoutSuccessUrl("/")
)
.csrf(csrf -> csrf
.and()
.csrf()
.csrfTokenRepository(CookieCsrfTokenRepository.withHttpOnlyFalse())
.ignoringRequestMatchers("/api/v1/**")
)
.oauth2Login(oauth -> oauth
.userInfoEndpoint(userInfo -> userInfo
.oidcUserService(oidcUserService())
)
);
return http.build();
.ignoringAntMatchers("/api/v1/**")
.and()
.oauth2Login().userInfoEndpoint().oidcUserService(oidcUserService());
}

/**
Expand Down
13 changes: 13 additions & 0 deletions src/main/java/ch/wisv/events/EventsApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.domain.EntityScan;
import org.springframework.context.annotation.Bean;
import org.springframework.data.jpa.convert.threeten.Jsr310JpaConverters;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.thymeleaf.extras.java8time.dialect.Java8TimeDialect;

/**
* EventsApplication class.
Expand All @@ -23,4 +25,15 @@ public class EventsApplication {
public static void main(String[] args) {
SpringApplication.run(EventsApplication.class, args);
}

/**
* Enables Time formating in thymeleaf.
*
* @return Java8TimeDialect
*/
@Bean
public Java8TimeDialect java8TimeDialect() {
return new Java8TimeDialect();
}

}
15 changes: 0 additions & 15 deletions src/main/java/ch/wisv/events/WebConfiguration.java

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import ch.wisv.events.core.repository.EventRepository;
import ch.wisv.events.core.service.customer.CustomerService;
import ch.wisv.events.core.service.event.EventService;
import ch.wisv.events.core.service.ticket.TicketService;
import java.time.LocalDateTime;
import java.util.HashMap;
import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
package ch.wisv.events.api.controller;

import ch.wisv.events.core.service.order.OrderService;
import ch.wisv.events.webshop.service.PaymentsService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

/**
* OrderRestController class.
*/
@Slf4j
@RestController
@RequestMapping("/api/v1/orders")
public class OrderRestController {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/ch/wisv/events/api/request/ProductDto.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package ch.wisv.events.api.request;

import jakarta.validation.constraints.NotNull;
import javax.validation.constraints.NotNull;

import ch.wisv.events.core.util.VatRate;
import lombok.Getter;
Expand Down
11 changes: 6 additions & 5 deletions src/main/java/ch/wisv/events/core/model/customer/Customer.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,16 @@
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import jakarta.persistence.Column;
import jakarta.persistence.ElementCollection;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.Id;
import javax.persistence.Column;
import javax.persistence.ElementCollection;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import lombok.AccessLevel;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;
import org.springframework.beans.factory.annotation.Value;

/**
* Customer object.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package ch.wisv.events.core.model.document;

import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.Id;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import lombok.Data;

/**
Expand Down
22 changes: 11 additions & 11 deletions src/main/java/ch/wisv/events/core/model/event/Event.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,22 @@
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import jakarta.persistence.CascadeType;
import jakarta.persistence.Column;
import jakarta.persistence.ElementCollection;
import jakarta.persistence.Entity;
import jakarta.persistence.FetchType;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.Id;
import jakarta.persistence.OneToMany;
import jakarta.persistence.OrderBy;
import jakarta.validation.constraints.NotNull;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.ElementCollection;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.OrderBy;
import javax.validation.constraints.NotNull;

import lombok.AccessLevel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.Setter;
import jakarta.validation.constraints.NotEmpty;
import javax.validation.constraints.NotEmpty;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.format.annotation.DateTimeFormat.ISO;

Expand Down
Loading
Loading