commit 44765e5e70928ec4ed7af55f9779be4b6c66a030
Author: Petr Urban <urbanp@gapps.zcu.cz>
Date:   Wed Apr 26 21:35:01 2023 +0200

    #10521 - created controller, service, repository and models for handling requests for v2/app/metadata/ endpoint

diff --git a/pom.xml b/pom.xml
index 931b253..24832dd 100644
--- a/pom.xml
+++ b/pom.xml
@@ -176,8 +176,13 @@
 			<artifactId>mssql-jdbc</artifactId>
 			<version>12.2.0.jre11</version>
 		</dependency>
+        <dependency>
+            <groupId>com.google.code.gson</groupId>
+            <artifactId>gson</artifactId>
+            <version>2.10.1</version>
+        </dependency>
 
-	</dependencies>
+    </dependencies>
 
 	<build>
 		<plugins>
diff --git a/src/main/java/cz/zcu/fav/kiv/antipatterndetectionapp/v2/config/SecurityBasics.java b/src/main/java/cz/zcu/fav/kiv/antipatterndetectionapp/v2/config/SecurityBasics.java
new file mode 100644
index 0000000..1a141a3
--- /dev/null
+++ b/src/main/java/cz/zcu/fav/kiv/antipatterndetectionapp/v2/config/SecurityBasics.java
@@ -0,0 +1,13 @@
+package cz.zcu.fav.kiv.antipatterndetectionapp.v2.config;
+
+public class SecurityBasics {
+
+    public static final String[] NO_AUTHORIZATION_NEEDED = new String[]{
+            "/v2/user/register",
+            "/v2/user/login",
+            "/v2/user/refresh",
+            "/v2/user/logout",
+            "/v2/app/about"
+    };
+
+}
diff --git a/src/main/java/cz/zcu/fav/kiv/antipatterndetectionapp/v2/controller/AboutPageController.java b/src/main/java/cz/zcu/fav/kiv/antipatterndetectionapp/v2/controller/AboutPageController.java
new file mode 100644
index 0000000..234712d
--- /dev/null
+++ b/src/main/java/cz/zcu/fav/kiv/antipatterndetectionapp/v2/controller/AboutPageController.java
@@ -0,0 +1,55 @@
+package cz.zcu.fav.kiv.antipatterndetectionapp.v2.controller;
+
+import com.google.gson.Gson;
+import cz.zcu.fav.kiv.antipatterndetectionapp.v2.model.AboutPageDto;
+import cz.zcu.fav.kiv.antipatterndetectionapp.v2.model.Metadata;
+import cz.zcu.fav.kiv.antipatterndetectionapp.v2.service.AboutPageService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Controller for dealing with requests that wants to obtain specific data related to the project.
+ * Those data are mostly metadata to provide basic information, so there is no need for authentication at most cases.
+ *
+ * @author Petr Urban
+ * @since 2023-04-26
+ * @version 1.0.0
+ */
+
+@RestController
+@RequestMapping("/v2/app/metadata")
+public class AboutPageController {
+
+    @Autowired
+    private AboutPageService aboutPageService;
+
+    private final String BASIC_INFO_COLUMN_KEY_VALUE = "basics";
+
+    @GetMapping("/about")
+    public ResponseEntity<String> getAboutPageData() {
+        List<Metadata> data = aboutPageService.findAll();
+        return ResponseEntity.status(data.size() > 0 ? HttpStatus.OK : HttpStatus.NO_CONTENT).body(new Gson().toJson(findAboutData(data)));
+    }
+
+    private List<AboutPageDto> findAboutData(List<Metadata> metadata) {
+        if (metadata == null || metadata.isEmpty()) {
+            return new ArrayList<>();
+        }
+
+        for (Metadata cursor : metadata) {
+            if (cursor.getAppDataKey().equals(BASIC_INFO_COLUMN_KEY_VALUE)) {
+                return new Gson().fromJson(cursor.getAppDataValue(), List.class);
+            }
+        }
+
+        return new ArrayList<>();
+    }
+
+}
diff --git a/src/main/java/cz/zcu/fav/kiv/antipatterndetectionapp/v2/model/AboutPageDto.java b/src/main/java/cz/zcu/fav/kiv/antipatterndetectionapp/v2/model/AboutPageDto.java
new file mode 100644
index 0000000..c29a957
--- /dev/null
+++ b/src/main/java/cz/zcu/fav/kiv/antipatterndetectionapp/v2/model/AboutPageDto.java
@@ -0,0 +1,44 @@
+package cz.zcu.fav.kiv.antipatterndetectionapp.v2.model;
+
+import java.util.List;
+
+/**
+ *
+ * Dto for deserialization of the obtained data from the dbo.app_metadata table, respectively for the "basics" key value
+ *
+ * @author Petr Urban
+ * @since 2023-04-26
+ * @version 1.0.0
+ */
+public class AboutPageDto {
+
+    private int version;
+
+    private List<String> authors;
+
+    private String description;
+
+    public int getVersion() {
+        return version;
+    }
+
+    public void setVersion(int version) {
+        this.version = version;
+    }
+
+    public List<String> getAuthors() {
+        return authors;
+    }
+
+    public void setAuthors(List<String> authors) {
+        this.authors = authors;
+    }
+
+    public String getDescription() {
+        return description;
+    }
+
+    public void setDescription(String description) {
+        this.description = description;
+    }
+}
diff --git a/src/main/java/cz/zcu/fav/kiv/antipatterndetectionapp/v2/model/Metadata.java b/src/main/java/cz/zcu/fav/kiv/antipatterndetectionapp/v2/model/Metadata.java
new file mode 100644
index 0000000..a276f8b
--- /dev/null
+++ b/src/main/java/cz/zcu/fav/kiv/antipatterndetectionapp/v2/model/Metadata.java
@@ -0,0 +1,45 @@
+package cz.zcu.fav.kiv.antipatterndetectionapp.v2.model;
+
+import javax.persistence.*;
+
+/**
+ * @author Petr Urban
+ * @since 2023-04-26
+ * @version 1.0.0
+ */
+@Entity
+@Table(name = "app_metadata")
+public class Metadata {
+
+    @Id
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    private Long id;
+
+    private String appDataKey;
+
+    private String appDataValue;
+
+    public String getAppDataKey() {
+        return appDataKey;
+    }
+
+    public void setAppDataKey(String appDataKey) {
+        this.appDataKey = appDataKey;
+    }
+
+    public String getAppDataValue() {
+        return appDataValue;
+    }
+
+    public void setAppDataValue(String appDataValue) {
+        this.appDataValue = appDataValue;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    public Long getId() {
+        return id;
+    }
+}
diff --git a/src/main/java/cz/zcu/fav/kiv/antipatterndetectionapp/v2/repository/AboutPageRepository.java b/src/main/java/cz/zcu/fav/kiv/antipatterndetectionapp/v2/repository/AboutPageRepository.java
new file mode 100644
index 0000000..c0bf1a6
--- /dev/null
+++ b/src/main/java/cz/zcu/fav/kiv/antipatterndetectionapp/v2/repository/AboutPageRepository.java
@@ -0,0 +1,8 @@
+package cz.zcu.fav.kiv.antipatterndetectionapp.v2.repository;
+
+import cz.zcu.fav.kiv.antipatterndetectionapp.v2.model.Metadata;
+import org.springframework.data.jpa.repository.JpaRepository;
+
+public interface AboutPageRepository extends JpaRepository<Metadata, Long> {
+
+}
diff --git a/src/main/java/cz/zcu/fav/kiv/antipatterndetectionapp/v2/security/JwtAuthenticationFilter.java b/src/main/java/cz/zcu/fav/kiv/antipatterndetectionapp/v2/security/JwtAuthenticationFilter.java
index e97e43c..6ed8005 100644
--- a/src/main/java/cz/zcu/fav/kiv/antipatterndetectionapp/v2/security/JwtAuthenticationFilter.java
+++ b/src/main/java/cz/zcu/fav/kiv/antipatterndetectionapp/v2/security/JwtAuthenticationFilter.java
@@ -1,5 +1,6 @@
 package cz.zcu.fav.kiv.antipatterndetectionapp.v2.security;
 
+import cz.zcu.fav.kiv.antipatterndetectionapp.v2.config.SecurityBasics;
 import cz.zcu.fav.kiv.antipatterndetectionapp.v2.httpExceptions.CustomExceptionHandler;
 import cz.zcu.fav.kiv.antipatterndetectionapp.v2.service.OAuthService;
 import cz.zcu.fav.kiv.antipatterndetectionapp.v2.utils.JSONBuilder;
@@ -20,6 +21,7 @@ import javax.servlet.ServletException;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
+import java.util.Arrays;
 import java.util.Collections;
 
 @Component
@@ -80,8 +82,8 @@ public class JwtAuthenticationFilter extends OncePerRequestFilter {
 
     @Override
     protected boolean shouldNotFilter(HttpServletRequest request) throws ServletException {
-            String path = request.getRequestURI().substring(request.getContextPath().length());
-        return path.startsWith("/v2/user/login") || path.startsWith("/v2/user/register");
+        String path = request.getRequestURI().substring(request.getContextPath().length());
+        return Arrays.stream(SecurityBasics.NO_AUTHORIZATION_NEEDED).anyMatch(path::startsWith);
     }
 
 
diff --git a/src/main/java/cz/zcu/fav/kiv/antipatterndetectionapp/v2/security/WebSecurityConfig.java b/src/main/java/cz/zcu/fav/kiv/antipatterndetectionapp/v2/security/WebSecurityConfig.java
index bc46ca6..8e9a553 100644
--- a/src/main/java/cz/zcu/fav/kiv/antipatterndetectionapp/v2/security/WebSecurityConfig.java
+++ b/src/main/java/cz/zcu/fav/kiv/antipatterndetectionapp/v2/security/WebSecurityConfig.java
@@ -1,5 +1,6 @@
 package cz.zcu.fav.kiv.antipatterndetectionapp.v2.security;
 
+import cz.zcu.fav.kiv.antipatterndetectionapp.v2.config.SecurityBasics;
 import cz.zcu.fav.kiv.antipatterndetectionapp.v2.service.AuthProvider;
 import cz.zcu.fav.kiv.antipatterndetectionapp.v2.service.OAuthService;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -74,7 +75,7 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
                 .and()
                 .csrf().disable()
                 .authorizeRequests()
-                .mvcMatchers("/v2/user/register", "/v2/user/login", "/v2/user/refresh", "/v2/user/logout").permitAll()
+                .mvcMatchers(SecurityBasics.NO_AUTHORIZATION_NEEDED).permitAll()
                 .anyRequest().authenticated()
                 .and()
                 .sessionManagement()
diff --git a/src/main/java/cz/zcu/fav/kiv/antipatterndetectionapp/v2/service/AboutPageService.java b/src/main/java/cz/zcu/fav/kiv/antipatterndetectionapp/v2/service/AboutPageService.java
new file mode 100644
index 0000000..081f759
--- /dev/null
+++ b/src/main/java/cz/zcu/fav/kiv/antipatterndetectionapp/v2/service/AboutPageService.java
@@ -0,0 +1,22 @@
+package cz.zcu.fav.kiv.antipatterndetectionapp.v2.service;
+
+import cz.zcu.fav.kiv.antipatterndetectionapp.v2.model.Metadata;
+
+import java.util.List;
+
+/**
+ * Interface used in the AboutPageServiceImpl
+ *
+ * @author Petr Urban
+ * @since 2023-04-26
+ * @version 1.0.0
+ */
+public interface AboutPageService {
+
+    /**
+     * method in which it's a great time to call findAll to jdbc repository
+     * @return list of obtained rows from the database
+     */
+    List<Metadata> findAll();
+
+}
diff --git a/src/main/java/cz/zcu/fav/kiv/antipatterndetectionapp/v2/service/AboutPageServiceImpl.java b/src/main/java/cz/zcu/fav/kiv/antipatterndetectionapp/v2/service/AboutPageServiceImpl.java
new file mode 100644
index 0000000..3383009
--- /dev/null
+++ b/src/main/java/cz/zcu/fav/kiv/antipatterndetectionapp/v2/service/AboutPageServiceImpl.java
@@ -0,0 +1,28 @@
+package cz.zcu.fav.kiv.antipatterndetectionapp.v2.service;
+
+import cz.zcu.fav.kiv.antipatterndetectionapp.v2.model.Metadata;
+import cz.zcu.fav.kiv.antipatterndetectionapp.v2.repository.AboutPageRepository;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * Implementation of service that processes data required from AboutPageController.java
+ *
+ * @author Petr Urban
+ * @since 2023-04-26
+ * @version 1.0.0
+ */
+@Service
+public class AboutPageServiceImpl implements AboutPageService {
+
+    @Autowired
+    private AboutPageRepository repository;
+
+    @Override
+    public List<Metadata> findAll() {
+        return repository.findAll();
+    }
+
+}
