Closed desprez closed 1 year ago
Reproduced with
{
"actions" : [ {
"module" : "init",
"date" : "2022-11-08T07:20:48.394396208Z",
"properties" : {
"packageName" : "com.mycompany.myapp",
"projectName" : "JHipster Sample Application",
"baseName" : "jhipsterSampleApplication",
"serverPort" : 8080,
"endOfLine" : "lf",
"indentSize" : 2
}
}, {
"module" : "maven-java",
"date" : "2022-11-08T07:20:48.665355620Z",
"properties" : {
"packageName" : "com.mycompany.myapp",
"projectName" : "JHipster Sample Application",
"baseName" : "jhipsterSampleApplication",
"serverPort" : 8080,
"endOfLine" : "lf",
"indentSize" : 2
}
}, {
"module" : "java-base",
"date" : "2022-11-08T07:20:48.702851613Z",
"properties" : {
"packageName" : "com.mycompany.myapp",
"projectName" : "JHipster Sample Application",
"baseName" : "jhipsterSampleApplication",
"serverPort" : 8080,
"endOfLine" : "lf",
"indentSize" : 2
}
}, {
"module" : "spring-boot",
"date" : "2022-11-08T07:20:48.759619873Z",
"properties" : {
"packageName" : "com.mycompany.myapp",
"projectName" : "JHipster Sample Application",
"baseName" : "jhipsterSampleApplication",
"serverPort" : 8080,
"endOfLine" : "lf",
"indentSize" : 2
}
}, {
"module" : "spring-boot-tomcat",
"date" : "2022-11-08T07:20:48.794521837Z",
"properties" : {
"packageName" : "com.mycompany.myapp",
"projectName" : "JHipster Sample Application",
"baseName" : "jhipsterSampleApplication",
"serverPort" : 8080,
"endOfLine" : "lf",
"indentSize" : 2
}
}, {
"module" : "spring-boot-cucumber",
"date" : "2022-11-08T07:20:48.839721162Z",
"properties" : {
"packageName" : "com.mycompany.myapp",
"projectName" : "JHipster Sample Application",
"baseName" : "jhipsterSampleApplication",
"serverPort" : 8080,
"endOfLine" : "lf",
"indentSize" : 2
}
}, {
"module" : "springdoc-mvc-openapi",
"date" : "2022-11-08T07:20:48.866659341Z",
"properties" : {
"packageName" : "com.mycompany.myapp",
"projectName" : "JHipster Sample Application",
"baseName" : "jhipsterSampleApplication",
"serverPort" : 8080,
"endOfLine" : "lf",
"indentSize" : 2
}
}, {
"module" : "zalando-problems",
"date" : "2022-11-08T07:20:48.893837198Z",
"properties" : {
"packageName" : "com.mycompany.myapp",
"projectName" : "JHipster Sample Application",
"baseName" : "jhipsterSampleApplication",
"serverPort" : 8080,
"endOfLine" : "lf",
"indentSize" : 2
}
}, {
"module" : "spring-boot-jwt",
"date" : "2022-11-08T07:20:48.940898292Z",
"properties" : {
"packageName" : "com.mycompany.myapp",
"projectName" : "JHipster Sample Application",
"baseName" : "jhipsterSampleApplication",
"serverPort" : 8080,
"endOfLine" : "lf",
"indentSize" : 2
}
}, {
"module" : "spring-boot-cucumber-jwt-authentication",
"date" : "2022-11-08T07:20:48.966525686Z",
"properties" : {
"packageName" : "com.mycompany.myapp",
"projectName" : "JHipster Sample Application",
"baseName" : "jhipsterSampleApplication",
"serverPort" : 8080,
"endOfLine" : "lf",
"indentSize" : 2
}
}, {
"module" : "springdoc-jwt",
"date" : "2022-11-08T07:20:48.984761893Z",
"properties" : {
"packageName" : "com.mycompany.myapp",
"projectName" : "JHipster Sample Application",
"baseName" : "jhipsterSampleApplication",
"serverPort" : 8080,
"endOfLine" : "lf",
"indentSize" : 2
}
}, {
"module" : "dummy-feature",
"date" : "2022-11-08T07:20:49.012879342Z",
"properties" : {
"packageName" : "com.mycompany.myapp",
"projectName" : "JHipster Sample Application",
"baseName" : "jhipsterSampleApplication",
"serverPort" : 8080,
"endOfLine" : "lf",
"indentSize" : 2
}
}, {
"module" : "spring-boot-jwt-basic-auth",
"date" : "2022-11-08T07:22:32.155026403Z",
"properties" : {
"packageName" : "com.mycompany.myapp",
"projectName" : "JHipster Sample Application",
"baseName" : "jhipsterSampleApplication",
"serverPort" : 8080,
"endOfLine" : "lf",
"indentSize" : 2
}
} ]
}
Changing this into a bug
I have tried to fix that with adding , security = @SecurityRequirement(name = "bearer-jwt") on each endpoint and It's working but I m not sure it's the good way
Yep, I don't think this is the way. In my understanding fix should be in src/main/resources/generator/server/springboot/apidocumentation/springdocjwt/SpringdocJWTConfiguration.java.mustache
Adding a bounty to motivate someone to fix this bug
Hi, I tried to use springdoc-jwt module on the dummy appplication
Then after my application started I pass the bearer token (got with the [/api/authenticate] endpoint with admin/admin credentials) into an authentication form with swagger UI:
When I invoke the getBeers enpoint :
Actual result:
curl -X 'GET' 'http://localhost:8080/api/beers' -H 'accept: /'
Bearer token didn't exist in the request and the request fails with {"title": "Unauthorized", "status": 401, "detail": "Full authentication is required to access this resource"}
Expected result:
curl -X 'GET' \ 'http://localhost:8080/api/beers' \ -H 'accept: /' \ -H 'Authorization: Bearer eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJhZG1pbiIsImF1dGgiOiJST0xFX0FETUlOIiwiZXhwIjoxNjk5Mzk2Njg2fQ.qY_SdBezB1DL70w1gKLtu6UFgXwmtr5RFrfpfQkaAAdT7YXQkGwpPOTwnp8GghHGk7vjf9XaWYjz4VhG3x4iyw'
I have tried to fix that with adding , security = @SecurityRequirement(name = "bearer-jwt") on each endpoint and It's working but I m not sure it's the good way