From e237e5741e37cefaf1a459d3fb2142f2def5a691 Mon Sep 17 00:00:00 2001 From: Jan Klattenhoff Date: Wed, 2 Oct 2024 09:58:20 +0200 Subject: [PATCH] docs(OpenAPIConfiguration): update authentication description format --- .../config/OpenAPIConfiguration.java | 37 ++++++++++++++----- 1 file changed, 27 insertions(+), 10 deletions(-) diff --git a/src/main/java/de/szut/lf8_starter/config/OpenAPIConfiguration.java b/src/main/java/de/szut/lf8_starter/config/OpenAPIConfiguration.java index 1b2282b..3c782d3 100644 --- a/src/main/java/de/szut/lf8_starter/config/OpenAPIConfiguration.java +++ b/src/main/java/de/szut/lf8_starter/config/OpenAPIConfiguration.java @@ -1,7 +1,6 @@ package de.szut.lf8_starter.config; - import io.swagger.v3.oas.models.Components; import io.swagger.v3.oas.models.OpenAPI; import io.swagger.v3.oas.models.info.Info; @@ -33,15 +32,33 @@ public class OpenAPIConfiguration { .addServersItem(new Server().url(this.context.getContextPath())) .info(new Info() .title("LF8 project starter") - .description("\n## Auth\n" + - "\n## Authentication\n" + "\nThis Hello service uses JWTs to authenticate requests. You will receive a bearer token by making a POST-Request in IntelliJ on:\n\n" + - "\n" + - "```\nPOST http://keycloak.szut.dev/auth/realms/szut/protocol/openid-connect/token\nContent-Type: application/x-www-form-urlencoded\ngrant_type=password&client_id=employee-management-service&username=user&password=test\n```\n" + - "\n" + - "\nor by CURL\n" + - "```\ncurl -X POST 'http://keycloak.szut.dev/auth/realms/szut/protocol/openid-connect/token'\n--header 'Content-Type: application/x-www-form-urlencoded'\n--data-urlencode 'grant_type=password'\n--data-urlencode 'client_id=employee-management-service'\n--data-urlencode 'username=user'\n--data-urlencode 'password=test'\n```\n" + - "\nTo get a bearer-token in Postman, you have to follow the instructions in \n [Postman-Documentation](https://documenter.getpostman.com/view/7294517/SzmfZHnd).") - + .description(""" + ## Auth + + ## Authentication + + This Hello service uses JWTs to authenticate requests. You will receive a bearer token by making a POST-Request in IntelliJ on: + + ``` + POST http://keycloak.szut.dev/auth/realms/szut/protocol/openid-connect/token + Content-Type: application/x-www-form-urlencoded + grant_type=password&client_id=employee-management-service&username=user&password=test + ``` + + or by CURL: + + ``` + curl -X POST 'http://keycloak.szut.dev/auth/realms/szut/protocol/openid-connect/token' + --header 'Content-Type: application/x-www-form-urlencoded' + --data-urlencode 'grant_type=password' + --data-urlencode 'client_id=employee-management-service' + --data-urlencode 'username=user' + --data-urlencode 'password=test' + ``` + + To get a bearer-token in Postman, you have to follow the instructions in + [Postman-Documentation](https://documenter.getpostman.com/view/7294517/SzmfZHnd). + """) .version("0.1")) .addSecurityItem(new SecurityRequirement().addList(securitySchemeName)) .components(