0

I have Spring Security in my Project and it requires documentation through springdoc version 1.4.3. My requirement is to be able to get response from swagger-ui.html after authentication. Currently I can see the swagger-ui.html page but upon authentication calling any rest controller gives me access error. My requirement is that I should be able to get data from my controllers after user has authenticated.

Here is a sample curl url that gets generated which works on cmd but not on swagger-ui.html

curl -X GET "localhost:8080/api/employees/" -H "accept: */*" -H "Authorization: Bearer <token> -H "Cookie: token=<token>"
l3r4nd
  • 1
  • 1

1 Answers1

1

Make sure your have configured the security using the OpenAPI annotations as well:

  • @SecurityRequirement Lists the required security schemes to execute this operation.
  • @SecurityScheme Defines a security scheme that can be used by the operations.

More explanations are available here:

Here is sample working code: