Skip to content

Commit

Permalink
Feature/init cosys integration (#134)
Browse files Browse the repository at this point in the history
* 🎉 cosys cp from digiwf

* ♻️ cosys refactor poms

* ♻️ cosys cleanup poms

* 🔥 cosys rm streaming adapter

* ♻️ cosys rm presignedurls and refactor digiwf exceptions

* 🔥 cosys rm archunit test

* ♻️ cosys update package names

* ♻️ cosys convert domain models to records

* 🎨 cosys format with spotless

* 🔥 cosys rm unneeded openapi generator files

* 🔥 cosys refactor digiwf naming for classes and properties

* 🎨 s3 format with spotless

* ♻️ s3 configure oauth provider s3 specific

* ✨ cosys init auth config in starter

* 📝 cosys update README.md

* 🔥 cosys rm deprecated comment

* 📌 cosys cleanup pom versions

* ♻️ cosys rm oauth config through starter

* ♻️ cosys example use new oauth2 config style

* 🔖 cosys fix versions after bump

* 🔖 cosys fix versions after bump

* 🐛 cosys rm oauth config through starter fix import

* 🚨 fix pmd warnings

* fix cosys name typo

Co-authored-by: Tobias Stadler <[email protected]>

* ♻️ cosys align mockito usage

* 🔥 cosys rm unneeded format suppress

* ✨ cosys validate merge props and add example

* ✨ cosys add link to product

* ♻️ cosys example use example url for cosys

---------

Co-authored-by: Tobias Stadler <[email protected]>
  • Loading branch information
simonhir and devtobi authored Nov 14, 2024
1 parent dfd4d74 commit 7755985
Show file tree
Hide file tree
Showing 31 changed files with 2,937 additions and 4 deletions.
2 changes: 2 additions & 0 deletions refarch-integrations/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ Collection of different integration which can be used as is in RefArch projects.
s3-integration for file handling.
- [dms-integration](./refarch-dms-integration/README.md): For CRUD operations on a dms system in specific fabasoft. Uses
s3-integration for file handling.
- [cosys-integration](./refarch-cosys-integration/README.md): For creating documents with coSys. Uses
s3-integration for file handling.

## Naming conventions

Expand Down
10 changes: 6 additions & 4 deletions refarch-integrations/pom.xml
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
<?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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://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>3.3.4</version>
<relativePath />
<relativePath/>
</parent>

<groupId>de.muenchen.refarch</groupId>
Expand All @@ -20,6 +21,7 @@
<module>refarch-s3-integration</module>
<module>refarch-email-integration</module>
<module>refarch-dms-integration</module>
<module>refarch-cosys-integration</module>
</modules>

<properties>
Expand Down Expand Up @@ -235,8 +237,8 @@
<eclipse>
<file>itm-java-codeformat/java_codestyle_formatter.xml</file>
</eclipse>
<trimTrailingWhitespace />
<endWithNewline />
<trimTrailingWhitespace/>
<endWithNewline/>
</java>
</configuration>
<executions>
Expand Down
62 changes: 62 additions & 0 deletions refarch-integrations/refarch-cosys-integration/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# RefArch CoSys integration

Integration for creating documents with [coSys](https://www.cib.de/cosys/). Uses s3-integration for file handling.

## Usage

```xml

<dependencies>
<dependency>
<groupId>de.muenchen.refarch</groupId>
<artifactId>refarch-cosys-integration-starter</artifactId>
<version>...</version>
</dependency>
</dependencies>
```

and a [s3-integration starter](../refarch-s3-integration/README.md#usage).

## Configuration

Following are the properties to configure the different modules. Some of them are custom defined and others are synonyms
for spring package properties.
Whether a property is an alias can be checked in the corresponding `application.yml` of each module.

### refarch-cosys-integration-starter

| Property | Description | Example |
|--------------------------------------|-------------------------------------------------------------------------------|------------------|
| `refarch.cosys.url` | Url of the CoSys service | |
| `refarch.cosys.merge.datafile` | | `/root/multi` |
| `refarch.cosys.merge.inputLanguage` | incoming language | `Deutsch` |
| `refarch.cosys.merge.outputLanguage` | outgoing language | `Deutsch` |
| `refarch.cosys.merge.keepFields` | | `unresolved-ref` |

For authentication against cosys a OAuth2 registration with the name `cosys` needs to be provided.
See following example or the [according Spring documentation](https://docs.spring.io/spring-security/reference/servlet/oauth2/index.html#oauth2-client).

```yml
spring:
security:
oauth2:
client:
provider:
sso:
issuer-uri: https://sso.example.com/auth/realms/refarch
user-info-uri: ${spring.security.oauth2.client.provider.sso.issuer-uri}/protocol/openid-connect/userinfo
jwk-set-uri: ${spring.security.oauth2.client.provider.sso.issuer-uri}/protocol/openid-connect/certs
# used for RequestResponseLoggingFilter in s3-rest-service
# only required if filter is explicitly enabled
user-name-attribute: user_name
registration:
cosys:
provider: sso
authorization-grant-type: client_credentials
client-id: refarch_client
client-secret: client_secret_123
# profile required for username used in s3-rest-service RequestResponseLoggingFilter
# openid required for user info endpoint used in s3-rest-service JwtUserInfoAuthenticationConverter
# both scopes are only required if the according functions are explicitly used
scope: profile, openid
```
34 changes: 34 additions & 0 deletions refarch-integrations/refarch-cosys-integration/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>de.muenchen.refarch</groupId>
<artifactId>refarch-integrations</artifactId>
<version>1.2.0-SNAPSHOT</version>
</parent>

<artifactId>refarch-cosys-integration</artifactId>
<description>CoSys integration</description>
<packaging>pom</packaging>

<modules>
<module>refarch-cosys-integration-client</module>
<module>refarch-cosys-integration-core</module>
<module>refarch-cosys-integration-starter</module>
<module>refarch-cosys-integration-example</module>
</modules>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>de.muenchen.refarch</groupId>
<artifactId>refarch-s3-integration-client-core</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</dependencyManagement>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>de.muenchen.refarch</groupId>
<artifactId>refarch-cosys-integration</artifactId>
<version>1.2.0-SNAPSHOT</version>
</parent>

<artifactId>refarch-cosys-integration-client</artifactId>

<properties>
<openapi-generator-maven-plugin.version>7.8.0</openapi-generator-maven-plugin.version>

<jackson-databind-nullable.version>0.2.6</jackson-databind-nullable.version>
</properties>

<dependencies>
<!-- Spring -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webflux</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>

<!-- openApi -->
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-starter-webflux-ui</artifactId>
</dependency>
<dependency>
<groupId>org.openapitools</groupId>
<artifactId>jackson-databind-nullable</artifactId>
<version>${jackson-databind-nullable.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<version>${openapi-generator-maven-plugin.version}</version>
<executions>
<execution>
<id>cosys-api</id>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<inputSpec>${project.basedir}/src/main/api/api-docs.json</inputSpec>
<library>webclient</library>
<generatorName>java</generatorName>

<apiPackage>de.muenchen.refarch.integration.cosys.api</apiPackage>
<modelPackage>de.muenchen.refarch.integration.cosys.model</modelPackage>
<invokerPackage>de.muenchen.refarch.integration.cosys</invokerPackage>

<generateApiTests>false</generateApiTests>
<generateModelTests>false</generateModelTests>
<generateApiDocumentation>false</generateApiDocumentation>
<generateModelDocumentation>false</generateModelDocumentation>
<generateSupportingFiles>true</generateSupportingFiles>
<configOptions>
<hideGenerationTimestamp>true</hideGenerationTimestamp>
<useJakartaEe>true</useJakartaEe>
</configOptions>

<globalProperties>
<supportingFiles>
ApiClient.java,JavaTimeFormatter.java,Authentication.java,OAuth.java,ApiKeyAuth.java,HttpBasicAuth.java,HttpBearerAuth.java,RFC3339DateFormat.java
</supportingFiles>
</globalProperties>

</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

</project>
Loading

0 comments on commit 7755985

Please sign in to comment.