Skip to content
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
152 changes: 80 additions & 72 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,77 +1,85 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>4.0.4</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>team4you</groupId>
<artifactId>team4you</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>team4you</name>
<description>team4you</description>
<url/>
<licenses>
<license/>
</licenses>
<developers>
<developer/>
</developers>
<scm>
<connection/>
<developerConnection/>
<tag/>
<url/>
</scm>
<properties>
<java.version>25</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-webmvc</artifactId>
</dependency>
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>4.0.3</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
Comment on lines +5 to +10
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Check if Spring Boot 4.0.4 exists on Maven Central
curl -s "https://search.maven.org/solrsearch/select?q=g:org.springframework.boot+AND+a:spring-boot-starter-parent&rows=5&wt=json" | jq '.response.docs[].latestVersion'

Repository: ithsjava25/project-backend-team4you

Length of output: 86


Update Spring Boot version to a valid release.

Spring Boot 4.0.4 does not exist. Maven Central shows the latest version is 3.5.3. Update the parent version in pom.xml to use a valid Spring Boot release (e.g., 3.5.3 or another supported 3.x version) to prevent dependency resolution failures.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@pom.xml` around lines 5 - 10, The pom.xml parent block declares Spring Boot
as org.springframework.boot:spring-boot-starter-parent with an invalid version
4.0.4; update the <version> inside that parent element to a valid Spring Boot
3.x release (for example change the version value to 3.5.3) so Maven can resolve
dependencies correctly, keeping the groupId and artifactId unchanged.

<groupId>team4you</groupId>
<artifactId>team4you</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>team4you</name>
<description>team4you</description>
<url/>
<licenses>
<license/>
</licenses>
<developers>
<developer/>
</developers>
<scm>
<connection/>
<developerConnection/>
<tag/>
<url/>
</scm>
<properties>
<java.version>25</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-webmvc</artifactId>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-docker-compose</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-webmvc-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-flyway</artifactId>
</dependency>
<dependency>
<groupId>org.flywaydb</groupId>
<artifactId>flyway-database-postgresql</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
</dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-docker-compose</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-webmvc-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-flyway</artifactId>
</dependency>
<dependency>
<groupId>org.flywaydb</groupId>
<artifactId>flyway-database-postgresql</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<dependency>
<groupId>nz.net.ultraq.thymeleaf</groupId>
<artifactId>thymeleaf-layout-dialect</artifactId>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>

</project>
</project>
49 changes: 49 additions & 0 deletions src/main/java/backendlab/team4you/user/UserController.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
package backendlab.team4you.user;


import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;

import java.util.Arrays;
import java.util.List;

@Controller
public class UserController {



@GetMapping("/")
public String homepage(){
return "home";
}


@GetMapping("/booking")
public String booking(){
return "booking";
}

@GetMapping("/application")
public String application(Model model){
List<String> application = Arrays.asList("Ärende #1 - Pågående", "Ärende #15 - Väntar på beslut");
model.addAttribute("application", application);
model.addAttribute("userName", "Test user");

return "application";
}

@GetMapping("/profile")
public String profile(){
return "profile";
}

@GetMapping("/admin")
public String admin(){
return "admin";
}
Comment on lines +41 to +44
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Verify whether /admin is protected globally or by method security.
rg -n -C3 --type=java '@EnableWebSecurity|SecurityFilterChain|HttpSecurity|authorizeHttpRequests|requestMatchers|/admin|@EnableMethodSecurity|@PreAuthorize|@Secured'

Repository: ithsjava25/project-backend-team4you

Length of output: 628


🏁 Script executed:

#!/bin/bash
# Search for security configuration class
fd -name '*SecurityConfig*' -o -name '*Security*Config*' -o -name '*Config*' | grep -i security

# Search for `@PreAuthorize` and `@Secured` annotations in the entire codebase
rg -n --type=java '@PreAuthorize|@Secured|@RoleRequired' 

# Check for application configuration files
fd -name 'application*.yml' -o -name 'application*.properties'

# Check the complete UserController class for all annotations
rg -B 20 -A 30 '@GetMapping\("/admin"\)' src/main/java/backendlab/team4you/user/UserController.java

Repository: ithsjava25/project-backend-team4you

Length of output: 1242


🏁 Script executed:

#!/bin/bash
# Search for security config files with proper syntax
find . -name '*SecurityConfig*' -o -name '*Security*' -o -name '*Config*' 2>/dev/null | head -20

# Search for `@Configuration` and `@EnableWebSecurity` annotations
rg '@Configuration|@EnableWebSecurity' --type=java

# Look for application configuration files
find . -path ./target -prune -o -name 'application*.yml' -o -name 'application*.properties' -print 2>/dev/null

# Check for Spring Security in dependencies
find . -name 'pom.xml' -o -name 'build.gradle' 2>/dev/null | head -5

Repository: ithsjava25/project-backend-team4you

Length of output: 132


🏁 Script executed:

#!/bin/bash
# Check pom.xml for Spring Security dependency
grep -i 'spring-security\|security' pom.xml

# Read application.properties for security config
cat src/main/resources/application.properties

# Search for any `@Configuration` classes
rg '@Configuration' --type=java -A 5

# List all Java files in main source to understand project structure
find src/main/java -name '*.java' -type f

Repository: ithsjava25/project-backend-team4you

Length of output: 596


🏁 Script executed:

#!/bin/bash
# Read the complete pom.xml to verify Spring Security is not included
cat pom.xml

# Search for any custom filters, interceptors, or servlet security mechanisms
rg 'Filter|Interceptor|Authentication|Authorization' --type=java -l

Repository: ithsjava25/project-backend-team4you

Length of output: 2936


The /admin endpoint and entire application lack authentication/authorization protection.

Spring Security is not configured in this project (no dependency in pom.xml, no @EnableWebSecurity configuration, no security filters). The /admin endpoint at lines 41-44 is completely exposed with no access control whatsoever. Before production use, implement Spring Security with role-based access control (e.g., @PreAuthorize("hasRole('ADMIN')") on this endpoint) or an alternative authentication mechanism.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/main/java/backendlab/team4you/user/UserController.java` around lines 41 -
44, The /admin endpoint in UserController (method admin) is unprotected; add
Spring Security and enforce role-based access: add the Spring Security
dependency, create a SecurityConfig class (annotated with `@Configuration` and
`@EnableWebSecurity` or use `@EnableMethodSecurity`) that configures HTTP security
to require authentication and maps ROLE_ADMIN to the /admin path (or enables
method security), and either annotate UserController.admin with
`@PreAuthorize`("hasRole('ADMIN')") or rely on the HTTP security rule; also
register an AuthenticationProvider/UserDetailsService (in-memory or real) so
ADMIN users exist and authentication works. Ensure the config registers
necessary security filters so the endpoint is not publicly accessible.

