Compare commits
No commits in common. "b7145931942216436c5d2f28075374f05cfa920d" and "8f1efa4902c226cd60bbbf857a66be8a93864f5b" have entirely different histories.
b714593194
...
8f1efa4902
34
build.gradle
34
build.gradle
@ -1,7 +1,7 @@
|
||||
plugins {
|
||||
id 'java'
|
||||
id 'org.springframework.boot' version '4.0.1'
|
||||
id 'io.spring.dependency-management' version '1.1.7'
|
||||
id 'org.springframework.boot' version '3.4.0'
|
||||
id 'io.spring.dependency-management' version '1.1.6'
|
||||
}
|
||||
|
||||
group = 'app.mealsmadeeasy'
|
||||
@ -47,26 +47,24 @@ dependencies {
|
||||
// From Spring Initalizr
|
||||
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
|
||||
implementation 'org.springframework.boot:spring-boot-starter-security'
|
||||
implementation 'org.springframework.boot:spring-boot-starter-webmvc'
|
||||
implementation 'org.springframework.boot:spring-boot-starter-jackson'
|
||||
implementation 'org.springframework.boot:spring-boot-starter-web'
|
||||
runtimeOnly 'com.mysql:mysql-connector-j'
|
||||
testImplementation 'org.springframework.boot:spring-boot-starter-webmvc-test'
|
||||
testImplementation 'org.springframework.boot:spring-boot-starter-jackson-test'
|
||||
testImplementation 'org.springframework.boot:spring-boot-starter-test'
|
||||
testImplementation 'org.springframework.security:spring-security-test'
|
||||
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
|
||||
|
||||
// Custom
|
||||
implementation 'io.jsonwebtoken:jjwt-api:0.13.0'
|
||||
implementation 'io.jsonwebtoken:jjwt-jackson:0.13.0'
|
||||
runtimeOnly 'io.jsonwebtoken:jjwt-impl:0.13.0'
|
||||
implementation 'io.jsonwebtoken:jjwt-api:0.12.6'
|
||||
implementation 'io.jsonwebtoken:jjwt-jackson:0.12.6'
|
||||
runtimeOnly 'io.jsonwebtoken:jjwt-impl:0.12.6'
|
||||
|
||||
implementation 'org.commonmark:commonmark:0.27.0'
|
||||
implementation 'org.jsoup:jsoup:1.21.2'
|
||||
implementation 'tools.jackson.dataformat:jackson-dataformat-yaml:3.0.3'
|
||||
implementation 'org.commonmark:commonmark:0.24.0'
|
||||
implementation 'org.jsoup:jsoup:1.18.3'
|
||||
implementation 'com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.18.2'
|
||||
|
||||
implementation 'io.minio:minio:8.6.0'
|
||||
implementation 'io.minio:minio:8.5.14'
|
||||
|
||||
compileOnly 'org.jetbrains:annotations:26.0.2-1'
|
||||
compileOnly 'org.jetbrains:annotations:26.0.1'
|
||||
|
||||
// https://mvnrepository.com/artifact/com.twelvemonkeys.imageio/imageio-webp
|
||||
runtimeOnly 'com.twelvemonkeys.imageio:imageio-webp:3.12.0'
|
||||
@ -77,11 +75,13 @@ dependencies {
|
||||
// https://mvnrepository.com/artifact/org.apache.xmlgraphics/batik-all
|
||||
runtimeOnly 'org.apache.xmlgraphics:batik-all:1.19'
|
||||
|
||||
compileOnly 'org.jetbrains:annotations:24.1.0'
|
||||
|
||||
// Custom testing
|
||||
testRuntimeOnly 'com.h2database:h2'
|
||||
testImplementation 'org.testcontainers:testcontainers:1.21.4'
|
||||
testImplementation 'org.testcontainers:junit-jupiter:1.21.4'
|
||||
testImplementation "org.testcontainers:minio:1.21.4"
|
||||
testImplementation 'org.testcontainers:testcontainers:1.20.4'
|
||||
testImplementation 'org.testcontainers:junit-jupiter:1.20.4'
|
||||
testImplementation "org.testcontainers:minio:1.20.4"
|
||||
|
||||
testFixturesImplementation 'org.hamcrest:hamcrest:3.0'
|
||||
}
|
||||
|
||||
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@ -1,6 +1,6 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-9.2.1-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
|
||||
@ -3,18 +3,18 @@ package app.mealsmadeeasy.api.auth;
|
||||
import app.mealsmadeeasy.api.user.User;
|
||||
import app.mealsmadeeasy.api.user.UserCreateException;
|
||||
import app.mealsmadeeasy.api.user.UserService;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import jakarta.servlet.http.Cookie;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.boot.webmvc.test.autoconfigure.AutoConfigureMockMvc;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.test.annotation.DirtiesContext;
|
||||
import org.springframework.test.web.servlet.MockMvc;
|
||||
import org.springframework.test.web.servlet.MvcResult;
|
||||
import org.springframework.test.web.servlet.request.MockHttpServletRequestBuilder;
|
||||
import tools.jackson.databind.ObjectMapper;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@ -46,7 +46,7 @@ public class AuthControllerTests {
|
||||
}
|
||||
}
|
||||
|
||||
private MockHttpServletRequestBuilder getLoginRequest() {
|
||||
private MockHttpServletRequestBuilder getLoginRequest() throws Exception {
|
||||
final Map<String, ?> body = Map.of(
|
||||
"username", "test",
|
||||
"password", "test"
|
||||
|
||||
@ -8,10 +8,11 @@ import app.mealsmadeeasy.api.image.spec.ImageUpdateInfoSpec;
|
||||
import app.mealsmadeeasy.api.user.User;
|
||||
import app.mealsmadeeasy.api.user.UserCreateException;
|
||||
import app.mealsmadeeasy.api.user.UserService;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.boot.webmvc.test.autoconfigure.AutoConfigureMockMvc;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.mock.web.MockMultipartFile;
|
||||
import org.springframework.test.annotation.DirtiesContext;
|
||||
@ -22,7 +23,6 @@ import org.testcontainers.containers.MinIOContainer;
|
||||
import org.testcontainers.junit.jupiter.Container;
|
||||
import org.testcontainers.junit.jupiter.Testcontainers;
|
||||
import org.testcontainers.utility.DockerImageName;
|
||||
import tools.jackson.databind.ObjectMapper;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
@ -13,10 +13,12 @@ import app.mealsmadeeasy.api.recipe.star.RecipeStarService;
|
||||
import app.mealsmadeeasy.api.user.User;
|
||||
import app.mealsmadeeasy.api.user.UserCreateException;
|
||||
import app.mealsmadeeasy.api.user.UserService;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.boot.webmvc.test.autoconfigure.AutoConfigureMockMvc;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.test.annotation.DirtiesContext;
|
||||
import org.springframework.test.context.DynamicPropertyRegistry;
|
||||
@ -26,7 +28,6 @@ import org.testcontainers.containers.MinIOContainer;
|
||||
import org.testcontainers.junit.jupiter.Container;
|
||||
import org.testcontainers.junit.jupiter.Testcontainers;
|
||||
import org.testcontainers.utility.DockerImageName;
|
||||
import tools.jackson.databind.ObjectMapper;
|
||||
|
||||
import java.io.InputStream;
|
||||
|
||||
@ -241,7 +242,7 @@ public class RecipeControllerTests {
|
||||
.andExpect(jsonPath("$.content", hasSize(3)));
|
||||
}
|
||||
|
||||
private String getUpdateBody() {
|
||||
private String getUpdateBody() throws JsonProcessingException {
|
||||
final RecipeUpdateSpec spec = new RecipeUpdateSpec();
|
||||
spec.setTitle("Updated Test Recipe");
|
||||
spec.setPreparationTime(15);
|
||||
|
||||
@ -2,16 +2,17 @@ package app.mealsmadeeasy.api.signup;
|
||||
|
||||
import app.mealsmadeeasy.api.user.UserCreateException.Type;
|
||||
import app.mealsmadeeasy.api.user.UserService;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.boot.webmvc.test.autoconfigure.AutoConfigureMockMvc;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.test.annotation.DirtiesContext;
|
||||
import org.springframework.test.web.servlet.MockMvc;
|
||||
import org.springframework.test.web.servlet.request.MockHttpServletRequestBuilder;
|
||||
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
|
||||
import tools.jackson.databind.ObjectMapper;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@ -33,7 +34,8 @@ public class SignUpControllerTests {
|
||||
@Autowired
|
||||
private UserService userService;
|
||||
|
||||
private MockHttpServletRequestBuilder getCheckUsernameRequest(String usernameToCheck) {
|
||||
private MockHttpServletRequestBuilder getCheckUsernameRequest(String usernameToCheck)
|
||||
throws JsonProcessingException {
|
||||
final Map<String, Object> body = Map.of("username", usernameToCheck);
|
||||
return MockMvcRequestBuilders.get("/sign-up/check-username")
|
||||
.content(this.objectMapper.writeValueAsString(body))
|
||||
@ -58,7 +60,7 @@ public class SignUpControllerTests {
|
||||
}
|
||||
|
||||
|
||||
private MockHttpServletRequestBuilder getCheckEmailRequest(String emailToCheck) {
|
||||
private MockHttpServletRequestBuilder getCheckEmailRequest(String emailToCheck) throws JsonProcessingException {
|
||||
final Map<String, Object> body = Map.of("email", emailToCheck);
|
||||
return MockMvcRequestBuilders.get("/sign-up/check-email")
|
||||
.content(this.objectMapper.writeValueAsString(body))
|
||||
|
||||
@ -8,14 +8,14 @@ import app.mealsmadeeasy.api.recipe.RecipeService;
|
||||
import app.mealsmadeeasy.api.recipe.spec.RecipeCreateSpec;
|
||||
import app.mealsmadeeasy.api.user.User;
|
||||
import app.mealsmadeeasy.api.user.UserService;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.dataformat.yaml.YAMLFactory;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.boot.CommandLineRunner;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Profile;
|
||||
import tools.jackson.databind.ObjectMapper;
|
||||
import tools.jackson.dataformat.yaml.YAMLFactory;
|
||||
|
||||
import java.io.FileInputStream;
|
||||
import java.io.InputStream;
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package app.mealsmadeeasy.api.security;
|
||||
|
||||
import app.mealsmadeeasy.api.jwt.JwtService;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import io.jsonwebtoken.ExpiredJwtException;
|
||||
import io.jsonwebtoken.JwtException;
|
||||
import jakarta.servlet.FilterChain;
|
||||
@ -18,7 +19,6 @@ import org.springframework.security.core.userdetails.UserDetailsService;
|
||||
import org.springframework.security.web.authentication.WebAuthenticationDetailsSource;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.filter.OncePerRequestFilter;
|
||||
import tools.jackson.databind.ObjectMapper;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
|
||||
@ -5,7 +5,6 @@ import org.springframework.beans.factory.BeanFactory;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.security.authentication.AuthenticationManager;
|
||||
import org.springframework.security.authentication.AuthenticationProvider;
|
||||
import org.springframework.security.authentication.ProviderManager;
|
||||
import org.springframework.security.authentication.dao.DaoAuthenticationProvider;
|
||||
import org.springframework.security.config.Customizer;
|
||||
@ -33,7 +32,7 @@ public class SecurityConfiguration {
|
||||
}
|
||||
|
||||
@Bean
|
||||
public SecurityFilterChain securityFilterChain(HttpSecurity httpSecurity) {
|
||||
public SecurityFilterChain securityFilterChain(HttpSecurity httpSecurity) throws Exception {
|
||||
httpSecurity.authorizeHttpRequests(requests -> requests.anyRequest().permitAll());
|
||||
httpSecurity.csrf(AbstractHttpConfigurer::disable);
|
||||
httpSecurity.cors(Customizer.withDefaults());
|
||||
@ -59,14 +58,15 @@ public class SecurityConfiguration {
|
||||
|
||||
@Bean
|
||||
public DaoAuthenticationProvider daoAuthenticationProvider() {
|
||||
final var provider = new DaoAuthenticationProvider(this.jpaUserDetailsService);
|
||||
provider.setPasswordEncoder(this.beanFactory.getBean(PasswordEncoder.class));
|
||||
final var provider = new DaoAuthenticationProvider();
|
||||
provider.setUserDetailsService(this.jpaUserDetailsService);
|
||||
provider.setPasswordEncoder(this.passwordEncoder());
|
||||
return provider;
|
||||
}
|
||||
|
||||
@Bean
|
||||
public AuthenticationManager authenticationManager() {
|
||||
return new ProviderManager(this.beanFactory.getBean(AuthenticationProvider.class));
|
||||
return new ProviderManager(this.daoAuthenticationProvider());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user