Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Bas Huisman committed Oct 22, 2024
0 parents commit caa6ce2
Show file tree
Hide file tree
Showing 9 changed files with 297 additions and 0 deletions.
34 changes: 34 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
HELP.md
target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**/target/
!**/src/test/**/target/

### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache

### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr

### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/
!**/src/main/**/build/
!**/src/test/**/build/

### VS Code ###
.vscode/
/src/main/resources/application.yml
109 changes: 109 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
<?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>3.3.4</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>nl.ictu</groupId>
<artifactId>pseudoniemenservice</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>pseudoniemenservice</name>
<description>Demo project for Spring Boot</description>
<properties>
<java.version>21</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<version>7.8.0</version>
<executions>
<execution>
<id>generateServerApi</id>
<phase>generate-sources</phase>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<inputSpec>${project.basedir}/src/main/resources/openapi.yaml</inputSpec>
<generatorName>spring</generatorName>
<modelPackage>nl.ictu.psuedoniemenservice.generated.server.model</modelPackage>
<apiPackage>nl.ictu.psuedoniemenservice.generated.server.api</apiPackage>
<generateApiTests>false</generateApiTests>
<generateApiDocumentation>false</generateApiDocumentation>
<generateModelTests>false</generateModelTests>
<generateModelDocumentation>false</generateModelDocumentation>
<modelNamePrefix>Ws</modelNamePrefix>
<configOptions>
<library>spring-boot</library>
<useJakartaEe>true</useJakartaEe>
<dateLibrary>java8</dateLibrary>
<serializableModel>true</serializableModel>
<java8>true</java8>
<interfaceOnly>true</interfaceOnly>
<disallowAdditionalPropertiesIfNotPresent>false</disallowAdditionalPropertiesIfNotPresent>
<skipDefaultInterface>true</skipDefaultInterface>
<useBeanValidation>false</useBeanValidation>
<performBeanValidation>false</performBeanValidation>
<openApiNullable>false</openApiNullable>
<useOptional>true</useOptional>
<documentationProvider>none</documentationProvider>
<annotationLibrary>none</annotationLibrary>
</configOptions>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>pl.project13.maven</groupId>
<artifactId>git-commit-id-plugin</artifactId>
<version>4.9.10</version>
</plugin>
<plugin>
<groupId>org.graalvm.buildtools</groupId>
<artifactId>native-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
<includes>
<include>application.yml</include>
<include>banner.txt</include>
</includes>
</resource>
<resource>
<directory>src/main/resources</directory>
<filtering>false</filtering>
</resource>
</resources>
</build>

</project>

6 changes: 6 additions & 0 deletions renovate.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"config:base", ":rebaseStalePrs"
]
}
17 changes: 17 additions & 0 deletions src/main/java/nl/ictu/PseudoniemenServiceApplication.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package nl.ictu;


import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

/**
* PSuedoniemenService
*/

@SuppressWarnings("checkstyle:HideUtilityClassConstructor")
@SpringBootApplication
public class PseudoniemenServiceApplication {
public static void main(final String[] args) {
SpringApplication.run(PseudoniemenServiceApplication.class, args);
}
}
21 changes: 21 additions & 0 deletions src/main/java/nl/ictu/controller/ExchangeToken.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package nl.ictu.controller;

import nl.ictu.psuedoniemenservice.generated.server.api.ExchangeTokenApi;
import nl.ictu.psuedoniemenservice.generated.server.model.WsIdentifier;
import nl.ictu.psuedoniemenservice.generated.server.model.WsIdentifierTypes;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class ExchangeToken implements ExchangeTokenApi {
@Override
public ResponseEntity<WsIdentifier> exchangeTokenForIdentifier(final String token, final String body) {

final WsIdentifier wsIdentifier = new WsIdentifier()
.identifierType(WsIdentifierTypes.BSN)
.identifierValue("123456789");

return ResponseEntity.ok(wsIdentifier);

}
}
16 changes: 16 additions & 0 deletions src/main/java/nl/ictu/controller/GetToken.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package nl.ictu.controller;

import nl.ictu.psuedoniemenservice.generated.server.api.GetTokenApi;
import nl.ictu.psuedoniemenservice.generated.server.model.WsIdentifier;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RestController;

import java.util.UUID;

@RestController
public class GetToken implements GetTokenApi {
@Override
public ResponseEntity<String> getToken(final WsIdentifier wsIdentifier) {
return ResponseEntity.ok(UUID.randomUUID().toString());
}
}
5 changes: 5 additions & 0 deletions src/main/resources/banner.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

Pseudoniemen Service

@git.commit.id.abbrev@

76 changes: 76 additions & 0 deletions src/main/resources/openapi.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
openapi: 3.0.3
info:
title: Pseudoniemen Service
version: 0.1.0
servers:
- url: http://localhost/v1
paths:
/getToken:
post:
summary: get a token
operationId: getToken
requestBody:
$ref: '#/components/requestBodies/getTokenRequest'
responses:
'200':
$ref: '#/components/responses/getTokenResponse'
/exchangeToken/{token}:
post:
summary: get an identifier
operationId: exchangeTokenForIdentifier
parameters:
- name: token
in: path
description: a token to exchange
required: true
schema:
$ref: '#/components/schemas/token'
requestBody:
$ref: '#/components/requestBodies/exchangeTokenRequest'
responses:
'200':
$ref: '#/components/responses/exchangeTokenResponse'
components:
schemas:
token:
type: string
identifier:
type: object
properties:
identifierValue:
type: string
identifierType:
$ref: '#/components/schemas/identifierTypes'
identifierTypes:
type: string
nullable: false
enum:
- BSN
- SECTOR_PSEUDO
- ORGANISATION_PSEUDO
responses:
getTokenResponse:
description: Get a token Response
content:
application/json:
schema:
$ref: '#/components/schemas/token'
exchangeTokenResponse:
description: successful operation
content:
application/json:
schema:
$ref: '#/components/schemas/identifier'
requestBodies:
getTokenRequest:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/identifier'
exchangeTokenRequest:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/identifierTypes'
13 changes: 13 additions & 0 deletions src/test/resources/logback-test.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<configuration>
<include resource="org/springframework/boot/logging/logback/defaults.xml"/>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
</pattern>
</encoder>
</appender>
<root level="warn">
<appender-ref ref="STDOUT"/>
</root>
<logger name="nl.lostlemon" level="info"/>
</configuration>

0 comments on commit caa6ce2

Please sign in to comment.