@GetMapping("/contact")
public String contact(){
return "contact";
}
}
2 changes: 2 additions & 0 deletions src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ spring.datasource.password=${DB_PASSWORD}

spring.flyway.enabled=true



spring.jpa.hibernate.ddl-auto=validate
spring.jpa.show-sql=true
spring.jpa.properties.hibernate.format_sql=true
45 changes: 45 additions & 0 deletions src/main/resources/static/css/admin.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
*{
margin:0;
padding:0;
box-sizing: border-box;
font-family: Poppins, sans-serif;
}

.container{
width:250px;
height: 100%;
position:absolute;
background: #f3f3f3;
z-index: 1;
transition: 0.5s;
}

.home{
padding: 10px;
}

.application{
padding: 10px;
}

.profile{
padding: 10px;
}
.contact{
padding: 10px;
}
.logout{
padding: 10px;
}

.booking{
padding: 10px;
}

li:hover{
color: #6017a8;
text-decoration: none;
font-size: 1.2rem;
font-weight: 500;
cursor: pointer;
}
59 changes: 59 additions & 0 deletions src/main/resources/static/css/application.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}

body {

background-color: #f0f2f5;
font-family: Poppins, sans-serif;
Comment on lines +7 to +10
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Fix Stylelint violation in body block.

There is an unexpected empty line before background-color (Line 9). Remove the blank line to satisfy declaration-empty-line-before.

🧰 Tools
🪛 Stylelint (17.5.0)

[error] 9-9: Unexpected empty line before declaration (declaration-empty-line-before)

(declaration-empty-line-before)

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/main/resources/static/css/application.css` around lines 7 - 10, Remove
the unexpected blank line inside the CSS body rule so declarations start
immediately after the opening brace; specifically, edit the body block (selector
"body") to eliminate the empty line before the background-color declaration so
the first declaration directly follows the opening brace and satisfies
declaration-empty-line-before.

color: #333;
line-height: 1.6;
}

.container {
max-width: 800px;
margin: 40px auto;
padding: 0 20px;
}

.apply-container,
.waiting-decision,
.decided-application {
background-color: #ffffff;
border: 1px solid #ddd;
border-radius: 8px;
padding: 25px;
margin-bottom: 25px;
box-shadow: 0 2px 5px rgba(0,0,0,0.05);
text-align: left;
}

h2 {
font-size: 1.4rem;
margin-bottom: 15px;
display: flex;
align-items: center;
gap: 10px;
color: #1a2b3c;
}

.list-unstyled {
list-style: none;
}

.forth-container, .decision-container {
border: 1px solid #eee;
padding: 15px;
border-radius: 6px;
transition: transform 0.2s;
margin-top: 10px;
}

.forth-container:hover, .decision-container:hover {
border-color: #38bdf8;
background-color: #f8fafc;
cursor: pointer;
}

28 changes: 28 additions & 0 deletions src/main/resources/static/css/booking.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
.container {
max-width: 800px;
margin: 40px auto;
padding: 0 20px;
}

.card {
background-color: #ffffff;
border: 1px solid #ddd;
border-radius: 8px;
padding: 30px;
box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}


.section-booking, .section-calling {
margin-top: 20px;
padding: 20px;
border-bottom: 1px solid #eee;
}

.section-calling {
border: 1px solid purple;
}

.section-booking {
border: 1px solid purple;
}
Loading