Skip to content
Merged
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
21 changes: 8 additions & 13 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
plugins {
id 'java'
id 'org.springframework.boot' version '4.0.0'
id 'org.springframework.boot' version '4.0.1'
id 'io.spring.dependency-management' version '1.1.7'
id "com.github.ben-manes.versions" version "0.52.0"
id "com.github.ben-manes.versions" version "0.53.0"

}

Expand Down Expand Up @@ -39,7 +39,7 @@ repositories {

dependencies {
// DigitalSanctuary Spring User Framework
implementation 'com.digitalsanctuary:ds-spring-user-framework:4.0.0'
implementation 'com.digitalsanctuary:ds-spring-user-framework:4.0.1'

// Spring Boot starters
implementation 'org.springframework.boot:spring-boot-starter-actuator'
Expand All @@ -60,12 +60,12 @@ dependencies {

// Runtime dependencies
runtimeOnly 'org.springframework.boot:spring-boot-devtools'
runtimeOnly 'org.mariadb.jdbc:mariadb-java-client:3.5.5'
runtimeOnly 'org.mariadb.jdbc:mariadb-java-client:3.5.7'
runtimeOnly 'org.postgresql:postgresql'

// Utility libraries
implementation 'org.passay:passay:1.6.6'
implementation 'com.google.guava:guava:33.4.8-jre'
implementation 'com.google.guava:guava:33.5.0-jre'
implementation 'jakarta.validation:jakarta.validation-api:3.1.1'
implementation 'org.hibernate.validator:hibernate-validator:8.0.2.Final'

Expand All @@ -82,9 +82,9 @@ dependencies {
testImplementation 'org.springframework.boot:spring-boot-webmvc-test'
testImplementation 'org.springframework.boot:spring-boot-starter-security-test'
testImplementation 'org.springframework.security:spring-security-test'
testImplementation 'com.h2database:h2:2.3.232'
testImplementation 'com.codeborne:selenide:7.10.0'
testImplementation 'io.github.bonigarcia:webdrivermanager:6.3.1'
testImplementation 'com.h2database:h2:2.4.240'
testImplementation 'com.codeborne:selenide:7.13.0'
testImplementation 'io.github.bonigarcia:webdrivermanager:6.3.3'

// OAuth2 Testing dependencies
testImplementation 'com.github.tomakehurst:wiremock-jre8-standalone:3.0.1'
Expand Down Expand Up @@ -113,11 +113,6 @@ tasks.register('uiTest', Test) {
shouldRunAfter test
}


bootJar {
// launchScript removed in Spring Boot 4 - use systemd or other init systems instead
}

bootRun {
// Use Spring Boot DevTool only when we run Gradle bootRun task
classpath = sourceSets.main.runtimeClasspath + configurations.developmentOnly
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import com.digitalsanctuary.spring.demo.UserDemoApplication;
import java.time.LocalDate;
import com.digitalsanctuary.spring.user.persistence.model.Role;
import com.digitalsanctuary.spring.user.persistence.repository.RoleRepository;
import com.digitalsanctuary.spring.user.test.annotations.IntegrationTest;
Expand Down Expand Up @@ -51,6 +52,11 @@ class AdminRoleAccessControlTest {
private TestUserManager userManager;
private static final String TEST_PREFIX = "role.access";

/** Returns a date one year in the future to satisfy @FutureOrPresent validation */
private static String futureDate() {
return LocalDate.now().plusYears(1).toString();
}

@BeforeEach
void setUp() {
String uniquePrefix = TEST_PREFIX + "." + System.currentTimeMillis();
Expand Down Expand Up @@ -122,7 +128,7 @@ class EventAccessControlTests {
@DisplayName("Admin can perform all event operations")
void testAdminEventOperations() throws Exception {
// Admin can create events
String validEventJson = "{\"name\": \"Admin Event\", \"description\": \"Created by admin\", \"location\": \"Test Location\", \"date\": \"2025-12-31\", \"time\": \"14:30\"}";
String validEventJson = "{\"name\": \"Admin Event\", \"description\": \"Created by admin\", \"location\": \"Test Location\", \"date\": \"" + futureDate() + "\", \"time\": \"14:30\"}";
mockMvc.perform(post("/api/events").contentType(MediaType.APPLICATION_JSON)
.content(validEventJson).with(csrf())).andExpect(status().isOk());
}
Expand All @@ -132,7 +138,7 @@ void testAdminEventOperations() throws Exception {
@DisplayName("Regular user can only register for events")
void testUserEventLimitations() throws Exception {
// User CANNOT create events
String validEventJson = "{\"name\": \"User Event\", \"description\": \"Should fail\", \"location\": \"Test Location\", \"date\": \"2025-12-31\", \"time\": \"14:30\"}";
String validEventJson = "{\"name\": \"User Event\", \"description\": \"Should fail\", \"location\": \"Test Location\", \"date\": \"" + futureDate() + "\", \"time\": \"14:30\"}";
mockMvc.perform(post("/api/events").contentType(MediaType.APPLICATION_JSON)
.content(validEventJson).with(csrf())).andExpect(status().isForbidden());
}
Expand All @@ -141,7 +147,7 @@ void testUserEventLimitations() throws Exception {
@WithMockUser(authorities = {})
@DisplayName("No authorities should deny access")
void testNoAuthoritiesAccess() throws Exception {
String validEventJson = "{\"name\": \"Unauthorized\", \"description\": \"Should fail\", \"location\": \"Test Location\", \"date\": \"2025-12-31\", \"time\": \"14:30\"}";
String validEventJson = "{\"name\": \"Unauthorized\", \"description\": \"Should fail\", \"location\": \"Test Location\", \"date\": \"" + futureDate() + "\", \"time\": \"14:30\"}";
mockMvc.perform(post("/api/events").contentType(MediaType.APPLICATION_JSON)
.content(validEventJson).with(csrf())).andExpect(status().isForbidden());
}
Expand Down Expand Up @@ -180,7 +186,7 @@ void testMultiplePermissionLevels() {
@DisplayName("Partial admin permissions should work correctly")
void testPartialAdminPermissions() throws Exception {
// User with some admin privileges can create events
String validEventJson = "{\"name\": \"Partial Admin Event\", \"description\": \"Test\", \"location\": \"Test Location\", \"date\": \"2025-12-31\", \"time\": \"14:30\"}";
String validEventJson = "{\"name\": \"Partial Admin Event\", \"description\": \"Test\", \"location\": \"Test Location\", \"date\": \"" + futureDate() + "\", \"time\": \"14:30\"}";
mockMvc.perform(post("/api/events").contentType(MediaType.APPLICATION_JSON)
.content(validEventJson).with(csrf())).andExpect(status().isOk());
}
Expand Down
Loading