diff --git a/README.md b/README.md index ccb732c..5b13f73 100644 --- a/README.md +++ b/README.md @@ -1,36 +1,23 @@ -## Customize this file after creating the new REPO and remove this lines. -What to adjust: -* Add the your project or repo name direct under the logo. -* Add a short and long desciption. -* Add links for your final repo to report a bug or request a feature. -* Add list of used technologies. -* If you have, add a roadmap or remove this section. -* Fill up the section for set up and documentation. - * Start in this file only with documentation and link to the docs folder. -* Add project shields. Use [shields.io](https://shields.io/) - -## ------- end to remove ------- - - -# repo or project name - -*Add a description from your project here.* +# Kitafinder-KitaApp-EAI +*Dieses Enterprise Application Interface bietet eine Schnittstelle für die Kita-App an, über die Daten vom Kitafinder abgefragt werden können.* ### Built With -The documentation project is built with technologies we use in our projects: +This project is built with the following technologies: -* *write here the list of used technologies* +* Java +* Spring Boot +* Maven ## Roadmap -*if you have a ROADMAP for your project add this here* +![Under construction](https://www.pngplay.com/wp-content/uploads/6/Under-Construction-Icon-PNG.png) +*This project is currently being developed.* See the [open issues](#) for a full list of proposed features (and known issues). - ## Set up *how can i start and fly this project* @@ -53,12 +40,10 @@ Don't forget to give the project a star! Thanks again! More about this in the [CODE_OF_CONDUCT](/CODE_OF_CONDUCT.md) file. - ## License Distributed under the MIT License. See [LICENSE](LICENSE) file for more information. - ## Contact it@M - opensource@muenchen.de diff --git a/pom.xml b/pom.xml index 0153b25..fbe3523 100644 --- a/pom.xml +++ b/pom.xml @@ -21,10 +21,20 @@ ${java.version} + org.springframework.boot spring-boot-starter-security + + org.springframework.boot + spring-boot-starter-oauth2-resource-server + + + org.springframework.security + spring-security-oauth2-jose + + org.springframework.boot spring-boot-starter-data-jdbc @@ -57,6 +67,12 @@ true + + org.modelmapper + modelmapper + 3.2.0 + + org.springframework.boot @@ -71,19 +87,6 @@ 2.5.0 - - - org.springdoc - springdoc-openapi-starter-webmvc-ui - 2.5.0 - - - - org.modelmapper - modelmapper - 3.2.0 - - javax.validation diff --git a/src/main/java/de/muenchen/rbs/kitafindereai/config/SecurityConfiguration.java b/src/main/java/de/muenchen/rbs/kitafindereai/config/SecurityConfiguration.java index ff22b26..80d3a38 100644 --- a/src/main/java/de/muenchen/rbs/kitafindereai/config/SecurityConfiguration.java +++ b/src/main/java/de/muenchen/rbs/kitafindereai/config/SecurityConfiguration.java @@ -4,37 +4,47 @@ */ package de.muenchen.rbs.kitafindereai.config; -import org.springframework.boot.autoconfigure.web.client.RestTemplateAutoConfiguration; -import org.springframework.boot.web.client.RestTemplateBuilder; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.Import; +import org.springframework.context.annotation.Profile; +import org.springframework.security.config.Customizer; import org.springframework.security.config.annotation.method.configuration.EnableMethodSecurity; import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; -import org.springframework.security.config.annotation.web.configuration.WebSecurityCustomizer; import org.springframework.security.web.SecurityFilterChain; +import lombok.extern.slf4j.Slf4j; + /** * The central class for configuration of all security aspects. */ +@Slf4j @Configuration @EnableWebSecurity -@EnableMethodSecurity(prePostEnabled = true, proxyTargetClass = true) -@Import(RestTemplateAutoConfiguration.class) +@EnableMethodSecurity(prePostEnabled = true) public class SecurityConfiguration { @Bean - public SecurityFilterChain filterChain(HttpSecurity http, RestTemplateBuilder restTemplateBuilder) - throws Exception { - http.authorizeHttpRequests(h -> h.anyRequest().permitAll()); + @Profile("!no-security") + public SecurityFilterChain filterChain(HttpSecurity http) throws Exception { + http + .authorizeHttpRequests((authorize) -> authorize + .requestMatchers("/actuator/info", "/actuator/health/**", "/explorer/**", "/h2-console/**", + "/swagger-ui/**", "/v3/api-docs/**", "/**") + .permitAll() + .anyRequest().authenticated()) + .oauth2ResourceServer((oauth2) -> oauth2 + .opaqueToken(Customizer.withDefaults())); return http.build(); } @Bean - public WebSecurityCustomizer webSecurityCustomizer() { - return web -> web.ignoring().requestMatchers( - "/actuator/info", "/actuator/health/**", "/explorer/**", "/h2-console/**"); + @Profile("no-security") + public SecurityFilterChain noSecurityFilterChain(HttpSecurity http) + throws Exception { + log.warn("Using mode 'no-security'!"); + http.authorizeHttpRequests(authorize -> authorize.anyRequest().permitAll()); + return http.build(); } } \ No newline at end of file diff --git a/src/main/java/de/muenchen/rbs/kitafindereai/data/KitafinderKitaKonfigData.java b/src/main/java/de/muenchen/rbs/kitafindereai/data/KitafinderKitaKonfigData.java index 4a5a1e4..3394da7 100644 --- a/src/main/java/de/muenchen/rbs/kitafindereai/data/KitafinderKitaKonfigData.java +++ b/src/main/java/de/muenchen/rbs/kitafindereai/data/KitafinderKitaKonfigData.java @@ -4,6 +4,7 @@ */ package de.muenchen.rbs.kitafindereai.data; +import de.muenchen.rbs.kitafindereai.api.model.Institute; import jakarta.persistence.Column; import jakarta.persistence.Entity; import jakarta.persistence.Id; @@ -12,7 +13,7 @@ import lombok.Data; /** - * + * In der EAI gespeicherte Daten zu einer Einrichtung ({@link Institute}) */ @Entity @Data diff --git a/src/main/java/de/muenchen/rbs/kitafindereai/data/KitafinderKitaKonfigDataDto.java b/src/main/java/de/muenchen/rbs/kitafindereai/data/KitafinderKitaKonfigDataDto.java index 58ead8d..e6961b5 100644 --- a/src/main/java/de/muenchen/rbs/kitafindereai/data/KitafinderKitaKonfigDataDto.java +++ b/src/main/java/de/muenchen/rbs/kitafindereai/data/KitafinderKitaKonfigDataDto.java @@ -8,7 +8,7 @@ import lombok.Data; /** - * + * DTO für {@link KitafinderKitaKonfigData} */ @Data public class KitafinderKitaKonfigDataDto { diff --git a/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/src/main/resources/META-INF/additional-spring-configuration-metadata.json new file mode 100644 index 0000000..6bb03c2 --- /dev/null +++ b/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -0,0 +1,12 @@ +{"properties": [ + { + "name": "app.password-encoder.encryptor.password", + "type": "java.lang.String", + "description": "Passwort für die Erstellung eines TextEncryptors." + }, + { + "name": "app.password-encoder.encryptor.salt", + "type": "java.lang.String", + "description": "Salt für die Erstellung eines TextEncryptors.Passwort für die Erstellung eines TextEncryptors." + } +]} \ No newline at end of file diff --git a/src/main/resources/application.properties b/src/main/resources/application.yml similarity index 100% rename from src/main/resources/application.properties rename to src/main/resources/application.yml diff --git a/src/main/resources/db/migration/V001__Initial_Schema.sql b/src/main/resources/db/migration/V001__Initial_Schema.sql new file mode 100644 index 0000000..eb01117 --- /dev/null +++ b/src/main/resources/db/migration/V001__Initial_Schema.sql @@ -0,0 +1,6 @@ +CREATE TABLE "KITA_DATA" ( + "KIBIGWEB_ID" VARCHAR(255), + "PASSWORD" VARCHAR(255), + "KITA_ID_EXTERN" VARCHAR(255), + "TRAEGER" VARCHAR(255) +); \ No newline at end of file