diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2e6bc26 --- /dev/null +++ b/.gitignore @@ -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 diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..7c32e42 --- /dev/null +++ b/pom.xml @@ -0,0 +1,109 @@ + + + 4.0.0 + + org.springframework.boot + spring-boot-starter-parent + 3.3.4 + + + nl.ictu + pseudoniemenservice + 0.0.1-SNAPSHOT + pseudoniemenservice + Demo project for Spring Boot + + 21 + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-validation + + + org.springframework.boot + spring-boot-starter-test + test + + + + + + + org.openapitools + openapi-generator-maven-plugin + 7.8.0 + + + generateServerApi + generate-sources + + generate + + + ${project.basedir}/src/main/resources/openapi.yaml + spring + nl.ictu.psuedoniemenservice.generated.server.model + nl.ictu.psuedoniemenservice.generated.server.api + false + false + false + false + Ws + + spring-boot + true + java8 + true + true + true + false + true + false + false + false + true + none + none + + + + + + + pl.project13.maven + git-commit-id-plugin + 4.9.10 + + + org.graalvm.buildtools + native-maven-plugin + + + org.springframework.boot + spring-boot-maven-plugin + + + + + src/main/resources + true + + application.yml + banner.txt + + + + src/main/resources + false + + + + + + diff --git a/renovate.json b/renovate.json new file mode 100644 index 0000000..c392209 --- /dev/null +++ b/renovate.json @@ -0,0 +1,6 @@ +{ + "$schema": "https://docs.renovatebot.com/renovate-schema.json", + "extends": [ + "config:base", ":rebaseStalePrs" + ] +} diff --git a/src/main/java/nl/ictu/PseudoniemenServiceApplication.java b/src/main/java/nl/ictu/PseudoniemenServiceApplication.java new file mode 100644 index 0000000..16b188c --- /dev/null +++ b/src/main/java/nl/ictu/PseudoniemenServiceApplication.java @@ -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); + } +} diff --git a/src/main/java/nl/ictu/controller/ExchangeToken.java b/src/main/java/nl/ictu/controller/ExchangeToken.java new file mode 100644 index 0000000..41079b4 --- /dev/null +++ b/src/main/java/nl/ictu/controller/ExchangeToken.java @@ -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 exchangeTokenForIdentifier(final String token, final String body) { + + final WsIdentifier wsIdentifier = new WsIdentifier() + .identifierType(WsIdentifierTypes.BSN) + .identifierValue("123456789"); + + return ResponseEntity.ok(wsIdentifier); + + } +} diff --git a/src/main/java/nl/ictu/controller/GetToken.java b/src/main/java/nl/ictu/controller/GetToken.java new file mode 100644 index 0000000..9fa5bad --- /dev/null +++ b/src/main/java/nl/ictu/controller/GetToken.java @@ -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 getToken(final WsIdentifier wsIdentifier) { + return ResponseEntity.ok(UUID.randomUUID().toString()); + } +} diff --git a/src/main/resources/banner.txt b/src/main/resources/banner.txt new file mode 100644 index 0000000..1fd6f38 --- /dev/null +++ b/src/main/resources/banner.txt @@ -0,0 +1,5 @@ + +Pseudoniemen Service + +@git.commit.id.abbrev@ + diff --git a/src/main/resources/openapi.yaml b/src/main/resources/openapi.yaml new file mode 100644 index 0000000..8701d4e --- /dev/null +++ b/src/main/resources/openapi.yaml @@ -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' diff --git a/src/test/resources/logback-test.xml b/src/test/resources/logback-test.xml new file mode 100644 index 0000000..d685cfe --- /dev/null +++ b/src/test/resources/logback-test.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + +