From cdda4b90e297ecb3fc158ce51cf5f3f07567bdff Mon Sep 17 00:00:00 2001
From: Andrej Zabka <andrej.zabka@mavenir.com>
Date: Thu, 4 May 2023 10:15:19 +0200
Subject: [PATCH] merge develop to security fixes

---
 core/openapi.yaml                                   |  1 -
 .../java/cz/muni/pa165/config/SecurityConfig.java   |  2 +-
 core/src/main/resources/application.properties      | 13 +++++++++++++
 prometheus.yml                                      |  2 +-
 4 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/core/openapi.yaml b/core/openapi.yaml
index 33ff32b..03bf981 100644
--- a/core/openapi.yaml
+++ b/core/openapi.yaml
@@ -13,7 +13,6 @@ tags:
   - name: EngineerService
 
 components:
-
   schemas:
     CarComponentType:
       type: string
diff --git a/core/src/main/java/cz/muni/pa165/config/SecurityConfig.java b/core/src/main/java/cz/muni/pa165/config/SecurityConfig.java
index 502ed5a..5c9e371 100644
--- a/core/src/main/java/cz/muni/pa165/config/SecurityConfig.java
+++ b/core/src/main/java/cz/muni/pa165/config/SecurityConfig.java
@@ -22,7 +22,7 @@ public class SecurityConfig {
         http.csrf().disable();
         http
                 .authorizeHttpRequests(x -> x
-                        .requestMatchers("/swagger-ui/**", "/v3/api-docs/**").permitAll()
+                        .requestMatchers("/swagger-ui/**", "/v3/api-docs/**", "/seed", "/clear").permitAll()
                         .requestMatchers(HttpMethod.POST,"/carComponent").hasAuthority("SCOPE_test_1")
                         .requestMatchers(HttpMethod.GET, "/carComponent").hasAnyAuthority("SCOPE_test_5", "SCOPE_test_1")
                         .requestMatchers("/carComponent/**").hasAnyAuthority("SCOPE_test_5", "SCOPE_test_1")
diff --git a/core/src/main/resources/application.properties b/core/src/main/resources/application.properties
index 9eefabd..05ace69 100644
--- a/core/src/main/resources/application.properties
+++ b/core/src/main/resources/application.properties
@@ -13,6 +13,19 @@ spring.cache.type=NONE
 spring.profiles.active=dev
 appconfig.enablecache=false
 
+#resource server nastavenia
+spring.security.oauth2.resourceserver.opaquetoken.introspection-uri=https://oidc.muni.cz/oidc/introspect
+spring.security.oauth2.resourceserver.opaquetoken.client-id=d57b3a8f-156e-46de-9f27-39c4daee05e1
+spring.security.oauth2.resourceserver.opaquetoken.client-secret=fa228ebc-4d54-4cda-901e-4d6287f8b1652a9c9c44-73c9-4502-973f-bcdb4a8ec96a
+
+#logovanie security do console
+logging.level.org.springframework.security=DEBUG
+
+#swagger nastavenia
+springdoc.swagger-ui.oauth.client-id=7e02a0a9-446a-412d-ad2b-90add47b0fdd
+springdoc.swagger-ui.oauth.client-secret=48a2b2e3-4b2b-471e-b7b7-b81a85b6eeef22f347f2-3fc9-4e16-8698-3e2492701a89
+springdoc.swagger-ui.oauth.scopes=openid, test_1, test_5
+
 management.endpoints.web.exposure.include=info,health,metrics,loggers,beans,env,prometheus
 management.endpoint.health.show-details=always
 management.endpoint.health.show-components=always
diff --git a/prometheus.yml b/prometheus.yml
index 6254164..58b2dcf 100644
--- a/prometheus.yml
+++ b/prometheus.yml
@@ -11,7 +11,7 @@ scrape_configs:
     metrics_path: /actuator/prometheus
     static_configs:
       - targets:
-        - host.docker.internal:8080
+        - host.docker.internal:8090
         - host.docker.internal:8081
         - host.docker.internal:8082
         - host.docker.internal:8083
\ No newline at end of file
-- 
GitLab